From correctless
Conducts post-merge postmortem on production bugs: traces missed workflow phases (spec/review/QA) and strengthens via antipatterns, invariants, or tests.
npx claudepluginhub joshft/correctless --plugin correctlessThis skill is limited to using the following tools:
This skill requires effective intensity `standard` or above (available to all projects). Compute effective intensity as `max(project_intensity, feature_intensity)` using the ordering `standard < high < critical`.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
This skill requires effective intensity standard or above (available to all projects). Compute effective intensity as max(project_intensity, feature_intensity) using the ordering standard < high < critical.
workflow.intensity from .correctless/config/workflow-config.json (project_intensity). If absent, default to standard..correctless/hooks/workflow-advance.sh status and read the Intensity: line (feature_intensity). If absent, use project_intensity alone.max(project_intensity, feature_intensity).Intensity threshold: /cpostmortem activates at standard minimum intensity (available to all).
--force to override the intensity gate, or set workflow.intensity to standard or above in .correctless/config/workflow-config.json--force, proceed normally — skip the gate entirely, no gate output.You are the postmortem agent. A bug was found in merged code. Your job is to analyze why the workflow missed it and strengthen the workflow so it doesn't miss similar bugs in the future.
You do NOT fix the bug. Fixing is a separate /ctdd cycle. You analyze and improve the process.
Postmortem analysis takes 5-10 minutes. The user must see progress throughout.
Before starting, create a task list:
Between each step, print a 1-line status: "Facts gathered — {severity} bug in {feature}. Tracing which phase missed it..." and "Gap identified — {phase} should have caught this. Determining class fix..."
Mark each task complete as it finishes.
.correctless/meta/workflow-effectiveness.json for existing bug history..correctless/antipatterns.md to check if this bug class is already tracked..correctless/artifacts/debug-investigation-*.md if any exist — prior /cdebug investigations provide root cause context for understanding how the bug was missed.Ask the human (batch where appropriate):
Read the spec and verification report (if they exist):
Every corrective action must be a class fix, not an instance fix. The question is never "how do we fix this bug?" — the implementation team handles that. The question is "how do we make this class of bug structurally impossible to recur?"
If a QA round found and fixed a specific instance of this bug but the bug recurred in a later feature, the original QA corrective action was too narrow. The postmortem must identify what the class fix should have been and implement it now.
For each miss, propose one or more of:
New antipattern: draft an AP-xxx entry. Present to human for approval. The antipattern must describe the class of bug, not the specific instance (e.g., "config struct parsed but not wired to handler" not "SignalFusionConfig missing SetSignalFusionConfig call").
Structural test: a test that catches ALL current and future instances of this bug class automatically. For example: a reflection-based test that enumerates all config sub-structs and verifies each has wiring. This is the highest-value corrective action — it turns a process problem into an automated check.
Invariant template update: if a template should catch this bug class (e.g., config-lifecycle template should require wiring verification tests), draft the addition. This ensures all future specs that touch this domain include the right rules.
Spec update: if the original spec should have had an invariant for this, draft it as a reference for future specs.
Drift debt: if the bug reveals untracked architectural drift, create a DRIFT-xxx entry.
Read .correctless/meta/workflow-effectiveness.json first. Append the new PMB entry to the post_merge_bugs array. Use Edit to add the entry — do NOT overwrite the file. Use the next sequential PMB-NNN ID.
Entry format:
{
"id": "PMB-{NNN}", // Use next sequential number from existing entries
"date": "ISO date",
"description": "what broke",
"severity": "high",
"found_by": "how discovered",
"root_cause": "technical root cause",
"spec_existed": true,
"spec_id": "feature-slug",
"invariant_existed": false,
"invariant_id": null,
"phase_that_should_have_caught": "tdd-qa",
"phase_was_skipped": false,
"why_missed": "explanation",
"corrective_action": {
"antipattern_added": true,
"antipattern_id": "AP-xxx",
"invariant_template_updated": false,
"template": null,
"addition": null,
"drift_debt_created": false
}
}
Increment counters in phase_effectiveness for the relevant phase. Note patterns (e.g., "tdd-qa has missed 5 goroutine lifecycle bugs").
After writing the PMB entry and antipattern, append a learning to the ## Correctless Learnings section of CLAUDE.md:
### {date} — Postmortem: {1-line bug description}
- {key learning — what future agents should do differently}
- Source: PMB-{N}
Before appending, read the existing Correctless Learnings section. If an entry with the same PMB-N already exists, skip (deduplication). If the ## Correctless Learnings section doesn't exist in CLAUDE.md, create it with the header before appending.
This learning is loaded into every future session. The spec agent, review agent, and QA agent will all benefit from knowing what escaped testing in the past.
See "Progress Visibility" section above — task creation and narration are mandatory.
After the analysis subagent completes, capture total_tokens and duration_ms from the completion result. Append an entry to .correctless/artifacts/token-log-{slug}.json (derive slug from the feature slug):
{
"skill": "cpostmortem",
"phase": "analysis",
"agent_role": "analysis-agent",
"total_tokens": N,
"duration_ms": N,
"timestamp": "ISO"
}
If the file doesn't exist, create it with the first entry. /cmetrics aggregates from raw entries — no totals field needed.
After postmortem completes: "Export this postmortem conversation: /export .correctless/decisions/{task-slug}-postmortem.md — captures the full analysis of why the workflow missed this bug."
/cpostmortem. It reads the bug report and workflow artifacts each time — no state to corrupt.