gsd-debug

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<objective> Debug issues using scientific method with subagent isolation.
Orchestrator role: Gather symptoms, spawn gsd-debugger agent, handle checkpoints, spawn continuations.
Why subagent: Investigation burns context fast (reading files, forming hypotheses, testing). Fresh 200k context per investigation. Main context stays lean for user interaction. </objective>
<context> User's issue: $ARGUMENTS
Check for active sessions:
bash
ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5
</context> <process>
<objective> 使用科学方法结合子代理隔离来调试问题。
协调器角色: 收集症状,生成gsd-debugger agent,处理检查点,生成续接任务。
为什么使用子代理: 调查过程会快速消耗上下文(读取文件、形成假设、测试)。每次调查都有全新的20万字符上下文。主上下文保持精简,用于用户交互。 </objective>
<context> 用户问题:$ARGUMENTS
检查活跃会话:
bash
ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5
</context> <process>

0. Initialize Context

0. 初始化上下文

bash
INIT=$(node {{PLATFORM_ROOT}}/get-shit-done/bin/gsd-tools.cjs state load)
Extract
commit_docs
from init JSON. Resolve debugger model:
bash
DEBUGGER_MODEL=$(node {{PLATFORM_ROOT}}/get-shit-done/bin/gsd-tools.cjs resolve-model gsd-debugger --raw)
bash
INIT=$(node {{PLATFORM_ROOT}}/get-shit-done/bin/gsd-tools.cjs state load)
从初始化JSON中提取
commit_docs
。解析调试器模型:
bash
DEBUGGER_MODEL=$(node {{PLATFORM_ROOT}}/get-shit-done/bin/gsd-tools.cjs resolve-model gsd-debugger --raw)

1. Check Active Sessions

1. 检查活跃会话

If active sessions exist AND no $ARGUMENTS:
  • List sessions with status, hypothesis, next action
  • User picks number to resume OR describes new issue
If $ARGUMENTS provided OR user describes new issue:
  • Continue to symptom gathering
如果存在活跃会话且未提供$ARGUMENTS:
  • 列出会话的状态、假设和下一步操作
  • 用户选择编号恢复会话,或描述新问题
如果提供了$ARGUMENTS,或用户描述了新问题:
  • 继续收集症状

2. Gather Symptoms (if new issue)

2. 收集症状(如果是新问题)

Use AskUserQuestion for each:
  1. Expected behavior - What should happen?
  2. Actual behavior - What happens instead?
  3. Error messages - Any errors? (paste or describe)
  4. Timeline - When did this start? Ever worked?
  5. Reproduction - How do you trigger it?
After all gathered, confirm ready to investigate.
针对以下每一项使用AskUserQuestion:
  1. 预期行为 - 应该发生什么?
  2. 实际行为 - 实际发生了什么?
  3. 错误信息 - 是否有错误?(粘贴或描述)
  4. 时间线 - 问题何时开始?之前正常工作过吗?
  5. 复现步骤 - 如何触发该问题?
收集完成后,确认是否准备好开始调查。

3. Spawn gsd-debugger Agent

3. 生成gsd-debugger Agent

Fill prompt and spawn:
markdown
<objective>
Investigate issue: {slug}

**Summary:** {trigger}
</objective>

<symptoms>
expected: {expected}
actual: {actual}
errors: {errors}
reproduction: {reproduction}
timeline: {timeline}
</symptoms>

<mode>
symptoms_prefilled: true
goal: find_and_fix
</mode>

<debug_file>
Create: .planning/debug/{slug}.md
</debug_file>
Task(
  prompt=filled_prompt,
  subagent_type="gsd-debugger",
  model="{debugger_model}",
  description="Debug {slug}"
)
填充提示并生成:
markdown
<objective>
调查问题:{slug}

**摘要:** {trigger}
</objective>

<symptoms>
expected: {expected}
actual: {actual}
errors: {errors}
reproduction: {reproduction}
timeline: {timeline}
</symptoms>

<mode>
symptoms_prefilled: true
goal: find_and_fix
</mode>

<debug_file>
Create: .planning/debug/{slug}.md
</debug_file>
Task(
  prompt=filled_prompt,
  subagent_type="gsd-debugger",
  model="{debugger_model}",
  description="Debug {slug}"
)

4. Handle Agent Return

4. 处理Agent返回结果

If
## ROOT CAUSE FOUND
:
  • Display root cause and evidence summary
  • Offer options:
    • "Fix now" - spawn fix subagent
    • "Plan fix" - suggest {{COMMAND_PREFIX}}plan-phase --gaps
    • "Manual fix" - done
If
## CHECKPOINT REACHED
:
  • Present checkpoint details to user
  • Get user response
  • If checkpoint type is
    human-verify
    :
    • If user confirms fixed: continue so agent can finalize/resolve/archive
    • If user reports issues: continue so agent returns to investigation/fixing
  • Spawn continuation agent (see step 5)
If
## INVESTIGATION INCONCLUSIVE
:
  • Show what was checked and eliminated
  • Offer options:
    • "Continue investigating" - spawn new agent with additional context
    • "Manual investigation" - done
    • "Add more context" - gather more symptoms, spawn again
如果返回
## ROOT CAUSE FOUND
  • 显示根本原因和证据摘要
  • 提供选项:
    • "立即修复" - 生成修复子代理
    • "规划修复" - 建议使用{{COMMAND_PREFIX}}plan-phase --gaps
    • "手动修复" - 结束流程
如果返回
## CHECKPOINT REACHED
  • 向用户展示检查点详情
  • 获取用户响应
  • 如果检查点类型为
    human-verify
    • 如果用户确认问题已修复:继续流程,让Agent完成最终处理/标记已解决/归档
    • 如果用户反馈仍有问题:继续流程,让Agent返回调查/修复阶段
  • 生成续接Agent(见步骤5)
如果返回
## INVESTIGATION INCONCLUSIVE
  • 展示已检查和排除的内容
  • 提供选项:
    • "继续调查" - 使用额外上下文生成新Agent
    • "手动调查" - 结束流程
    • "添加更多上下文" - 收集更多症状,重新生成Agent

5. Spawn Continuation Agent (After Checkpoint)

5. 生成续接Agent(检查点之后)

When user responds to checkpoint, spawn fresh agent:
markdown
<objective>
Continue debugging {slug}. Evidence is in the debug file.
</objective>

<prior_state>
<files_to_read>
- .planning/debug/{slug}.md (Debug session state)
</files_to_read>
</prior_state>

<checkpoint_response>
**Type:** {checkpoint_type}
**Response:** {user_response}
</checkpoint_response>

<mode>
goal: find_and_fix
</mode>
Task(
  prompt=continuation_prompt,
  subagent_type="gsd-debugger",
  model="{debugger_model}",
  description="Continue debug {slug}"
)
</process>
<success_criteria>
  • Active sessions checked
  • Symptoms gathered (if new)
  • gsd-debugger spawned with context
  • Checkpoints handled correctly
  • Root cause confirmed before fixing </success_criteria>
当用户响应检查点后,生成全新Agent:
markdown
<objective>
继续调试{slug}。证据位于调试文件中。
</objective>

<prior_state>
<files_to_read>
- .planning/debug/{slug}.md (Debug session state)
</files_to_read>
</prior_state>

<checkpoint_response>
**Type:** {checkpoint_type}
**Response:** {user_response}
</checkpoint_response>

<mode>
goal: find_and_fix
</mode>
Task(
  prompt=continuation_prompt,
  subagent_type="gsd-debugger",
  model="{debugger_model}",
  description="Continue debug {slug}"
)
</process>
<success_criteria>
  • 已检查活跃会话
  • 已收集症状(如果是新问题)
  • 已为gsd-debugger提供上下文并生成Agent
  • 已正确处理检查点
  • 修复前已确认根本原因 </success_criteria>