Skip to content

Commit 99bfe6d

Browse files
committed
feat: add FILE LOCATIONS REQUIRED rule to all EXPLORATORY tier prompts
Adds a new critical rule (rule 3) to all EXPLORATORY (Massive tier) prompts requiring that file locations be included for every node/function/class/component mentioned in analysis results. This enables agents to drill down into specific files when needed during code analysis. Updated prompts: - call_chain_prompts.rs (CALL_CHAIN_EXPLORATORY) - architecture_analysis_prompts.rs (ARCHITECTURE_ANALYSIS_EXPLORATORY) - context_builder_prompts.rs (CONTEXT_BUILDER_EXPLORATORY) - semantic_question_prompts.rs (SEMANTIC_QUESTION_EXPLORATORY) - agentic_api_surface_prompts.rs (API_SURFACE_EXPLORATORY) All existing rules have been renumbered to accommodate the new rule #3.
1 parent db56545 commit 99bfe6d

File tree

5 files changed

+71
-33
lines changed

5 files changed

+71
-33
lines changed

crates/codegraph-mcp/src/agentic_api_surface_prompts.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,18 @@ When analysis is complete:
347347
}
348348
349349
CRITICAL RULES:
350-
- Extract ALL node IDs from previous tool results - never invent them
351-
- Report exact metric values and counts without any qualitative language
352-
- Use maximum depth parameters to achieve complete ecosystem mapping
353-
- Cross-reference ALL analyses for comprehensive characterization
354-
- Build complete dependency/impact graphs at multiple depths
355-
- Calculate ecosystem-wide statistics where applicable
356-
- Stay within 20 tool calls maximum (plan strategically)
357-
- Provide final analysis only when you have exhaustive API ecosystem coverage
358-
- Focus on measurable quantities: counts, depths, degrees, coupling metrics, impact radii"#;
350+
1. Extract ALL node IDs from previous tool results - never invent them
351+
3. FILE LOCATIONS REQUIRED:
352+
- For EVERY node/function/class/component mentioned, ALWAYS include its file location from tool results
353+
- Format: `ComponentName in path/to/file.rs:line_number` or `ComponentName (path/to/file.rs:line_number)`
354+
- Example: "ConfigLoader in src/config/loader.rs:42" NOT just "ConfigLoader"
355+
- Tool results contain location data (file_path, start_line) - extract and use it
356+
- This allows agents to drill down into specific files when needed
357+
4. Report exact metric values and counts without any qualitative language
358+
5. Use maximum depth parameters to achieve complete ecosystem mapping
359+
6. Cross-reference ALL analyses for comprehensive characterization
360+
7. Build complete dependency/impact graphs at multiple depths
361+
8. Calculate ecosystem-wide statistics where applicable
362+
9. Stay within 20 tool calls maximum (plan strategically)
363+
10. Provide final analysis only when you have exhaustive API ecosystem coverage
364+
11. Focus on measurable quantities: counts, depths, degrees, coupling metrics, impact radii"#;

crates/codegraph-mcp/src/architecture_analysis_prompts.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,19 @@ When complete - provide exhaustive report with:
165165
- Cross-dimensional patterns and statistical health metrics
166166
- Exhaustive objective synthesis
167167
168-
CONSTRAINTS:
168+
CRITICAL RULES:
169+
1. ZERO HEURISTICS: Every claim must be based on tool output data
170+
2. EXHAUSTIVE NODE ID TRACKING: Extract and reference all node IDs from tool results
171+
3. FILE LOCATIONS REQUIRED:
172+
- For EVERY node/function/class/component mentioned, ALWAYS include its file location from tool results
173+
- Format: `ComponentName in path/to/file.rs:line_number` or `ComponentName (path/to/file.rs:line_number)`
174+
- Example: "ConfigLoader in src/config/loader.rs:42" NOT just "ConfigLoader"
175+
- Tool results contain location data (file_path, start_line) - extract and use it
176+
- This allows agents to drill down into specific files when needed
177+
4. NEVER FABRICATE: Do not invent component names or relationships
178+
5. MULTI-DIMENSIONAL ANALYSIS: Use all available metrics systematically
179+
180+
OPERATIONAL CONSTRAINTS:
169181
- MAX 20 STEPS - exhaustive coverage
170182
- Statistical rigor across all dimensions
171183
- Multi-edge type exhaustive analysis

crates/codegraph-mcp/src/call_chain_prompts.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,19 @@ When exhaustive analysis is complete:
360360
}
361361
362362
CRITICAL REQUIREMENTS:
363-
- ZERO HEURISTICS: Every single claim must cite specific tool output
364-
- EXHAUSTIVE NODE ID TRACKING: Extract and reference all node IDs from results
365-
- NEVER FABRICATE: Do not invent function names, IDs, or relationships
366-
- INCREMENTAL BUILDING: Each step builds on concrete previous results
367-
- QUANTITATIVE RIGOR: Include metrics, counts, statistics from tool data
368-
- COMPLETE CITATIONS: Reference specific tool calls and output fields
369-
- COMPREHENSIVE COVERAGE: Trace ALL significant execution paths, not just main path
363+
1. ZERO HEURISTICS: Every single claim must cite specific tool output
364+
2. EXHAUSTIVE NODE ID TRACKING: Extract and reference all node IDs from results
365+
3. FILE LOCATIONS REQUIRED:
366+
- For EVERY node/function/class/component mentioned, ALWAYS include its file location from tool results
367+
- Format: `ComponentName in path/to/file.rs:line_number` or `ComponentName (path/to/file.rs:line_number)`
368+
- Example: "ConfigLoader in src/config/loader.rs:42" NOT just "ConfigLoader"
369+
- Tool results contain location data (file_path, start_line) - extract and use it
370+
- This allows agents to drill down into specific files when needed
371+
4. NEVER FABRICATE: Do not invent function names, IDs, or relationships
372+
5. INCREMENTAL BUILDING: Each step builds on concrete previous results
373+
6. QUANTITATIVE RIGOR: Include metrics, counts, statistics from tool data
374+
7. COMPLETE CITATIONS: Reference specific tool calls and output fields
375+
8. COMPREHENSIVE COVERAGE: Trace ALL significant execution paths, not just main path
370376
371377
EXECUTION FLOW ANALYSIS FOCUS (Comprehensive):
372378
✓ Complete call chain topology from all entry points

crates/codegraph-mcp/src/context_builder_prompts.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,19 @@ CONTEXT BUILDING STRATEGY (Exploratory):
193193
- Iterative refinement: explore → analyze → explore deeper based on findings
194194
195195
CRITICAL CONSTRAINTS:
196-
- ZERO HEURISTICS: Use only structured data from graph tools
197-
- Make 15-20+ tool calls for exhaustive coverage
198-
- Multi-pass strategy: broad discovery → deep exploration → synthesis
199-
- Explore ALL edge types systematically
200-
- Build complete architectural map
201-
- Connect findings across different analysis dimensions
196+
1. ZERO HEURISTICS: Use only structured data from graph tools
197+
2. EXHAUSTIVE NODE ID TRACKING: Extract and reference all node IDs from tool results
198+
3. FILE LOCATIONS REQUIRED:
199+
- For EVERY node/function/class/component mentioned, ALWAYS include its file location from tool results
200+
- Format: `ComponentName in path/to/file.rs:line_number` or `ComponentName (path/to/file.rs:line_number)`
201+
- Example: "ConfigLoader in src/config/loader.rs:42" NOT just "ConfigLoader"
202+
- Tool results contain location data (file_path, start_line) - extract and use it
203+
- This allows agents to drill down into specific files when needed
204+
4. Make 15-20+ tool calls for exhaustive coverage
205+
5. Multi-pass strategy: broad discovery → deep exploration → synthesis
206+
6. Explore ALL edge types systematically
207+
7. Build complete architectural map
208+
8. Connect findings across different analysis dimensions
202209
203210
RESPONSE FORMAT (REQUIRED JSON):
204211
{

crates/codegraph-mcp/src/semantic_question_prompts.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,25 @@ CRITICAL RULE - ZERO HEURISTICS:
324324
You MUST answer questions using EXCLUSIVELY the graph tools and their empirical results.
325325
326326
FORBIDDEN REASONING:
327-
- General programming knowledge or idioms
328-
- Naming conventions, prefixes, or suffixes
329-
- Common patterns or best practices not evidenced in graph
330-
- Domain assumptions or typical behaviors
331-
- Any claim not directly supported by graph relationships
327+
1. General programming knowledge or idioms
328+
2. Naming conventions, prefixes, or suffixes
329+
3. Common patterns or best practices not evidenced in graph
330+
4. Domain assumptions or typical behaviors
331+
5. Any claim not directly supported by graph relationships
332332
333333
REQUIRED REASONING:
334-
- Concrete node IDs and edge relationships discovered through tools
335-
- Quantitative metrics from graph analysis
336-
- Statistical patterns across multiple tool calls
337-
- Structural properties of the dependency/call graph
338-
- Empirical evidence from comprehensive tool exploration
334+
1. Concrete node IDs and edge relationships discovered through tools
335+
2. EXHAUSTIVE NODE ID TRACKING: Extract and reference all node IDs from tool results
336+
3. FILE LOCATIONS REQUIRED:
337+
- For EVERY node/function/class/component mentioned, ALWAYS include its file location from tool results
338+
- Format: `ComponentName in path/to/file.rs:line_number` or `ComponentName (path/to/file.rs:line_number)`
339+
- Example: "ConfigLoader in src/config/loader.rs:42" NOT just "ConfigLoader"
340+
- Tool results contain location data (file_path, start_line) - extract and use it
341+
- This allows agents to drill down into specific files when needed
342+
4. Quantitative metrics from graph analysis
343+
5. Statistical patterns across multiple tool calls
344+
6. Structural properties of the dependency/call graph
345+
7. Empirical evidence from comprehensive tool exploration
339346
340347
If graph structure is insufficient to answer definitively, provide:
341348
1. What IS known from graph evidence

0 commit comments

Comments
 (0)