Post-mortem a failed GSD auto-mode run. Traces from symptom to root cause using `.gsd/activity/*.jsonl`, `.gsd/journal/YYYY-MM-DD.jsonl`, `.gsd/metrics.json`, and `.gsd/auto.lock`. Produces a filing-ready bug report with file:line references and a concrete fix suggestion. Use when asked to "forensics", "post-mortem", "why did auto-mode fail", "trace the stuck loop", "debug the crash", after `/gsd forensics` is invoked, or when a session ended in an unexpected terminal state. Reads existing artifacts — does NOT re-run anything.
72
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
activity/{seq}-{unitType}-{unitId}.jsonl — full tool-call and message stream per unitjournal/YYYY-MM-DD.jsonl — iteration-level events. Orchestrator path emits orchestrator-* events (orchestrator-dispatch-match, orchestrator-guard-block, orchestrator-terminal, etc.); legacy loop events (dispatch-match, stuck-detected, guard-block, unit-start/end, terminal) can still appear on non-orchestrator paths.metrics.json — token/cost ledger; duplicate type/id entries indicate a stuck loopauto.lock — JSON snapshot of the currently-owning PID; stale lock = crash mid-unitforensics/ — saved prior reportsdebug/ — debug logs if enabledruntime/paused-session.json — serialized session when auto-mode pauseddoctor-history.jsonl — doctor check historyThe /gsd forensics command pre-computes a forensic report with anomalies flagged. This skill is the manual investigation that goes deeper, or runs when the automated report isn't enough.
Invocation points:
/gsd forensics has been run and user wants deeper analysisauto.lock is stale<core_principle>
READ-ONLY. Forensics touches no live state. Non-mutating inspection commands (e.g., ps, top -b, cat /proc/*) are allowed for checking process status or reading system files. Strictly prohibited: gsd_* writes, commands that modify state, executing binaries that produce side effects, writing to files (outside the final report), or re-running the failed unit. The evidence must stay pristine for future investigations.
SYMPTOM → ROOT CAUSE, WITH CITATIONS. Every claim in the report is backed by an artifact path and either a line number or a JSONL field. "The loop got stuck because of a race" is not useful; ".gsd/journal/2026-04-19.jsonl:142 shows stuck-detected with flowId X, caused by dispatch-guard.ts:87 returning the same unit after unit-end" is.
PRE-PARSED LEADS, NOT CONCLUSIONS. If /gsd forensics has surfaced anomalies, treat them as hypotheses to verify, not answers.
</core_principle>
Read what's in .gsd/:
auto.lock — is it stale? Check PID against ps (read-only inspection, allowed). Stale = crash..gsd/activity/*.jsonl — sort by mtime, newest first. That's the last unit that ran..gsd/journal/YYYY-MM-DD.jsonl — the iteration-level view..gsd/metrics.json — does any type/id appear more than once? (stuck loop signal).gsd/runtime/paused-session.json — if present, what was the pause reason?Activity JSONL format:
{type: "message", message: {...}}.message.role: "assistant" → content[] with type: "text" reasoning and type: "toolCall" invocations.message.role: "toolResult" → {toolCallId, toolName, isError, content}.usage on assistant messages tracks tokens and cost.To trace a failure:
isError: true tool results in the last activity log. That's usually the proximate symptom.text content — that's the agent's reasoning at the moment of failure.For each symptom from the activity log, find the matching journal events:
stuck-detected + same flowId → the loop detected repetition. data.reason says why.guard-block → a dispatch guard refused to run a unit. Check data.reason and trace to dispatch-guard.ts logic.unit-end followed by another unit-start for the same unitId → re-dispatch. If tied to stuck-detected, the artifact verification failed after the unit succeeded.terminal → auto-mode decided to stop. data.reason tells you why.Use flowId to reconstruct one iteration; use causedBy to follow causal chains across iterations.
A good root cause is:
Bad root cause: "Auto-mode got stuck in a loop." Good root cause: "After slice completion, auto-unit-closeout.ts emits unit-end before auto-post-unit.ts updates the roadmap checkbox. The next iteration-start finds the same unit [ ] and re-dispatches — dispatch-guard.ts:42 has no check against the freshly-ended unitId."
Consult the source map in src/resources/extensions/gsd/prompts/forensics.md to map symptoms to the likely domain files.
For the root cause:
git log -- path/to/file.ts mentally; do NOT run git commands that could modify state.)Format the output as a GitHub-issue-ready report:
## Symptom
<what the user saw — quote the error or describe the observed behavior>
## Evidence Trail
1. `.gsd/auto.lock` — <state: stale / fresh>
2. `.gsd/activity/042-slice-S02.jsonl:128` — <isError: true from `gsd_task_complete`>
3. `.gsd/journal/2026-04-19.jsonl:87` — <stuck-detected flowId 7a3c…>
4. `.gsd/metrics.json` — <unit type/id "slice/S02" appears 3 times>
## Root Cause
<specific named cause — file, function, state transition>
`src/resources/extensions/gsd/auto-unit-closeout.ts:<line>`: <exactly what goes wrong>
## Proposed Fix
<minimal change — file, function, what to change>
## Test
<what test would have caught this; whether one should be added>
## Confidence
<high / medium / low> — <what would change this confidence>Offer to file this as a GitHub issue via mcp__github__issue_write — explicit confirmation required per the outward-action rule. Also save a copy to .gsd/forensics/<slug>.md for future reference.
<anti_patterns>
gsd_* write tool during forensics. Evidence stays pristine.</anti_patterns>
<success_criteria>
.gsd/forensics/ even if not filed as an issue.</success_criteria>
33c00aa
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.