|
|
@@ -16,21 +16,25 @@ CodeGraph builds a semantic knowledge graph of codebases for faster, smarter cod
|
|
|
|
|
|
### If \`.codegraph/\` exists in the project
|
|
|
|
|
|
-**Use codegraph tools directly in the main session.** Codegraph replaces the need for Explore agents in most cases. Instead of spawning an agent (which takes 30+ tool calls and 1+ minutes), use codegraph MCP tools directly for fast, structured answers:
|
|
|
+**NEVER call \`codegraph_explore\` or \`codegraph_context\` directly in the main session.** These tools return large amounts of source code that fills up main session context. Instead, ALWAYS spawn an Explore agent for any exploration question (e.g., "how does X work?", "explain the Y system", "where is Z implemented?").
|
|
|
|
|
|
-| Tool | Use For |
|
|
|
-|------|---------|
|
|
|
-| \`codegraph_explore\` | **Deep exploration** — comprehensive context for a topic in ONE call (replaces Explore agents) |
|
|
|
-| \`codegraph_context\` | Quick context for a task (lighter than explore) |
|
|
|
-| \`codegraph_search\` | Find symbols by name (functions, classes, types) |
|
|
|
-| \`codegraph_callers\` | Find what calls a function |
|
|
|
-| \`codegraph_callees\` | Find what a function calls |
|
|
|
-| \`codegraph_impact\` | See what's affected by changing a symbol |
|
|
|
-| \`codegraph_node\` | Get details + source code for a symbol |
|
|
|
+**When spawning Explore agents**, include this instruction in the prompt:
|
|
|
+
|
|
|
+> This project has CodeGraph initialized (.codegraph/ exists). Use \`codegraph_explore\` as your PRIMARY tool — it returns full source code sections from all relevant files in one call.
|
|
|
+>
|
|
|
+> **Rules:**
|
|
|
+> 1. Make at most 3 \`codegraph_explore\` calls — one broad query, then up to 2 focused follow-ups.
|
|
|
+> 2. Do NOT re-read files that codegraph_explore already returned source code for. The source sections are complete and authoritative.
|
|
|
+> 3. Only fall back to grep/glob/read for files listed under "Additional relevant files" if you need more detail, or if codegraph returned no results.
|
|
|
|
|
|
-**For deep exploration questions** (e.g., "how does the undo/redo system work?"), use \`codegraph_explore\` directly. It returns full source code sections from all relevant files in a single call — no need to spawn an Explore agent.
|
|
|
+**The main session may only use these lightweight tools directly** (for targeted lookups before making edits, not for exploration):
|
|
|
|
|
|
-**Do NOT tell Explore agents to use codegraph tools.** Testing shows Explore agents use codegraph for discovery then still read all the same files — making them slower, not faster. Codegraph's value is in the main session where it replaces the need for exhaustive file reading.
|
|
|
+| Tool | Use For |
|
|
|
+|------|---------|
|
|
|
+| \`codegraph_search\` | Find symbols by name |
|
|
|
+| \`codegraph_callers\` / \`codegraph_callees\` | Trace call flow |
|
|
|
+| \`codegraph_impact\` | Check what's affected before editing |
|
|
|
+| \`codegraph_node\` | Get a single symbol's details |
|
|
|
|
|
|
### If \`.codegraph/\` does NOT exist
|
|
|
|