postmortem

postmortem is a command for Claude Code from jonase47/ccpr. It costs 0 tokens per session (2,494 once invoked), scanned A, original, MIT.

A session review command that examines the previous coding-agent session for the current project and extracts proposals for improving future work.

In plain words
What is it for?
Use it after a session to identify recurring problems, useful habits, and possible changes to the agent’s instructions.
Why use it?
It turns scattered session activity, errors, and notes into a short set of improvement ideas instead of making you review logs by hand.

Command for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Good fit Use it after a session to identify recurring problems, useful habits, and possible changes to the agent’s instructions.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jonase47/ccpr/postmortem
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/jonase47/ccpr

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for postmortem

README.md
[![agentmods](https://agentmods.dev/badge/commands/jonase47/ccpr/postmortem/github.svg)](https://agentmods.dev/commands/jonase47/ccpr/postmortem)
Your own site
<a href="https://agentmods.dev/commands/jonase47/ccpr/postmortem"><img src="https://agentmods.dev/badge/commands/jonase47/ccpr/postmortem/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for postmortem

Your own site · 80×15
<a href="https://agentmods.dev/commands/jonase47/ccpr/postmortem"><img src="https://agentmods.dev/badge/commands/jonase47/ccpr/postmortem.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,494 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02494
Opus 5.5 $0.00000 $0.00998
Sonnet 5.5 $0.00000 $0.00499
Haiku 4.5 $0.00000 $0.00249

Measured 2mo ago against content hash 19dafcb2d16b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

postmortem scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/postmortem.md · 169 lines

How it starts

The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Session Postmortem

Analyze the last session and extract instinct proposals.

Execution

1. Load session data (project-aware)

Find the last session for the current project, not simply the most recent globally:

  1. Read all ~/.claude/sessions/*.json (PID mapping files with sessionId and cwd)
  2. Filter for sessions whose cwd matches the current working directory (exact match or parent directory)
  3. Take the most recent matching session ID (by startedAt)
  4. Load the logs from ~/.claude/logs/sessions/{session-id}/
  5. Fallback: If no cwd match, take the most recent session directory under ~/.claude/logs/sessions/ (backwards compatible)
  • Read session-summary.json, errors.jsonl, and activity.jsonl
  • Abort only when there is no usable data — that is, all three are missing or unreadable. A missing session-summary.json alone is not a reason to stop: it is written at session end, so analysing a session that is still running is a normal case, and activity.jsonl + errors.jsonl carry the material.
  • A summary that IS present may be a mid-session snapshot. Sanity-check its tool-call count against wc -l on activity.jsonl before reporting any of its numbers; a stale summary is worse than an absent one, because its figures look plausible. When they disagree, activity.jsonl wins and the discrepancy belongs in the report.

2. Analyze error patterns

Search the session data for recurring patterns:

  • EISDIR pattern: Repeated "Is a directory" errors (agent reads directory instead of file)
  • Loop pattern: Tool calls that were warned/blocked by loop detection
  • Stagnation: Long phases without productive Write/Edit calls
  • Ghost events: SubagentStop without SubagentStart (compact artifact)
  • Incomplete agents: Agents that did not terminate cleanly
  • Tool failures: Repeated errors on specific tools

3. Generate instinct proposals (0-3 per session)

For each recognized pattern, propose an instinct. This is the proposal format shown to the user for confirmation — the stored block written in §6 has a different, richer shape:

Read the full file on GitHub · 169 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed 19dafcb2d16b
  2. 2mo ago Changed 98c167f2eeee
  3. 2mo ago First seen · 169 lines · 0 tokens per session scan A 5684ae7fe881

Subscribe to this mod's changes

postmortem is a command published in the GitHub repository jonase47/ccpr (1 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,494 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

postmortem compared with commands from other repositories

postmortem next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
postmortemjonase47/ccprCommand12mo agoMITA0Claude Code
setuploganhc-09/claude-chief-of-staffCommand1001mo agoMITA23Claude Code
briefloganhc-09/claude-chief-of-staffCommand1001mo agoMITA22Claude Code
loopsloganhc-09/claude-chief-of-staffCommand1001mo agoMITA19Claude Code
orchestrateegorfedorov/claude-context-optimizerCommand1376d agoMITA0Claude Code
gws-keepfakoli/fakoli-pluginsCommand42d agoMITA6Claude Code
todo.templateevan043/claude-cli-advanced-starter-packCommand624mo agoMITA0Claude Code