Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By agentic-tool-labsv0.2.0Apache-2.0In 1 marketplace
Saves each compaction summary to a file after compaction completes, so the context a session dropped is still on disk.
You run one by typing its /name in Claude Code.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
When Claude Code compacts a session, the summary it writes is what the model
carries forward, and everything else drops out of its window. The summary
itself isn't lost: the transcript on disk is append-only, so it's sitting in a
.jsonl file somewhere. It's just hard to find. This plugin copies each
summary out to a markdown file you can actually open.
/plugin marketplace add agentic-tool-labs/agent-tools
/plugin install compaction-capture@agent-tools
Captures are off in every repo until you turn them on there.
It works fine on its own. The two other compaction plugins in this repo, idle-compactor and compaction-guard, are separate installs.
/compaction-capture on pick a folder and start capturing, for this repo
/compaction-capture off stop capturing
/compaction-capture status where captures go, how many exist, whether the hook ran
/compaction-capture where show the preset folders for this repo
/compaction-capture now capture immediately, without waiting for a compaction
It runs on the PostCompact hook, which fires after every compaction
finishes, both when you run /compact yourself and when Claude Code compacts
automatically. Each compaction gets one markdown file.
The hook gets the summary in its payload, and the transcript has a matching
entry. The plugin reads both, because they aren't the same text. The payload
copy keeps the model's <analysis> reasoning, which the transcript entry
drops. The transcript entry has the provenance (branch, Claude Code version,
token counts) that the payload has no field for. The source: line in the
front matter says which copy the body came from. Either one alone is enough to
write a capture.
on offers two presets, or any folder you name:
| Preset | Path |
|---|---|
| Inside this repo | <repo>/.claude/compaction-captures/ |
| Shared folder | ~/.claude/compaction-captures/<repo-name>/ |
A folder inside the repo doesn't need a per-repo subfolder, since the repo already is the scope. The shared folder sorts by repo name so different projects don't pile up together. If you pick a folder inside your repo, you probably want to gitignore it: captures are conversation summaries and run to tens of kilobytes each.
Either way, your choice is stored at the user level, in
~/.claude/compaction-capture/config.json, keyed by repo path. Nothing gets
added to a working tree just to record a preference.
One file per compaction, named for when it happened and what triggered it,
like 2026-08-05-223612-manual.md. It has YAML front matter over the summary
text, word for word:
---
captured_at: 2026-08-05T22:36:14.108Z
compacted_at: 2026-08-05T22:36:12.994Z
session: 08f958cb-bf78-45da-8c82-0992671a7dec
repo: claude-compaction-tools
branch: main
trigger: manual
pre_tokens: 242889
post_tokens: 21842
claude_code_version: 2.1.217
source: payload
chars: 19292
---
Fields Claude Code didn't supply are left out rather than written empty. The
token counts, for example, come from a compactMetadata block that not every
version emits.
The body is exactly what Claude Code wrote. No reformatting and no section parsing, so whatever you do with it later starts from the original.
If the hook fires again for a compaction it already captured, it writes
nothing. Each session remembers the uuid of the last summary it wrote.
node compaction-capture/test/run.js
The suite runs against a throwaway HOME, so it never touches your real
~/.claude. It covers pulling the summary out, the per-repo location store,
the front matter, skipping duplicates, and malformed input.
/plugin uninstall compaction-capture@agent-tools
rm -rf ~/.claude/compaction-capture
That leaves captures you've already written alone. Delete
~/.claude/compaction-captures too (and any in-repo capture folder) if you
want those gone.
Apache-2.0. See LICENSE.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub agentic-tool-labs/agent-tools --plugin compaction-capturePlugins from other owners that cover similar ground