godmode:mini-context-graph
Skill1 starsChanged 57 days agoMITView on GitHub
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 and relations into the graph, and stores raw content for evidence retrieval. Knowledge accumulates and cross-references across sessions; it is never re-derived from scratch. Use when building or querying a knowledge base where provenance, structural traversal, and cumulative synthesis matter.
- Installs packages
In this repository78 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- godmode:agent-governanceSkill
- godmode:agent-improvement-loopSkill
- agents-skill-saveSkill
- baml-add-typesSkill
- godmode:brainstormSkill
- godmode:capSkill
- godmode:changelogSkill
- godmode:ci-fixSkill
- godmode:code-reviewSkill
- godmode:context-mapSkill
- godmode:cross-issueSkill
- godmode:crs-discoverSkill
- godmode:crs-hook-testingSkill
- godmode:crs-installSkill
- godmode:crs-ledger-applySkill
- godmode:crs-ledger-diffSkill
- godmode:crs-propose-rulesSkill
- godmode:crs-validateSkill
- godmode:dead-codeSkill
- godmode:decomposeSkill
- godmode:dep-auditSkill
- godmode:dep-bumpSkill
- godmode:designSkill
- devloop-session-primerSkill
- godmode:dialecticSkill
- godmode:doc-maintainerSkill
- godmode:doc-reviewSkill
- godmode:doc-syncSkill
- godmode:doc-writerSkill
- doob-db-inspectorSkill
- doob-release-managerSkill
- godmode:doublecheckSkill
- dual-forge-pr-mergeSkill
- gh-bulk-issuesSkill
- godmode:health-scoreSkill
- godmode:ingestSkill
- godmode:introspectionSkill
- godmode:issue-triageSkill
- godmode:memory-bankingSkill
- godmode:mergeSkill
- godmode:mistake-trackerSkill
- godmode:moaSkill
- notfiles-release-workflowSkill
- godmode:observability-as-infrastructureSkill
- godmode:parallel-agentsSkill
- godmode:pattern-learnerSkill
- planning-with-cruxSkill
- godmode:pr-authorSkill
- godmode:receiving-reviewSkill
- godmode:refactoringSkill
- godmode:release-notesSkill
- release-readiness-checkSkill
- remote-upstream-triageSkill
- repo-gap-backlogSkill
- godmode:rust-conventionsSkill
- rustqualSkill
- rustqual-workspaceSkill
- rust-release-workflow-authorSkill
- godmode:self-reflectSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 11 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
All commands use --root <dir> to set the data directory (default: .kgx in cwd).
- Distinctive: line 53
When a new document arrives:
- Very specific: line 55
Read references/ingestion.md — entity/relation extraction rules.
- Very specific: line 56
Read references/ontology.md — type normalization rules.
- Very specific: line 60
Write a wiki summary page via kgx wiki write.
- Very specific: line 61
Update entity pages — for each new or updated entity, write or update via kgx wiki write --category entity.
- Distinctive: line 63
Update topic pages if the document touches an existing synthesis topic.
- Distinctive: line 82
When answering a question:
- Very specific: line 84
Check the wiki first — kgx wiki search <query> to find relevant pages.
- Distinctive: line 85
If the wiki has a good answer, synthesize from wiki pages (fast path).
- Very specific: line 86
If deeper graph traversal is needed, call kgx query <entity-name>.
- Distinctive: line 88
If the answer produces new synthesis, file it back as a wiki topic page.
- Distinctive: line 118
Do NOT add entities not explicitly present in the source text
- Distinctive: line 119
Do NOT add relations without direct textual evidence
- Distinctive: line 120
Do NOT add edges with confidence below 0.6
- Distinctive: line 122
Write a wiki summary page for every ingested document
- Distinctive: line 123
Update existing entity pages when new information arrives
- Very specific: line 131
Only edges with confidence >= 0.6 (MIN_CONFIDENCE)
- Distinctive: line 133
Do NOT fabricate nodes or edges not present in the graph
- Very specific: line 139
All commands output JSON to stdout.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mini Context Graph
Standard RAG re-discovers knowledge from scratch on every query. This skill is different:
- Wiki layer — Persistent markdown pages (summaries, entity pages, topic syntheses). Cross-references are already there. The wiki gets richer with every ingest.
- Graph layer — Entities and relations are extracted once and stored as a navigable knowledge graph. BFS traversal answers structural queries without re-reading sources.
- Raw source layer — Original documents stored immutably with chunks. Provenance links tie every graph node and edge back to the exact text that supports it.
The LLM writes; kgx handles all bookkeeping.
Three Layers
| Layer | Where | What the LLM does | What kgx does |
| Raw Sources | .kgx/data/documents.json | Reads (never modifies) | Stores chunks + metadata |
| Wiki | .kgx/wiki/ (markdown) | Writes/updates pages | Manages index.md + log.md |
| Graph | .kgx/data/graph.json | Extracts entities + relations | Persists, deduplicates, traverses |
Setup
Install the kgx CLI from the kgx workspace:
cargo install --path ~/dev/kgx/crates/kgx-cliAll commands use --root <dir> to set the data directory (default: .kgx in cwd).
Ingest
When a new document arrives:
- Read
references/ingestion.md— entity/relation extraction rules. - Read
references/ontology.md— type normalization rules. - Extract entities and relations via LLM reasoning.
- Pipe a JSON payload to
kgx ingest— stores raw content, chunks, graph nodes, provenance. - Write a wiki summary page via
kgx wiki write. - Update entity pages — for each new or updated entity, write or update via
kgx wiki write --category entity. - Update topic pages if the document touches an existing synthesis topic.
A single document ingest typically touches 3-10 wiki pages.
# Ingest a document with entities and relations
'{"doc_id":"doc_001","title":"System Crash Analysis","source":"/docs/incident_report.pdf","raw_content":"System crashes due to memory leaks. Memory leaks occur when objects are not released.","entities":[{"name":"memory leak","type":"issue","supporting_text":"memory leaks cause crashes"},{"name":"system crash","type":"issue","supporting_text":"system crashes due to memory leaks"}],"relations":[{"source":"memory leak","target":"system crash","type":"causes","confidence":1.0,"supporting_text":"System crashes due to memory leaks."}]}' | kgx ingest
# => {"doc_id": "doc_001", "chunk_count": 1, "nodes_added": 2, "edges_added": 1}
# Write a wiki summary page (content from a file)
# Write the markdown to a temp file, then pipe it:
open /tmp/wiki-page.md | kgx wiki write --category summary --title "System Crash Analysis Summary" \
--summary "Incident report: memory leaks cause system crashes."Query
When answering a question:
- Check the wiki first —
kgx wiki search <query>to find relevant pages. Read them. - If the wiki has a good answer, synthesize from wiki pages (fast path).
- If deeper graph traversal is needed, call
kgx query <entity-name>. - Return the answer with evidence citations from
supporting_chunks. - If the answer produces new synthesis, file it back as a wiki topic page.
# Fast path — search wiki
kgx wiki search "memory leak"
# => [{"slug": "...", "category": "summary", "path": "...", "snippet": "..."}]
# Full path with provenance — BFS from a seed entity
kgx query "memory leak"
# => {"query": "...", "nodes": [...], "edges": [...], "supporting_chunks": [...]}Lint
Periodically health-check the wiki:
kgx wiki lint
# => {"orphan_pages": [...], "missing_pages": [...], "broken_wikilinks": [...], "isolated_pages": [...]}Review and fix: broken links, orphan pages, stale claims, missing cross-references.
See references/lint.md for the full lint workflow.
Ingestion Rules
- Do NOT add entities not explicitly present in the source text
- Do NOT add relations without direct textual evidence
- Do NOT add edges with confidence below 0.6
- Provide
supporting_textfor every entity and relation — this enables provenance - Write a wiki summary page for every ingested document
- Update existing entity pages when new information arrives
- Flag contradictions in wiki pages when new data conflicts with old claims
Retrieval Constraints
- Traversal depth must not exceed 2 (
MAX_GRAPH_DEPTH) - Only edges with confidence >= 0.6 (
MIN_CONFIDENCE) - Maximum 50 nodes returned (
MAX_NODES) - Do NOT fabricate nodes or edges not present in the graph
CLI Reference
All commands output JSON to stdout. Use --root <dir> to override the data directory.
| Command | Purpose | When to use |
kgx ingest (stdin JSON) | Full ingest: raw docs + graph + provenance | Every new document |
kgx query <name> | BFS subgraph + provenance chunks | Queries requiring citations |
kgx graph add-node <name> --entity-type <t> | Add single entity | Quick additions without a source doc |
kgx graph add-edge <src> <tgt> --relation-type <t> | Add single relation | Quick additions without a source doc |
kgx graph search <query> | Search nodes by keyword | Finding entities |
kgx wiki write --category <c> --title <t> --summary <s> (stdin) | Write/update a wiki page | After every ingest; after queries |
kgx wiki read --category <c> --title <t> | Read a wiki page | Before answering; cross-referencing |
kgx wiki search <query> | Keyword search across wiki | Fast path before graph traversal |
kgx wiki list --category <c> | List all wiki pages | Getting an overview |
kgx wiki lint | Health check | Periodic maintenance |
kgx docs list | List all ingested raw sources | Audit / provenance checking |
kgx docs search <query> | Chunk-level search | Finding specific evidence |
kgx export --format json --output <dir> | Export full context as JSON | Snapshots, backups, data exchange |
kgx export --format markdown --output <dir> | Export as Obsidian-compatible vault | Human review, Obsidian integration |
kgx stats | Node/edge/document counts | Quick overview |
Responsibility Split
| Layer | What happens | Owned by |
| LLM Reasoning | Extraction, synthesis, wiki writing | Agent (this skill + reference docs) |
| All Persistence | Graph, wiki, documents, dedup, traversal | kgx CLI (Rust) |
The human curates sources and asks questions. The LLM writes the wiki, extracts the
graph, and answers with citations. kgx handles all bookkeeping.
Related
skills/context-map/SKILL.md— pre-implementation codebase mapping (same evidence-first pattern)skills/doublecheck/SKILL.md— verify claims extracted during ingest before committing themreferences/ingestion.md— entity/relation extraction rules (read before every ingest)references/ontology.md— type normalization rulesreferences/lint.md— wiki health-check workflow- Source: https://github.com/89jobrien/kgx
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

