Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor/rules/codegraph.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Use codegraph for **structural** questions — what calls what, what would break
### Rules of thumb

- **Answer directly — don't delegate exploration.** For "how does X work" / architecture / trace questions, answer with 2-3 codegraph calls: `codegraph_context` first, then ONE `codegraph_explore` for the source of the symbols it surfaces. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent — or running a grep + read loop — repeats work codegraph already did and costs more for the same answer.
- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
- **Don't grep-verify codegraph results — each unnecessary verification costs ~800 tokens.** They come from a full AST parse. Budget: 3 grep verifications per task. Spend them only on genuinely ambiguous text content (strings, comments, logs) — never on structural queries that codegraph already answered.
- **Don't grep first** when looking up a symbol by name. `codegraph_search` is faster and returns kind + location + signature in one call.
- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context — `codegraph_context` is one call.
- **Don't loop `codegraph_node` over many symbols** — one `codegraph_explore` call returns several symbols' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.
Expand Down
2 changes: 1 addition & 1 deletion src/installer/instructions-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Use codegraph for **structural** questions — what calls what, what would break
### Rules of thumb

- **Answer directly — don't delegate exploration.** For "how does X work" / architecture / trace questions, answer with 2-3 codegraph calls: \`codegraph_context\` first, then ONE \`codegraph_explore\` for the source of the symbols it surfaces. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent — or running a grep + read loop — repeats work codegraph already did and costs more for the same answer.
- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
- **Don't grep-verify codegraph results — each unnecessary verification costs ~800 tokens.** They come from a full AST parse. Budget: 3 grep verifications per task. Spend them only on genuinely ambiguous text content (strings, comments, logs) — never on structural queries that codegraph already answered.
- **Don't grep first** when looking up a symbol by name. \`codegraph_search\` is faster and returns kind + location + signature in one call.
- **Don't chain \`codegraph_search\` + \`codegraph_node\`** when you just want context — \`codegraph_context\` is one call.
- **Don't loop \`codegraph_node\` over many symbols** — one \`codegraph_explore\` call returns several symbols' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.
Expand Down
4 changes: 1 addition & 3 deletions src/mcp/server-instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ then ONE \`codegraph_explore\` for the source of the symbols it surfaces.
Codegraph IS the pre-built search index — so delegating the lookup to a
separate file-reading sub-task/agent, or running your own grep + read
loop, repeats work codegraph already did and costs more for the same
answer. Reach for raw Read/Grep only to confirm a specific detail
codegraph didn't cover. A direct codegraph answer is typically a handful
of calls; a grep/read exploration is dozens.
answer. Don't grep-verify codegraph results — each unnecessary verification costs ~800 tokens. Budget: at most 3 grep calls per task, spend them only on genuinely ambiguous text content (strings, comments, logs) — never on structural queries that codegraph already answered. A direct codegraph answer is typically a handful of calls; a grep/read exploration is dozens.
## Tool selection by intent
Expand Down