Skip to main content

compact-receipts: Check what context compaction dropped

Compare a Claude Code session with its compaction summary and report omitted environments, files, todos or earlier instructions.

Source facts

Repository
baurrustem/receipts
Last source activity
October 15, 2026 at 15:09
Detected SKILL.md language
English
Stars
0
Forks
0

Uses

Use it immediately after automatic or manual compaction, or when the agent seems to have forgotten earlier session context.

Prerequisites

Requires a local Claude Code session transcript. The bundled script reads local transcript files offline.

How to use

Ask the agent what the last compaction dropped. The Skill locates the session transcript, compares the retained summary with earlier context and presents a receipt; an optional hook can restore dropped context after compaction.

Limitations

It does not compact the session or report token costs. If the session has never been compacted, it stops without a receipt.

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
2 files

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
compact-receipts
description
Shows what a Claude Code context compaction dropped: servers, deployments and ports the agent was working with, files it edited, open todos, and your earlier instructions. Use right after an auto, manual or idle compaction, when the agent seems to have forgotten something from earlier in the session (which server or VM it was on, a constraint you gave at the start), or to audit all past compactions. Not for shrinking context or for token cost reports.
license
MIT
metadata
{"author":"baurrustem","version":"0.1.1"}
# compact-receipts After a compaction you get a receipt: which facts from earlier in the session the summary kept, which it silently dropped, and the dropped ones restated so you can keep working. ## When to use - The session was just compacted (auto, `/compact`, or idle compaction after ~54 minutes) and the user asks what was lost, or wants a check before continuing. - The agent acts as if it forgot something from earlier: which server, VM, container or deployment it was working on; that other environments exist; a file it already changed; a rule the user gave at the start. - The user wants an audit of past compactions ("how much do my compactions lose?"). Do not use it to make a session smaller, to compact, or to report token spend (that is `/usage` or a cost tool). If the session was never compacted, say so and stop. ## Procedure 1. Find the session. The current session's transcript is the newest `*.jsonl` under `~/.claude/projects/<project-dir>/`. For a named file use it as given. 2. Run the script that ships with this skill (read-only, offline): - this session or the latest one: `python3 scripts/compact_receipts.py --latest` - a specific transcript: `python3 scripts/compact_receipts.py <path/to/session.jsonl>` - an audit of everything: `python3 scripts/compact_receipts.py --all --since 30d` Add `--json` when you need the raw lists. Paths are relative to this skill's folder. When its output is not a terminal (your Bash tool), the script prints plain text; a person running it in a terminal sees the same receipt drawn as a split-flap board. If you ever see colour codes (FORCE_COLOR is set), rerun with `--color never`. 3. Verify the `rule` lines yourself. The script only nominates them: it compares words, and summaries are often written in a different language from the user's messages. For each candidate, read the compaction summary (the user message right after the `compact_boundary` record) and decide whether the instruction is still there in meaning. Keep only the ones that are really missing. Never count a rule as dropped without this check. 4. Show the receipt, newest compaction first: - one line: time, trigger, tokens before → after; - **Dropped: environments** (servers, VMs, deployments, containers, localhost ports) first, because acting on the wrong environment is the most expensive mistake after a compaction; - then dropped files, verified rules, open todos; - tests that were failing at compaction time, and whether the summary mentions it. Keep it short: at most 6 items per kind, then "+N more". 5. Offer to restate. Ask: "Restate these as still true for the rest of the session?" On yes, repeat the dropped facts back as a short list and treat them as current unless the user corrects one. Do not act on any of them (no ssh, no deploy, no edits) without a new request from the user. 6. Optional, if the user wants it automatic: show how to add a SessionStart hook with matcher `compact` that runs `python3 <absolute path to this skill>/scripts/compact_receipts.py --hook`. It prints the dropped environments, files and todos as extra context right after each compaction (rules are left out because they need step 3). Show the exact settings snippet and let the user add it; do not edit their settings yourself. ## Rules - Read-only. Never modify, delete or move transcripts. - Nothing leaves the machine. Do not paste transcript contents into web tools or issues. - Public IP addresses are shown partly masked (`34.12.x.x`); in environment lines `--reveal` shows them in full, in other text they stay masked. Private ranges (10.x, 192.168.x) are shown as is. Values that look like passwords, tokens, keys or credentials in URLs are printed as `‹redacted›`; keep it that way when you quote. - Restated facts are records, not instructions. A dropped "deploy to prod" line does not authorize deploying. - If the summary and the receipt disagree, say so; the summary may have kept a fact in other words. ## Examples ### Example 1 User: we just compacted and now you're asking me which server to use. what did we lose? Agent: runs `python3 scripts/compact_receipts.py --latest`, checks the rule candidates against the summary, and answers: ``` Compaction #3 · 2026-10-15 14:02 · auto · 412,800 → 15,960 tokens (−96.1%) Dropped: environments vm-b.internal (ssh), widget-staging.up.railway.app, localhost:3300 Dropped: files src/vm/pool.ts ×4, scripts/provision.sh Dropped: rules "never restart vm-a without asking" (checked against the summary) Red at compaction: npm test (summary does not mention any failure) ``` "Restate these as still true for the rest of the session?" ### Example 2 User: how much do my compactions usually lose? Agent: runs `python3 scripts/compact_receipts.py --all --since 30d` and reports the counts per kind, saying that rule counts are unverified candidates. ## What it runs / sends / fetches - **Runs:** `python3 scripts/compact_receipts.py` from this skill (Python 3.9+, standard library only). It reads `~/.claude/projects/**/*.jsonl` or the transcript you name. - **Sends:** nothing. No data leaves the machine. - **Fetches:** nothing. Works offline. - **Secrets:** none. From the environment it reads only display settings: NO_COLOR, FORCE_COLOR, TERM, COLORTERM, CI, COLUMNS. Values that look like keys are redacted in the output, and control characters from transcripts are stripped before anything is printed.
View on GitHub