All SkillsGet Started Free
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.
MCP get_skill({ skillId: "mini-context-graph-6e0371b2" })Use this skill with your agent
Create a free account and connect via MCP
# 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
```python
from scripts.contextgraph import ContextGraphSkill
from scripts.tools import wiki_store
skill = ContextGraphSkill()
# ===== INGEST WITH FULL RAG + WIKI =====
# 1. Read references/ingestion.md and references/ontology.md first
# 2. Extract entities and relations (LLM reasoning step)
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."},
]
result = skill.ingest_with_content(
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=entities,#github-copilot#research#synthesispython