计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
root-cause-tracing【效率与协作】Systematically trace bugs backward through call stack to find original trigger
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: root-cause-tracing description: Systematically trace bugs backward through call stack to find original trigger user-invocable: false disable-model-invocation: true when_to_use: when errors occur deep in execution and you need to trace back to find the original trigger version: 2.0.0 languages: all progressive_disclosure: entry_point: summary: "Trace bugs backward through call chains to find original triggers instead of fixing symptoms" when_to_use: "When errors manifest deep in execution, unclear data origins, or long call chains. Use AFTER systematic-debugging Phase 1." quick_start: "1. Observe symptom 2. Find immediate cause 3. Ask what called this 4. Keep tracing up 5. Fix at source + add defense" references: - tracing-techniques.md - examples.md - advanced-techniques.md - integration.md context_limit: 800 tags:
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
Core principle: Trace backward through the call chain until you find the original trigger, then fix at the source.
This skill is a specialized technique within the systematic-debugging workflow, typically applied during Phase 1 (Root Cause Investigation) when dealing with deep call stacks.
Use root-cause-tracing when:
Relationship with systematic-debugging:
NEVER FIX JUST WHERE THE ERROR APPEARS
ALWAYS TRACE BACK TO FIND THE ORIGINAL TRIGGER
Fixing symptoms creates bandaid solutions that mask root problems.
Error appears deep in stack?
→ Yes: Start tracing backward
→ Can identify caller? → Trace one level up → Repeat
→ Cannot identify caller? → Add instrumentation (see advanced-techniques.md)
→ No: May not need tracing (error at entry point)
Example: Git init in wrong directory
Error symptom → execFileAsync('git', ['init'], { cwd: '' })
← WorktreeManager.createSessionWorktree(projectDir='')
← Session.create() → Project.create() → Test code
← ROOT CAUSE: setupCoreTest() returns { tempDir: '' } before beforeEach
At each level ask: Where did this value come from? Is this the origin?
For detailed tracing methodology, see Tracing Techniques For complete real-world examples, see Examples
Fix at source (throw if accessed before initialization) + Add defense-in-depth (validate at Project.create, WorkspaceManager, environment guards, instrumentation).
This prevents similar bugs and catches issues earlier.
For detailed information:
console.error() for debugging in tests (logger may be suppressed)STOP when thinking:
ALL of these mean: Continue tracing to find root cause.
See Integration for complete workflow examples.
From debugging session (2025-10-03):
Bottom line: Tracing takes 15-30 minutes. Symptom fixes take hours of whack-a-mole.