Files
get-shit-done/commands/gsd/forensics.md
Tom Boucher 81f9534b5a feat(adr-0002): command contract validation module + prose @-ref cleanup + workflow extraction
ADR-0002: commands/gsd/*.md contract now enforced at two layers:

LINT (scripts/lint-command-contract.cjs — new CI step):
- name: present, starts with gsd: or gsd-
- description: non-empty
- allowed-tools: non-empty, all entries canonical
- execution_context @-refs: resolve on disk, no trailing prose on same line
- handles both @~/ and $HOME/ path prefixes

TEST (tests/command-contract.test.cjs — 361 assertions):
- Behavioral contract for all 65 command files
- Replaces scattered coverage in enh-2790 + bug-3135
- Per-command per-rule test — one failure names the exact file + rule

CI (.github/workflows/test.yml):
- 'Lint — command contract (ADR-0002)' step added to lint-tests job

PROSE @-REF CLEANUP (39 command files, ~900 tokens/invocation recovered):
- Removed redundant @~/.claude/get-shit-done/... paths from <process> prose
- execution_context block is now the single authoritative load declaration
- Routing commands (sketch, spike, update, pause-work, etc.) keep routing
  instructions; only the inert path token is stripped

WORKFLOW EXTRACTION (debug.md + thread.md, ~15,000 chars / ~3,750 tokens):
- get-shit-done/workflows/debug.md: full process extracted from commands/gsd/debug.md
- get-shit-done/workflows/thread.md: full process extracted from commands/gsd/thread.md
- Command files reduced to frontmatter + objective + execution_context + context
- debug.md: 9,603 → 1,703 chars; thread.md: 7,868 → 585 chars

RENAME:
- get-shit-done/workflows/extract_learnings.md → extract-learnings.md
  (aligns with hyphen convention of all other workflow files)

DOCS:
- docs/INVENTORY.md: count 85→87, new rows, rename row, fix add-todo --backlog attribution
- docs/INVENTORY-MANIFEST.json: +debug.md +thread.md +extract-learnings.md -extract_learnings.md

Closes ADR-0002 implementation.
2026-05-05 15:18:13 -04:00

2.2 KiB

type, name, description, argument-hint, allowed-tools
type name description argument-hint allowed-tools
prompt gsd:forensics Post-mortem investigation for failed GSD workflows — diagnoses what went wrong. [problem description]
Read
Write
Bash
Grep
Glob
Investigate what went wrong during a GSD workflow execution. Analyzes git history, `.planning/` artifacts, and file system state to detect anomalies and generate a structured diagnostic report.

Purpose: Diagnose failed or stuck workflows so the user can understand root cause and take corrective action. Output: Forensic report saved to .planning/forensics/, presented inline, with optional issue creation.

<execution_context> @~/.claude/get-shit-done/workflows/forensics.md </execution_context>

**Data sources:** - `git log` (recent commits, patterns, time gaps) - `git status` / `git diff` (uncommitted work, conflicts) - `.planning/STATE.md` (current position, session history) - `.planning/ROADMAP.md` (phase scope and progress) - `.planning/phases/*/` (PLAN.md, SUMMARY.md, VERIFICATION.md, CONTEXT.md) - `.planning/reports/SESSION_REPORT.md` (last session outcomes)

User input:

  • Problem description: $ARGUMENTS (optional — will ask if not provided)
Execute end-to-end.

<success_criteria>

  • Evidence gathered from all available data sources
  • At least 4 anomaly types checked (stuck loop, missing artifacts, abandoned work, crash/interruption)
  • Structured forensic report written to .planning/forensics/report-{timestamp}.md
  • Report presented inline with findings, anomalies, and recommendations
  • Interactive investigation offered for deeper analysis
  • GitHub issue creation offered if actionable findings exist </success_criteria>

<critical_rules>

  • Read-only investigation: Do not modify project source files during forensics. Only write the forensic report and update STATE.md session tracking.
  • Redact sensitive data: Strip absolute paths, API keys, tokens from reports and issues.
  • Ground findings in evidence: Every anomaly must cite specific commits, files, or state data.
  • No speculation without evidence: If data is insufficient, say so — do not fabricate root causes. </critical_rules>