ctx-tree
Claude Code with a photographic memory.
ctx-tree is a persistent SQLite property graph that sits between Claude Code and every tool call. When Claude reads a file, runs a grep, fetches a URL, or calls any MCP tool, a hook intercepts the result, stores it in the graph, and returns a compact nodeId reference (~60 tokens) instead of dumping raw data into the context window.
The same operation next week costs zero tokens. It's already in the graph.
The problem
LLM context windows are a scarce, write-once resource. Tool calls flood the window with low-signal data:
Readon a 500-line file: ~4,200 tokens, used once, never freedGrepacross 8 files: ~8,400 tokens, immediately staleWebFetchon API docs: ~11,000 tokens, 90% noise
By the time a complex task is 60% done, the window is full of content that already answered its question. Claude starts dropping earlier context. Sessions die before work is done.
This is context rot.
The solution
ctx-tree intercepts every tool call via Claude Code hooks:
- The native tool is blocked — no raw data enters the context window
- The equivalent ctx-tree MCP tool runs instead
- The result is stored in the graph — chunked, indexed, linked
- Claude gets back a compact nodeId (~60 tokens)
- Any future session can recall it for free via
ctx_tree_compose
The graph persists across sessions. Knowledge accumulates. Context stays lean.
Next steps
- Install ctx-tree — one-line install via agent marketplace
- Getting Started — first session walkthrough
- How it works — deep dive into the architecture