Correctless

/cpostmortem — Post-Merge Bug Analysis

Analyze why a bug escaped the workflow and strengthen the process so the entire class of bug cannot recur.

When to Use

How It Fits in the Workflow

Runs outside the normal pipeline, triggered by a production bug or post-merge discovery. Does not touch code. Analyzes the gap in the process (spec, review, TDD, QA, audit) and produces class-level corrective actions that prevent the entire category of bug from recurring. Feeds learnings back into CLAUDE.md so every future agent session benefits.

Requires high intensity or above.

What It Does

Example

Users report that logging in from two devices simultaneously causes one session to silently lose write permissions. The bug is in merged code.

You run /cpostmortem.

The agent reads the spec for the auth feature and finds INV-009: “each user may have at most 3 active sessions.” The invariant exists but says nothing about what happens to an existing session’s permissions when a new session is created. The test suite verifies session count limits but never tests concurrent session creation.

Trace: The spec phase (/cspec) missed the concurrent-session edge case. The review phase (/creview-spec) had an Assumptions Auditor that flagged “assumes sequential session creation” but the finding was marked low-severity and deferred.

Corrective actions:

  1. New antipattern (AP-014): “Session lifecycle specs must define behavior under concurrent creation, not just count limits.”
  2. Structural test: A test that enumerates all session state transitions and verifies each is tested under both sequential and concurrent conditions.
  3. Invariant template update: The auth-lifecycle template now requires a concurrency invariant for any state-bounded resource.

The PMB entry is written, phase effectiveness counters are updated (review-spec gets a “should have caught” increment), and a learning is appended to CLAUDE.md.

What It Reads / Writes

Reads Writes
.correctless/meta/workflow-effectiveness.json .correctless/meta/workflow-effectiveness.json (PMB entry)
.correctless/antipatterns.md .correctless/antipatterns.md (new AP-xxx entry)
Spec artifact (.correctless/specs/{slug}.md) .correctless/templates/invariants/ (template updates)
Verification report (docs/verification/) CLAUDE.md (Correctless Learnings section)
Debug investigations (.correctless/artifacts/debug-investigation-*.md) Token log (.correctless/artifacts/token-log-{slug}.json)

Corrective Action Types

Action What It Does When to Use
New antipattern (AP-xxx) Adds a class-level bug pattern to .correctless/antipatterns.md The bug class is not yet tracked
Structural test Automated test that catches all current and future instances Highest-value action — turns a process gap into a CI check
Invariant template update Adds a rule to spec templates so future specs include it The spec domain template should have required this invariant
Drift debt (DRIFT-xxx) Tracks unresolved architectural drift The bug reveals a gap between docs and reality

Intensity Levels

This skill requires high intensity or above. At standard intensity, post-merge bug analysis is done manually. The structured tracing across workflow phases and automatic learning propagation require the extended agent pipeline.

Common Issues