Tracer - Multi-Step Code Flow and Dependency Tracing
Workflow tool for systematic call-flow mapping and dependency analysis with optional expert validation
The tracer tool performs structured, multi-step static code analysis. It traces execution flows and maps structural dependencies across a codebase, building findings incrementally across steps. Unlike single-shot analysis, tracer maintains state between steps through continuation, letting you follow complex call chains and dependency graphs methodically.
Example Prompts
"Use bab tracer to trace how the authenticate() method flows through the middleware stack"
"Trace the dependency tree of the PaymentProcessor module — I need to understand what breaks if we refactor it"
"Use bab tracer in precision mode to follow the request lifecycle from route handler to database call"
"Map all dependencies of the PluginLoader class so we can plan the extraction"
How It Works
- You provide a
target_descriptionexplaining WHAT to trace and WHY - The tool selects or you specify a
trace_mode(precision or dependencies) - Analysis proceeds in numbered steps (
step_number/total_steps) - Each step records
findings(call flows, dependencies discovered) next_step_requiredcontrols whether the workflow continues- Optionally, an expert model validates findings via
use_assistant_model
The tool tracks which files have been checked and which are relevant, building a complete picture across multiple steps rather than trying to analyze everything at once.
Key Features
- Two analysis modes:
precisionfor execution flow tracing,dependenciesfor structural relationship mapping - Smart mode selection:
askmode (default) lets the tool decide which mode fits your query - Multi-step workflow: Builds findings incrementally with step tracking
- Confidence tracking: Reports confidence level from
exploringthroughcertain - File tracking: Maintains lists of checked and relevant files across steps
- Optional expert validation: Route findings through an assistant model for a second opinion
- Image support: Analyze architecture diagrams, sequence diagrams, and visual references
- Continuation support: Resume interrupted traces via
continuation_id
Tool Parameters
target_description(string, required) - What to trace and WHY — the more context, the better the analysisstep(string, required) - Description of the current analysis stepstep_number(number, required) - Current step number in the workflowtotal_steps(number, required) - Expected total steps (can be revised as analysis unfolds)next_step_required(boolean, required) - Whether another step follows this onefindings(string, required) - Call flows, dependencies, and observations found in this step-
trace_mode(enum, optional) -askprecisiondependencies(default:ask) -
confidence(enum, optional) -exploringlowmediumhighvery_highalmost_certaincertain files_checked(string[], optional) - Files examined so farrelevant_files(string[], optional) - Files that contain relevant coderelevant_context(string[], optional) - Additional context snippetscontinuation_id(string, optional) - Resume a previous trace sessionmodel(string, optional) - Override the default modeltemperature(number, optional) - Control response randomnessthinking_mode(string, optional) - Enable extended thinkingimages(string[], optional) - Absolute paths to architecture diagrams or visual referencesuse_assistant_model(boolean, optional, default: false) - Route findings through an expert model for validation
Usage Examples
Precision Mode — Method Execution Tracing:
"Use bab tracer in precision mode to trace how UserAuthManager.authenticate is called, what it calls, and where exceptions are caught"
Traces the method’s call chain, branching logic, side effects, and return value handling.
Dependencies Mode — Structural Mapping:
"Use bab tracer in dependencies mode to map what PaymentProcessor depends on and what depends on it"
Maps bidirectional dependencies, inheritance, composition, and coupling strength.
Ask Mode — Let the Tool Decide:
"Use bab tracer to analyze the relationship between OrderService and InventoryManager"
The tool examines the query and picks the appropriate mode automatically.
With Expert Validation:
"Use bab tracer with expert validation to trace the database connection pooling lifecycle"
Performs the trace, then routes findings through an assistant model for a second opinion.
Best Practices
- Explain WHY in
target_description: “Trace X because we plan to refactor Y” gives better results than just “Trace X” - Start with
askmode when unsure — the tool picks the right approach - Use
precisionfor methods/functions — execution flow, call chains, side effects - Use
dependenciesfor classes/modules — structural relationships, coupling, impact analysis - Keep steps focused: Each step should examine one aspect rather than trying to cover everything
- Track confidence honestly: Start at
exploringand increase as evidence accumulates - Enable expert validation for critical architectural decisions where a second opinion matters
When to Use vs Other Tools
- Use
tracerfor: Systematic call-flow tracing, dependency mapping, understanding how code connects across files - Use
analyzefor: General-purpose code analysis without multi-step workflow - Use
debugfor: Investigating specific runtime errors, stack traces, and failures - Use
docgenfor: Generating documentation from code rather than tracing its behavior - Use
thinkdeepfor: Deep reasoning about design decisions rather than code structure