Skip to content

Instantly share code, notes, and snippets.

@Adam-D-Lewis
Adam-D-Lewis / llm-wiki.md
Created April 6, 2026 15:03 — 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.

@Adam-D-Lewis
Adam-D-Lewis / gist:08e555569f35d0b482846d990aca4966
Last active September 12, 2025 22:07
pydantic-mcp-client-server-example.py
# You'll need to save the 2 files separately in the same dir to run.
# mcp-server.py =================================================================================
from pathlib import Path
from mcp.server.fastmcp import FastMCP
server = FastMCP('Pydantic AI Server')
@server.tool()
@Adam-D-Lewis
Adam-D-Lewis / pystray_example.py
Last active August 21, 2025 16:40
pystray (0.19.5) example
import os
import sys
import threading
import time
import webbrowser
from dataclasses import dataclass
from datetime import datetime
from typing import Iterable, Tuple
# Third-party
import panel as pn
script = """
<script>
function querySelectorDeep(selector, rootNode=document.body) {
const arr = []
const traverser = node => {
// 1. decline all nodes that are not elements
if(node.nodeType !== Node.ELEMENT_NODE) {
@Adam-D-Lewis
Adam-D-Lewis / voice_type.py
Last active June 19, 2023 16:18
Convert voice to typed text output
# POC Type with your voice script
# You may also need to install the additional dependencies: portaudio flac
from pathlib import Path
import speech_recognition as sr
import pyaudio
from pynput.keyboard import Controller
from threading import Thread
import wave
@Adam-D-Lewis
Adam-D-Lewis / example_usage
Created March 23, 2021 05:10 — forked from tgarc/example_usage
Jekyll IPython notebook converter
ipython nbconvert --to markdown <notebook>.ipynb --config jekyll.py