OpenFS Agent Wiki

From Derek Davis
Jump to navigationJump to search

OpenFS Agent Wiki[edit]

@openfs/agent-wiki is a persistent, compounding knowledge base inspired by Andrej Karpathy's LLM Wiki pattern. Sources are immutable facts; wiki pages are LLM-synthesized and grow smarter over time.

How It Works[edit]

  1. Ingest — raw source docs land in /sources/. Immutable, append-only.
  2. Synthesize — LLM reads sources + existing wiki pages and creates/updates /wiki/*.md files that distill patterns and cross-reference concepts.
  3. Query — FTS search finds relevant wiki pages, LLM answers with citations back to wiki paths.
  4. Persist — valuable answers can be written back as new wiki pages, compounding knowledge over time.
  5. Lint — wiki pages self-evaluate for consistency, gaps, and outdated info.

API[edit]

const wiki = await AgentWiki.create(fs, llm);

// Ingest a source document
await wiki.ingest("meeting-notes.md", rawContent);

// Ask a question
const { answer, citations } = await wiki.query("What decisions were made?");

// List all synthesized pages
const pages = await wiki.pages();

MediaWiki Integration[edit]

This wiki uses @openfs/agent-wiki-mw to keep MediaWiki and OpenFS in sync:

  • Source pages in MW → ingested into OpenFS
  • LLM synthesizes wiki pages → pushed back to MW as pages
  • OpenFS Terminal — live interface for querying and managing the sync