A project-level knowledge brain that gives AI agents persistent, structured context about your codebase.
- Extracts a knowledge graph from your codebase (AST + semantic analysis)
- Generates governed wiki pages (modules, entities, concepts, decisions)
- Routes agents to relevant context automatically via lifecycle hooks
- Tracks decisions, patterns, and project evolution over time
# 1. Initialize the brain
bash brain-init.sh
# 2. Run extraction (requires brain CLI)
brain .
# 3. Sync: generate pages from graph
bash scripts/sync/run-sync.sh
# 4. Verify brain health
bash scripts/sync/phase3-verify.sh/brain-sync— Full sync pipeline (extract, update, verify, commit)/brain-lint— Read-only verification audit
.ctx/ # The Brain (per-project)
protocol.md # Entry point (<500 tokens)
routing.md # Keyword -> page (<400 tokens)
index.md # Page catalog with fingerprints
graph/ # brain extraction output
concepts/ # Methodology pages (PROPOSED -> CONFIRMED)
entities/ # Code entities with confidence-scored edges
modules/ # Directory-level documentation
decisions/ # Architecture Decision Records
skills/ # Auto-detected skill packages
references/ # Swappable lint rubrics
- Start:
bash brain-init.sh— scaffold.ctx/, zero hooks - Add hooks: Enable SessionStart first, then PostToolUse, then UserPromptSubmit
- Enable skills: Routing engine activates implicitly from hooks
- Full automation: Enable SessionEnd persistence +
/brain-sync
On init, the brain detects your project stack and installs matching skills:
| Signal | Skills Activated |
|---|---|
package.json with react |
react, typescript |
tsconfig.json |
typescript |
go.mod |
go |
requirements.txt |
python |
prisma/schema.prisma |
data-modeling |
.env |
security |
Core SDLC skills (requirements, design, implementation, testing, deployment, maintenance) are always installed.
brain serve .ctx/graph/graph.jsonExposes: query_graph, get_node, get_neighbors, get_community, god_nodes, graph_stats, shortest_path. Token budget: < 2000 tokens per query.
- Existing
.agentctx/directories are untouched - Existing
CLAUDE.mdgets a single pointer line appended - Existing
.cursorrulesare never modified .ctx/can be added to.gitignoreduring evaluation