root-cause-tracing
Systematically traces bugs backward through the call stack to identify where invalid data or incorrect behavior originates.
Purpose - Find the source of bugs that manifest deep in execution
Output - Trace chain from symptom to original trigger with fix recommendation
/kaizen:root-cause-tracingArguments
None. The command works with the current bug context from your conversation.
How It Works
Observe Symptom: Identify where the error appears (e.g., wrong file created, incorrect output)
Find Immediate Cause: Locate the code that directly causes the error
Trace Upward: Ask "what called this?" and follow the chain
Track Values: Note what values were passed at each level
Find Origin: Continue until you find where invalid data originated
Add Instrumentation: If manual tracing fails, add stack trace logging
Fix at Source: Address the root trigger, not the symptom location
Key Principle
Never fix just where the error appears. Trace back to find the original trigger.
Usage Examples
Example Trace
Best practices
Use console.error in tests - Loggers may be suppressed in test environments
Log before dangerous operations - Capture state before failure, not after
Include full context - Directory, cwd, environment variables, timestamps
Add defense-in-depth - Fix at source AND add validation at each layer
Capture stack traces - Use
new Error().stackfor complete call chains
Last updated