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.
npx agentmods add commands/jonase47/ccpr/postmortemgit clone --depth 1 https://github.com/jonase47/ccprWrote 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.
[](https://agentmods.dev/commands/jonase47/ccpr/postmortem)<a href="https://agentmods.dev/commands/jonase47/ccpr/postmortem"><img src="https://agentmods.dev/badge/commands/jonase47/ccpr/postmortem.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02495 |
| Opus 5 | $0.00000 | $0.01247 |
| Sonnet 5 | $0.00000 | $0.00499 |
| Haiku 4.5 | $0.00000 | $0.00249 |
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 2d 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.
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:
- Read all
~/.claude/sessions/*.json(PID mapping files withsessionIdandcwd) - Filter for sessions whose
cwdmatches the current working directory (exact match or parent directory) - Take the most recent matching session ID (by
startedAt) - Load the logs from
~/.claude/logs/sessions/{session-id}/ - Fallback: If no cwd match, take the most recent session directory under
~/.claude/logs/sessions/(backwards compatible)
- Read
session-summary.json,errors.jsonl, andactivity.jsonl - Abort only when there is no usable data — that is, all three are missing or unreadable.
A missing
session-summary.jsonalone is not a reason to stop: it is written at session end, so analysing a session that is still running is a normal case, andactivity.jsonl+errors.jsonlcarry the material. - A summary that IS present may be a mid-session snapshot. Sanity-check its tool-call count
against
wc -lonactivity.jsonlbefore reporting any of its numbers; a stale summary is worse than an absent one, because its figures look plausible. When they disagree,activity.jsonlwins 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:
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.
- 2d ago First seen · 169 lines · 0 tokens per session scan A 5684ae7fe881
postmortem is a command published in the GitHub repository jonase47/ccpr (1 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,495 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.
Other commands, from other repositories
setup
Interview me and scaffold my personal chief-of-staff system (context file, memory, task list, daily brief).
brief
Produce my morning brief — what's on today, what's slipping, what to prep, one thing worth my attention.
loops
Weekly review — surface everything in-flight and force a ship / block / kill decision on each.
evolve-skills
Review mature instincts and promote qualifying ones to full skills. Usage - /mindforge:evolve-skills [--dry-run] [--threshold 0.85] [--min-applications 5].
context-budget
Analyze and optimize context window allocation. Usage: /mindforge:context-budget [--analyze] [--optimize] [--max-tokens N].
cluster-instincts
Group related instincts by tag overlap and batch-promote qualifying clusters to skills. Usage - /mindforge:cluster-instincts [--dry-run] [--min-cluster 3] [--min-confidence 0.7].