post-mortem
The post-mortem skill wraps up completed work by validating execution, extracting learnings, and promoting high-value insights into memory and constraints through a six-phase process. Use it when a task, PR arc, or session finishes, or after every five or more PRs to synthesize evidence, deduplicate learnings, retire stale knowledge, and surface next work for the development flywheel.
git clone --depth 1 https://github.com/boshu2/agentops /tmp/post-mortem && cp -r /tmp/post-mortem/images/gemini/skills/post-mortem ~/.claude/skills/post-mortemSKILL.md
# Post-Mortem Skill > **Purpose:** Wrap up completed work — validate it shipped correctly, extract learnings, process the knowledge backlog, activate high-value insights, and retire stale knowledge. > > **Runtime note:** Hook-driven closeout is runtime-dependent. Claude/OpenCode can wire Phase 2-5 maintenance through lifecycle hooks. Codex CLI v0.115.0+ supports native hooks (same behavior). For older Codex versions without hook surfaces, finish closeout with `ao codex stop`. ## Loop position Move **7 (capture evidence + learning, then ratchet)** of the [operating loop](../../docs/architecture/operating-loop.md). Two outputs per loop turn: evidence (test names, snapshot keys, council verdicts, citation events) recorded against the bead and `.agents/ratchet/`; learnings promoted only under the [ratchet rules](../../docs/architecture/operating-loop.md#the-promotion-ratchet) — noticed once stays in the handoff, repeats twice goes to `.agents/learnings/`, changes future behavior updates a SKILL.md or template, must-never-regress becomes a gate, core doctrine promotes into PRODUCT.md/GOALS.md/docs/cdlc.md. Most observations die at handoff. That is correct. Six phases: 1. **Council** — Did we implement it correctly? 2. **Extract** — What did we learn? 3. **Process Backlog** — Score, deduplicate, and flag stale learnings 4. **Activate** — Promote high-value learnings to MEMORY.md and constraints 5. **Retire** — Archive stale and superseded learnings 6. **Harvest** — Surface next work for the flywheel --- ## Quick Start ```bash /post-mortem # wraps up recent work /post-mortem epic-123 # wraps up specific epic /post-mortem --quick "insight" # quick-capture single learning (no council) /post-mortem --scope=pr <num> # learn from a merged/rejected PR outcome (absorbed /pr-retro) /post-mortem --process-only # skip council+extraction, run Phase 3-5 on backlog /post-mortem --skip-activate # extract + process but don't write MEMORY.md /post-mortem --deep recent # thorough council review /post-mortem --mixed epic-123 # cross-vendor (Claude + Codex) /post-mortem --skip-checkpoint-policy epic-123 # skip ratchet chain validation ``` ### Codex Closeout Codex CLI v0.115.0+ has native hooks and handles closeout automatically (no extra steps needed). For older Codex versions (hookless fallback), run these after the post-mortem workflow writes learnings and next work: ```bash ao codex stop ao codex status ``` `ao codex stop` uses the latest transcript or history fallback to queue/persist learnings and run close-loop maintenance without runtime hooks. --- ## Flags | Flag | Default | Description | |------|---------|-------------| | `--quick "text"` | off | Quick-capture a single learning directly to `.agents/learnings/` without running a full post-mortem. Formerly handled by `/retro --quick`. | | `--scope=pr [num]` | off | Read a merged/rejected PR outcome as the wrap-up signal instead of a closed bead/epic — mine reviewer feedback into a PR learning. Absorbed the former pr-retro skill. See [references/pr-scope.md](references/pr-scope.md). | | `--process-only` | off | Skip council and extraction (Phase 1-2). Run Phase 3-5 on the existing backlog only. | | `--skip-activate` | off | Extract and process learnings but do not write to MEMORY.md (skip Phase 4 promotions). | | `--deep` | off | 3 judges (default for post-mortem) | | `--mixed` | off | Cross-vendor (Claude + Codex) judges | | `--explorers=N` | off | Each judge spawns N explorers before judging | | `--debate` | off | Two-round adversarial review | | `--skip-checkpoint-policy` | off | Skip ratchet chain validation | | `--skip-sweep` | off | Skip pre-council deep audit sweep | --- ## Quick Mode Read [references/quick-mode.md](references/quick-mode.md) when you need the `--quick` flag procedure (slug generation, direct learning write, confirmation). ## PR-Outcome Scope (`--scope=pr`) Read [references/pr-scope.md](references/pr-scope.md) when invoked with `--scope=pr`. It swaps the bead/epic wrap-up signal for a PR's merge/reject/changes-requested outcome: discover the PR, analyze the outcome, mine reviewer feedback via `gh`, extract success/failure patterns, and write a dated PR learning to `.agents/learnings/`. After the PR learning lands, the standard maintenance phases (process → activate → retire → harvest) run as usual. The trigger phrases "PR retro", "learn from this PR", and the legacy pr-retro command all route here. --- ## Execution Steps Read [references/execution-steps.md](references/execution-steps.md) when you need the full Phase 1 procedure: pre-flight checks, reference loading (Step 0.4), checkpoint-policy preflight (0.5), plan/spec loading (Steps 1-2.3), closure integrity audit (2.4), metadata verification (2.5), deep audit sweep (2.6), council invocation (Step 3), and prediction accuracy (3.5). ### Step 2.1: Load Compiled Prevention Context Before council and retro synthesis, load compiled prevention outputs when they exist: - `.agents/planning-rules/*.md` - `.agents/pre-mortem-checks/*.md` Use these compiled artifacts first, then fall back to `.agents/findings/registry.jsonl` only when compiled outputs are missing or incomplete. Carry matched finding IDs into the retro as `Applied findings` / `Known risks applied` context so post-mortem can judge whether the flywheel actually prevented rediscovery. ## Phase 2: Extract Learnings Read [references/phase-2-extract.md](references/phase-2-extract.md) when you need the inline learning extraction procedure: gather context (EX.1), classify (EX.2), write learnings (EX.3), test pyramid gap analysis (EX.3.5), scope classification (EX.4), findings registry (EX.5-6). Before backlog processing, normalize reusable council findings into `.agents/findings/registry.jsonl`. Use the tracked contract in `docs/contracts/finding-registry.md`: - persist only reusable findings that should change future planning or review behavior - require `d
Use Agent Mail from Codex for file leases, notifications, inboxes, and conflict prevention.
>-
>-
Use when converting markdown plans into br beads with dependencies for implementation or swarm execution.
Use when switching AI coding CLI accounts quickly to recover from subscription rate limits or OAuth friction.
>-
Use when starting non-trivial work, mining lessons, or preventing repeated mistakes with cm procedural memory.
Mine past agent sessions for working prompts, decisions, and patterns. Use when "what did I ask?", "find that prompt", session archaeology, or agent history.