Context
We're integrating CodeGraph (v1.4.1) as the code-intelligence layer of a codebase-scout workflow for AI agents, with a hard token budget per scout run. We measured every read command's output on a 212-file TypeScript repo (2,767 nodes) to design the integration. (Related: #1280 for structured output, #1281 for NO_COLOR — this one is the biggest lever of the three for us.)
explore is the only read command whose output can't be bounded:
| Invocation |
Bytes |
~Tokens |
explore "how does hybridSearch work" |
25,053 |
~6,300 |
same with --max-files 3 |
18,543 |
~4,600 |
--max-files cut only 26% — the cost driver is verbatim source of large symbols, not file count. Every other read command caps cleanly (query/callers/callees --limit, files --max-depth/--no-metadata, node --limit/--symbols-only).
Ask
A byte (or line) budget for explore — e.g. --max-bytes N — that truncates per-symbol source blocks (keeping signatures + the call-path/blast-radius narrative, the cheap high-value part) once the budget is hit, with an explicit [truncated: N bytes over budget] marker so agents know to narrow the query.
This would let agent workflows guarantee "one explore ≤ X tokens" instead of instructing models to hope the query is narrow enough.
Context
We're integrating CodeGraph (v1.4.1) as the code-intelligence layer of a codebase-scout workflow for AI agents, with a hard token budget per scout run. We measured every read command's output on a 212-file TypeScript repo (2,767 nodes) to design the integration. (Related: #1280 for structured output, #1281 for NO_COLOR — this one is the biggest lever of the three for us.)
exploreis the only read command whose output can't be bounded:explore "how does hybridSearch work"--max-files 3--max-filescut only 26% — the cost driver is verbatim source of large symbols, not file count. Every other read command caps cleanly (query/callers/callees --limit,files --max-depth/--no-metadata,node --limit/--symbols-only).Ask
A byte (or line) budget for
explore— e.g.--max-bytes N— that truncates per-symbol source blocks (keeping signatures + the call-path/blast-radius narrative, the cheap high-value part) once the budget is hit, with an explicit[truncated: N bytes over budget]marker so agents know to narrow the query.This would let agent workflows guarantee "one explore ≤ X tokens" instead of instructing models to hope the query is narrow enough.