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 hellosverrev0.3.2MITIn 1 marketplace
Compacts at the right moment: after a commit or green tests, a minute before the prompt cache expires, or when Claude asks for it with its own request_compact tool.
Code that runs inside Claude Code on every session, as you, unsandboxed.
Claude Code asks for these when you enable the plugin. Sensitive values are stored in your system keychain.
Back up before compactingbackup
On: before every compact, the full conversation is copied to its own session, listed in /resume as 'Before compact <time>'.
booleandefault true
When Claude asks to compactonRequest
ask: show a one-click band. auto: compact as soon as the turn ends.
One of
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it sees, changes or blocks tool calls; runs programs; runs commands; reads or rewrites your prompts.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
claude-code-mods, claude-mods, function-hooks, compact, context, prompt-cache, tokens
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
askautostringdefault ask
Minimum context fill (%)minPercent
Below this, no suggestion is made and Claude's requests are turned down.
numberdefault 40
Compact while idle, before the cache expiresidleCompact
Off: only suggest it. On: compact one minute before expiry while the summary still reads from cache.
booleandefault false
Prompt cache lifetime (minutes)cacheTtlMinutes
5 for the API default, 60 if your plan uses the 1-hour cache.
numberdefault 5
Suggest after a commit or green testssuggestAfterWork
On: offer to compact when a git commit lands or tests go green. Off: stay quiet then; the cache timer and Claude's own requests still work.
booleandefault true
Auto-compact waits until the context is full, and that usually lands mid-task.
smart-compact offers it at the right moments: when work has just landed, before the prompt cache expires,
or when Claude itself says it is done with what came before.
Needs Claude Code 2.1.295 or later, in a terminal or the desktop app's Code tab. Run both inside Claude Code:
/plugin marketplace add hellosverre/smart-compact
/plugin install smart-compact@smart-compact
Restart Claude Code. Nothing to set up: smart-compact stays out of the way until the context is 40% full.
claude plugin marketplace update smart-compact
claude plugin update smart-compact@smart-compact
claude plugin uninstall smart-compact@smart-compact
| Moment | The offer reads | Why then |
|---|---|---|
Claude calls request_compact | Claude wants to compact · its reason | Claude knows when a task is finished better than a token counter does |
A git commit lands | Good moment to compact · You just committed | The work is saved; the turns that led to it are rarely needed verbatim |
| Tests go green | Good moment to compact · Tests just went green | Same, for vitest, jest, pytest, mocha, playwright, cargo, go, dotnet and npm/pnpm/yarn/bun test |
| You have been idle almost 5 minutes | Good moment to compact · Prompt cache expires in ~1 min | See below |
The offer opens as a small dialog above the prompt that already has the keyboard: ←/→ pick, Enter confirms
(or c / n), Esc hands the keys back. Where the terminal is too narrow for it, the band carries the same buttons
(click it or ctrl+x tab first). Sending a new prompt clears either.
Nothing shows while the context is under the threshold, and nothing fires inside subagents.
smart-compact gives Claude a tool, request_compact, with two fields:
| Field | |
|---|---|
reason | One line: why now is a good moment. Shown in the offer. |
instructions | What the summary must keep: open TODOs, file paths, decisions. Passed to the compaction. |
The tool's description tells Claude to call it at a natural boundary (a task finished and committed, a plan written down, a switch to an unrelated topic) and never mid-task. A request while the context is under the threshold is turned down with a note telling Claude to keep working, so it cannot compact a short session.
By default a request only offers the compact. Set onRequest to auto and it compacts as soon as the turn ends.
Claude Code caches the conversation for 5 minutes after each turn. Compacting reads the whole context, so compacting while the cache is warm reads it at cache price. Wait past expiry and the next message, compact or not, re-sends every token at full price. At 150k tokens that is the difference between a tenth of the cost and all of it.
So a minute before the cache expires, smart-compact offers the compact. Turn on idleCompact and it does it
for you while you are away. If the machine slept through that minute, the cache is already gone when the
timer wakes, and smart-compact does nothing: compacting then would read the whole context at full price for
no one.
Before every compact (yours, auto-compact's or smart-compact's), the whole conversation is copied to a session
of its own. Pick Before compact <time> in /resume to go back to it as it was. Claude Code clears old
sessions after cleanupPeriodDays (30 by default), backups included.
In the plugin's options under /plugin:
smart-compact@hellosverre-mods is listed by hellosverre/claude-skins — review the source before installing
npx claudepluginhub hellosverre/claude-skins --plugin smart-compactBuilt from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.