GrepAI Trace Graph
This skill covers using grepai trace graph to build complete call graphs showing all dependencies recursively.
When to Use This Skill
- Mapping complete function dependencies
- Understanding complex code flows
- Impact analysis for major refactoring
- Visualizing application architecture
What is Trace Graph?
grepai trace graph builds a recursive dependency tree:
Basic Usage
Example
Output:
Depth Control
Limit recursion depth with --depth:
Depth Examples
--depth 1 (same as callees):
--depth 2 (default):
--depth 3:
JSON Output
Output:
Compact JSON
Output:
TOON Output (v0.26.0+)
TOON format offers ~50% fewer tokens than JSON:
Note:
--jsonand--toonare mutually exclusive.
Extraction Modes
Use Cases
Understanding Application Flow
Impact Analysis
Code Review
Documentation
Refactoring Planning
Handling Cycles
GrepAI detects and marks circular dependencies:
In JSON:
Large Graphs
For very large codebases, graphs can be overwhelming:
Limit Depth
Focus on Specific Areas
Filter in Post-Processing
Visualizing Graphs
Export to DOT Format (Graphviz)
Then render:
Mermaid Diagram
Comparing Graph Sizes
Track complexity over time:
Common Issues
❌ Problem: Graph too large / timeout ✅ Solutions:
- Reduce depth:
--depth 2 - Trace specific function instead of
main - Use
--mode fast
❌ Problem: Many cycles detected ✅ Solution: This indicates circular dependencies in code. Consider refactoring.
❌ Problem: Missing branches ✅ Solutions:
- Try
--mode precise - Check if files are indexed
- Verify language is enabled
Best Practices
- Start shallow: Begin with
--depth 2, increase as needed - Focus analysis: Trace specific functions, not always
main - Export for docs: Use JSON for generating diagrams
- Track over time: Monitor node count as complexity metric
- Investigate cycles: Circular dependencies are code smells
Output Format
Trace graph result:


