I’ve been using Claude Code with codegraph and trace-mcp for structural code intelligence — but I had no visual dashboard and no memory across sessions that went deeper than raw observation capture. I wanted to fix both. This post covers exactly what I installed, what failed (and why), and the commands that work.
The goal
Three things:
- A visual graph dashboard — clickable, explorable, showing how files and modules connect
- Automatic session memory — decisions and lessons extracted from every session into a queryable knowledge base
- Nothing that requires constant setup — it should mostly just work
What I already had
Running as MCP servers in Claude Code:
- codegraph — SQLite-backed AST knowledge graph, sub-millisecond queries, tools like
codegraph_impactandcodegraph_callers - trace-mcp — 100+ semantic tools:
get_feature_context,find_usages,get_change_impact,get_dead_code, etc. - claude-mem — captures tool usage observations and injects relevant context into future sessions
Good for agents, nothing visual.
Tool 1: trace-mcp built-in visualizer (already installed)
I didn’t need to install anything for this one — trace-mcp has a visualize command that generates a standalone HTML file.
~/.trace-mcp/bin/trace-mcp visualize project \
--dir /path/to/your/project \
--output /tmp/graph.html \
--layout force \
--color-by community \
--hide-isolated \
--no-open
xdg-open /tmp/graph.html # Linux
open /tmp/graph.html # macOS
This produced a force-directed graph with 92 nodes, 141 edges, 16 communities for my project in under 5 seconds. Color-coded by detected module community — authentication code clusters separately from CLI code clusters separately from template code.
Useful flags:
| Flag | Options | What it does |
|---|---|---|
--layout |
force, hierarchical, radial |
hierarchical is best for spotting long dependency chains |
--color-by |
community, language, framework_role |
language is useful for mixed-language repos |
--granularity |
file, symbol |
symbol drills down to individual functions and classes |
You can also visualize a single file:
~/.trace-mcp/bin/trace-mcp visualize src/server.ts --dir . --no-open --output /tmp/server.html
Tool 2: CodeGraphContext — live web dashboard
This is a Python tool that indexes your codebase into KuzuDB (a local graph database) and serves an interactive web UI at localhost:8000.
Install
The package requires Python 3.9+. Use uv to avoid fighting system Python:
# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install CodeGraphContext with Python 3.12
uv tool install codegraphcontext --python 3.12
Find the binary:
which cgc
# on Linux with snap code: ~/snap/code/241/.local/bin/cgc
# standard: ~/.local/bin/cgc (if uv tools dir is in PATH)
Index your project
cgc --db kuzudb index /path/to/your/project
# Repository indexed with 195 files.
Gotcha: if you see a lock error on first run, a background process left a stale lock file. Run
rm -f ~/.codegraphcontext/global/db/kuzudb*and retry.
Start the visualizer
cgc --db kuzudb visualize --repo /path/to/your/project --port 8000 &
open http://localhost:8000
Stop it with pkill -f "cgc.*visualize".
Re-index after big changes:
cgc --db kuzudb index --force /path/to/your/project
What you get: an interactive web UI with clickable nodes, relationship exploration, search, and an AI-assisted query interface. Dark mode by default.
Tool 3: claude-memory-compiler — sessions become a knowledge base
This is the most architecturally interesting one. It’s inspired by Andrej Karpathy’s LLM Knowledge Base idea: instead of just capturing raw observations, it extracts structured decisions, lessons, patterns, and gotchas from each session and compiles them into cross-referenced articles.
Install
git clone --depth=1 https://github.com/coleam00/claude-memory-compiler \
~/tools/claude-memory-compiler
cd ~/tools/claude-memory-compiler
uv sync
Wire the hooks
Add these three hooks to ~/.claude/settings.json (merge into your existing hooks object):
{
"hooks": {
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "cd ~/tools/claude-memory-compiler && uv run python hooks/session-start.py",
"timeout": 15
}]
}],
"PreCompact": [{
"hooks": [{
"type": "command",
"command": "cd ~/tools/claude-memory-compiler && uv run python hooks/pre-compact.py",
"timeout": 10
}]
}],
"SessionEnd": [{
"hooks": [{
"type": "command",
"command": "cd ~/tools/claude-memory-compiler && uv run python hooks/session-end.py",
"timeout": 10
}]
}]
}
}
Use full paths for uv if it’s not in your default PATH (check with which uv).
How it works
- SessionStart: reads
knowledge/index.mdand the last 2 days of daily logs, injects them as context (up to 20,000 chars) - PreCompact: fires before auto-compaction, captures the transcript before it gets summarized away
- SessionEnd: extracts decisions/lessons from the transcript into
daily/YYYY-MM-DD.md
After a few sessions, manually compile into structured articles:
cd ~/tools/claude-memory-compiler
uv run python scripts/compile.py
Then query it:
uv run python scripts/query.py "how did we handle the auth middleware refactor?"
What didn’t work (and why)
GitNexus — the most-starred tool in this category right now (28k stars). Requires GLIBC 2.32; Ubuntu 20.04 ships with 2.31. Its native module @ladybugdb/core fails to load with ERR_DLOPEN_FAILED. No workaround without upgrading the OS or using Docker.
GitNexus browser version — works fine. Drop your GitHub repo URL at gitnexus.vercel.app. Runs Tree-sitter as WASM in the browser, gives you the same interactive graph + Graph RAG chat without any local install.
CodeGraphContext with FalkorDB — the embedded FalkorDB uses redislite which tries to start a redis-server process. That process wasn’t in PATH. KuzuDB works fine as the backend instead.
npm install -g gitnexus on Node 21 — gitnexus requires Node ≥22. If you have nvm, switch first: nvm use 22. The ~/.npmrc prefix setting can conflict with nvm — run nvm use --delete-prefix v22.x.x to fix it.
The stack that works
| Tool | What it gives you | How to start |
|---|---|---|
| codegraph MCP | structural queries in Claude Code | automatic |
| trace-mcp MCP | semantic queries + 100 analysis tools | automatic |
| trace-mcp visualize | static HTML dependency graph | trace-mcp visualize project --dir . --output /tmp/g.html |
| CodeGraphContext | live interactive dashboard at :8000 | cgc --db kuzudb visualize --repo . --port 8000 & |
| claude-mem | cross-session observation injection | automatic (plugin) |
| claude-memory-compiler | structured knowledge base from sessions | automatic (hooks) + manual compile |
| GitNexus (browser) | visual graph for any GitHub repo | gitnexus.vercel.app |
The trace-mcp graph takes 5 seconds and needs no server. CodeGraphContext takes 30 seconds to index and gives you a richer, persistent, queryable UI. Run both — they answer different questions.
Quick alias setup
Add to your .bashrc or .zshrc:
# Code graph visualizer
alias cgc-viz='cgc --db kuzudb visualize --repo . --port 8000'
alias cgc-index='cgc --db kuzudb index .'
alias cgc-stop='pkill -f "cgc.*visualize"'
# trace-mcp quick graph
alias tmcp-graph='~/.trace-mcp/bin/trace-mcp visualize project --dir . --output /tmp/graph.html --layout force --hide-isolated --no-open && xdg-open /tmp/graph.html'
# memory compiler
alias mem-compile='cd ~/tools/claude-memory-compiler && uv run python scripts/compile.py'
alias mem-query='cd ~/tools/claude-memory-compiler && uv run python scripts/query.py'
The combination of structural MCP tools (codegraph + trace-mcp) for agents plus visual dashboards (trace-mcp viz + CodeGraphContext) for humans gives you a full picture of your codebase — queryable by AI and explorable by eye. The memory compiler on top means the architectural decisions from every session accumulate into something you can actually retrieve next time.