Agent skill · research science · github
mini-context-graph
A persistent, compounding knowledge base combining Karpathy's LLM Wiki pattern with a structured knowledge graph. Ingest documents once — the LLM writes wiki pages, extracts entities/relations into the graph, and stores raw content for evidence retrieval. Knowledge accumulates and cross-references; it is never re-derived from scratch.
Why this skill is useful
Adds a complete executable workflow for persistent knowledge management with RAG, including document ingestion, entity extraction, and wiki generation.
What it needs
Requires python installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 37,534 stars on the source repository.
What this skill does
Mini Context Graph Skill The Core Idea Standard RAG re-discovers knowledge from scratch on every query. This skill is different: 1. Wiki layer — The LLM writes and maintains persistent markdown pages (summaries, entity pages, topic syntheses). Cross-references are already there. The wiki gets richer with every ingest. 2. Graph layer — Entities and relations are extracted once and stored as a navigable knowledge graph. BFS traversal answers structural queries without re-reading sources. 3. Raw source layer — Original documents are stored immutably with chunks. Provenance links tie every graph node and edge back to the exact text that supports it. The LLM writes; the Python tools handle all bookkeeping. --- Three Layers Layer Where What the LLM does What Python does ------- ------- ------------------- ----------------- Raw Sources data/documents.json Reads (never modifies) Stores chunks + metadata Wiki wiki/ (markdown) Writes/updates pages Manages index.md + log.md Graph data/graph.json Extracts entities + relations Persists, deduplicates, traverses --- ⚡ Quick Start for Agents A complete runnable version of this workflow is in scripts/templateagentworkflow.py — copy and adapt it. --- Operations Ingest When a user provides a new document: 1. Read references/ingestion.md — entity/relation extraction rules. 2. Read references/ontology.md — type normalization rules. 3. Extract entities and relations using your LLM reasoning. 4. Call skill.ingestwithcontent(...) — stores raw content + chunks + graph nodes + provenance. 5. Write a wiki summary page using wikistore.writepage(category="summary", ...). 6. Update entity pages — for each new/updated entity, write or update wikistore.writepage(category="entity", ...). 7. Update topic pages if the document touches an existing synthesis topic. 8. A single document ingest will typically touch 3–10 wiki pages. Query When a user asks a question: 1. Check the wiki first — wikistore.searchwiki(query) to find relevant pages. Read them. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills github/mini-context-graph