Skip to content

Instantly share code, notes, and snippets.

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@byorgey
byorgey / FastForwardLCG.hs
Created August 8, 2018 03:53
Proof-of-concept Haskell implementation of LCG fast-forwarding
-- An LCG consists of three values: a multiplier, an offset, and a
-- modulus.
data LCG = LCG
{ multiplier :: Integer
, offset :: Integer
, modulus :: Integer
}
deriving Show
@petertseng
petertseng / exercism-teams.rb
Last active May 10, 2017 06:48
Exercism teams
require 'json'
require 'set'
# Create a personal access token at https://github.com/settings/tokens
# It needs only one scope: read:org ("Read org and team membership").
TOKEN_FILE = 'secrets/token.txt'.freeze
SLEEP_TIME = 2
global_name = 'track-maintainers'.freeze
@bellbind
bellbind / index.html
Last active November 2, 2024 00:19
[react][redux]Reversi Game with React/Redux and React-Redux
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/react@15.3.1/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.3.1/dist/react-dom.js"
></script>
<script src="https://unpkg.com/redux@3.6.0/dist/redux.js"></script>
<script src="https://unpkg.com/react-redux@4.4.5/dist/react-redux.js"
></script>
# Multiple inheritance with Modules as an alternative to injected composition
# from Sandi Metz's talk [Nothing is Something](http://confreaks.tv/videos/bathruby2015-nothing-is-something)
# Like Sandi's 'direct' DI method this has behavior outside of the base class
# that gets composed together. However in this gist I compose modules in class
# definitions instead of injecting collaborators.
# Tradeoffs between this and Sandi's version are that in this case the API consumer doesn't
# have to know how to make a RandomEchoHouse (no `house = House.new(formatter: Whatever.new)`),
# but also the API consumer can't make anything not already accounted for either.
@remcopeereboom
remcopeereboom / factorial.rb
Created February 20, 2015 14:40
Enabling tail recursion in ruby
require_relative 'tail_call_optimization' # All files loaded AFTER this file with have tail-recursion enabled.
require_relative 'tail_factorial'