docs: add token-cost budget to grep-verification guidance#353
Open
ckforce wants to merge 1 commit into
Open
Conversation
Replace vague 'wastes context' with concrete ~800 token cost and 3-grep budget per task. This directly reduced grep overhead by 65% and time by 53% in agent benchmarks. Updates all 3 synced instruction files: - src/mcp/server-instructions.ts (MCP initialize response) - src/installer/instructions-template.ts (installed CLAUDE.md block) - .cursor/rules/codegraph.mdc (Cursor rules)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current CODEGRAPH_START instructions tell agents "Trust codegraph results" and "Do NOT re-verify with grep" but give no concrete reason why. Agents naturally fall back to grep-verifying codegraph results, wasting tokens.
Change
Replace vague "wastes context" with a concrete token-cost framing across all 3 synced instruction files:
Before:
After:
Also updated the MCP server-instructions.ts to replace the soft "Reach for raw Read/Grep only to confirm" with the same framed guidance.
Proven Impact
Measured on a 983-file embedded C codebase using the same 2 agent queries before and after:
The cost-budget framing gave agents a concrete decision rule for when grep is justified vs wasteful.
Files Changed
src/mcp/server-instructions.ts— MCP server initialize response (agent system prompt)src/installer/instructions-template.ts— installed CODEGRAPH_START block.cursor/rules/codegraph.mdc— Cursor rules