6 MCP tools. Entity-level intelligence for agents.
Real numbers from sem's own codebase (48 Rust files).
How many tokens does an agent need to understand EntityGraph and everything it affects?
sem_context packs the target entity + all dependents + transitive signatures into a token budget. The agent gets the blast radius, not the whole repo. At 8K tokens, it fits 121 entities from across the codebase.
"How many things break if EntityGraph changes?"
grep EntityGraphsem_impactsem_impact walks the entity dependency graph and finds everything that transitively depends on the target. No hallucination, no false positives, no missed cross-file callers. In 56ms.
"Which tests should I run after changing EntityGraph?"
cargo testsem_impact(mode="tests")
Same questions about code changes, answered by Claude Sonnet 4.5. One gets sem diff JSON, the other gets raw git diff.
Agents call multiple graph tools per session. Without caching, each tool rebuilds the entity graph from scratch. With caching, the first call builds it once and every subsequent call reuses it.
.sem/cache.db.
Memory cache serves sequential calls in the same session. SQLite cache survives process restarts.
If any file's mtime changes, the cache is invalidated and the graph rebuilds.
Every tool, measured against sem's own codebase (48 Rust files). Single-process cold calls.
Cold per-process calls. In a live session with graph caching, graph tools (impact, context) average 21ms after the first call.