npx skills add ...
npx skills add github/awesome-copilot --skill mini-context-graph
npx skills add github/awesome-copilot --skill 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.
Standard RAG re-discovers knowledge from scratch on every query. This skill is different:
The LLM writes; the Python tools handle all bookkeeping.
| 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 |
When a user provides a new document:
references/ingestion.md — entity/relation extraction rules.references/ontology.md — type normalization rules.skill.ingest_with_content(...) — stores raw content + chunks + graph nodes + provenance.wiki_store.write_page(category="summary", ...).wiki_store.write_page(category="entity", ...).When a user asks a question:
wiki_store.search_wiki(query) to find relevant pages. Read them.skill.query_with_evidence(query).supporting_documents.Periodically health-check the wiki:
Ask the LLM to review and fix: broken links, orphan pages, stale claims, missing cross-references. See references/lint.md for full lint workflow.
supporting_text for every entity and relation — this enables provenance| Method | Purpose | When to Use |
|---|---|---|
skill.ingest_with_content(doc_id, title, source, raw_content, entities, relations) | Full RAG ingest: raw docs + graph + provenance | Every new document |
skill.add_node(name, node_type) | Add single entity (no provenance) | Quick additions without a source doc |
skill.add_edge(source_name, target_name, relation, confidence) | Add single relation | Quick additions without a source doc |
skill.query(query) | Graph-only retrieval → subgraph | Structural queries |
skill.query_with_evidence(query) | Graph + provenance → subgraph + source chunks | Queries requiring citations |
wiki_store.write_page(category, title, content, summary) | Write/update a wiki page | After every ingest; after answering queries |
wiki_store.read_page(category, title) | Read a wiki page | Before answering; for cross-referencing |
wiki_store.search_wiki(query) | Keyword search across wiki | Fast path before graph traversal |
wiki_store.list_pages(category) | List all wiki pages | Getting an overview |
wiki_store.get_log(last_n) | Read recent operations | Understanding wiki history |
wiki_store.lint_wiki() | Health check | Periodic maintenance |
documents_store.list_documents() | List all ingested raw sources | Audit / provenance checking |
documents_store.search_chunks(query) | Chunk-level search | Finding specific evidence |
"The wiki is a persistent, compounding artifact. The cross-references are already there. The synthesis already reflects everything you've read." — Karpathy
| Layer | What Happens | Who Owns It |
|---|---|---|
| LLM Reasoning | Extraction, synthesis, writing wiki pages | Agent (.md guidance files) |
| Wiki Persistence | Index, log, file I/O | wiki_store.py |
| Graph Persistence | Dedup, index, BFS traverse | graph_store.py, retrieval_engine.py |
| Raw Source Storage | Immutable docs + chunks + provenance | documents_store.py |
The human curates sources and asks questions. The LLM writes the wiki, extracts the graph, and answers with citations. Python handles all bookkeeping.
from scripts.tools import wiki_store
issues = wiki_store.lint_wiki()
# Returns: {orphan_pages, missing_pages, broken_wikilinks, isolated_pages}