Practical Notes
- Index once, then query call chains/dependencies instead of re-reading files repeatedly.
- Start with a small subfolder first to validate performance before indexing monorepos.
Two modes: CLI for humans, MCP for agents
You can use CodeGraphContext as:
- a CLI to ask structural questions (callers/callees, dependencies),
- an MCP server so your assistant can query structure via tools.
Practical workflow for better agent context
1) Index your repo
codegraphcontext index2) Ask “structure” questions first
Good first questions:
- “What calls this function?”
- “Where does this module get instantiated?”
- “Show the call chain from HTTP handler to DB write.”
3) Feed the query results to your agent
Instead of dumping full files, give the agent:
- the top 10 nodes in the call chain,
- the 3–5 files it must open,
- constraints (touch only X modules, avoid breaking API).
Operational advice
- Use file watching mode during refactors only when needed (it updates the graph continuously).
- Treat the graph DB as a cache: rebuild when your repo changes dramatically.
FAQ
Q: Do I need MCP to get value? A: No. The CLI alone helps answer structural questions quickly.
Q: When should I re-index? A: After large refactors or when results look stale; treat the graph as a cache.
Q: How does this help agents? A: It gives reliable call/dependency context so agents stop guessing where logic lives.