Skip to content

Instantly share code, notes, and snippets.

@wallacetju
wallacetju / llm-wiki.md
Created April 24, 2026 14:45 — forked from karpathy/llm-wiki.md
llm-wiki

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.

@wallacetju
wallacetju / Question13.java
Created May 24, 2012 03:23
Error Made: "=" written as "=="; "newWord.length" as "newWord.length()"; "return new String(newWord,0,front+1)" as "return new String(newWord);"
public String removeDuplicate(String word)
{
if(word == null)
return null;
char[] newWord = word.toCharArray();
int front=0;
boolean dup=false;
for(int i=0; i<newWord.length; i++)
{
dup=false;
public static int bitsRequired(int first, int second)
{
int count=0;
for(int num=first^second; num !=0; num>>1)
{
count+= num%2;
}
return count;
}
public class Question53
{
public int[] findNextSmall(int num)
{
int numBit[] = new int[32];
int temp = num;
int total = 0;
while(temp!=0)
{
numBit[total]=temp%2;
public class Question31
{
private Node[] array;
private int[] stack;
private int indexUsed;
pubic Question31()
{
array = new Node[100];
stack = new int[]{-1, -1, -1};
package Question25;
import LinkedList.*;
import java.util.ArrayList;
public class Question25
{
private ArrayList<Node> markList;
private LinkedList list;
public Question25()
{
package Question24;
import LinkedList.*;
public class Question24
{
private LinkedList numOne;
private LinkedList numTwo;
private LinkedList sum;
public Question24(int[] one, int[] two)
{
package question23;
import LinkedList.*;
public class Question23
{
private LinkedList list;
public Question23()
{
list = new LinkedList();
list.insert(1);
list.insert(2);
package question22;
import LinkedList.*;
public class Question22
{
private LinkedList list;
private final int LIST_SIZE = 20;
public Question22()
{
list = new LinkedList();
list.insert(1);
package question21;
import LinkedList.*;
import HashTable.*;
public class Question21
{
private LinkedList list;
private HashTable markTable;
public Question21()