cd /news/ai-tools/show-hn-compactly-compact-claude-cod… · home › topics › ai-tools › article
[ARTICLE · art-157952] src=github.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Show HN: Compactly – Compact Claude Code sessions between tasks

Developer Swapnil Dahiphale released Compactly, a Claude Code plugin that compacts a session at task boundaries rather than mid-task, writing a handoff summary for the next task and displaying per-turn costs and prompt-cache expiry. Compactly requires Claude Code 2.1.295 or later and installs through Claude Code's plugin system; in its default `auto` mode a Claude Sonnet judge reads each new prompt once context is large and, if the prompt follows a natural break, compacts before sending it, while `suggest` mode only flags git commits, pushes or PRs as good compaction moments. The plugin also adds a `/cost-panel` showing session cost, cache hit rate, re-read cost per turn and cold-rebuild cost, plus a footer line such as `● warm 59m · $0.012 if cold`.

read4 min views7 publishedOct 26, 2026
Show HN: Compactly – Compact Claude Code sessions between tasks
Image: Michielbdejong (auto-discovered)

Compact smartly.

A Claude Code plugin that compacts your session at task boundaries, with a handoff summary for the next task, and shows what each turn costs and when the prompt cache expires. The name is the idea: compact smartly, with the "smart" squeezed out.

compactly.mp4 #

<sub>Illustrative session · costs vary by model and context.</sub>

Claude Code re-reads the whole conversation on every request, so a large context carried into an unrelated task is paid for again on every turn. Compacting in the middle of a task drops what it still needs. compactly compacts in between: right after the work is done.

  • Compacts at natural breaks , with a summary written as a handoff for the next task.
  • Shows what each turn costs and when the prompt cache expires.
  • Learns from your 👍 / 👎 on each automatic compaction.

Requires Claude Code 2.1.295 or later. compactly is a plugin and installs through Claude Code's plugin system. Inside Claude Code:

/plugin marketplace add swapnildahiphale/compactly
/plugin install compactly@compactly

Or from a shell:

claude plugin install compactly --marketplace swapnildahiphale/compactly

Start a new session afterwards. See installation for a local clone, scopes, updating and uninstalling.

  • /cost-panel opens the cost & cache panel, or press the footer line beside the prompt.
  • /compactly compacts now.
  • By default (auto mode), Claude Sonnet reads each new prompt once the context is large. If the prompt starts after a natural break, the plugin compacts first and then sends the prompt. A band above the prompt asks**👍 Yes** or**👎 No, I was mid-task** , and the judge learns from your answers.
  • In suggest mode, the plugin only tells you when a git commit, push or PR is a good moment to compact.

Open it with /cost-panel, or press the footer line beside the prompt.

  • Header : the model, the cache TTL, a**⚙ Settings** button and aCompact button.
  • Stat tiles with sparklines: session cost, cache hit, re-read per turn, rebuild if cold.
  • Cache clock : drains as the cache ages, with a compact window before it goes cold.
  • Context : tokens used against the model's window.
  • Hints : ranked actions: compact now, snooze 10 min, not this session.
  • Cost per turn : cache read, cache write, output and uncached input.
  • Footer line : a one-line summary such as● warm 59m · $0.012 if cold , visible even when the panel is closed.

⚙ Settings chooses which sections the panel draws and which fields the footer line carries, by preset (minimal, cost, standard) or one at a time. See settings.

Saved by compacting keeps score of what your compactions saved after their own cost, and an all-time total earns levels from Cache Rookie to Compaction Legend.

Details: the panel.

In auto mode, a judge model decides when you send your next prompt:

  • If no prompt follows a commit, push or PR, it compacts 5 minutes before the cache expires, once the context is at least minTokens and your work isn't d.
  • If your recent prompts say work is d, git signals don't compact automatically.
  • In suggest mode it only tells you when a commit, push or PR is a good moment.

Details: how it works, decision flows.

Option When it runs Summary
/compact when you type it general history of the conversation
autocompact (built in) when the context nears the window limit general
idle compaction (built in) after about 55 min idle, context ≥ 200K general
/clear , new session when you run it none; only CLAUDE.md and memory remain
/compactly (or automatic) when you type it, or at a natural break before the next prompt handoff for the next task

The trade-off: the judge is sometimes wrong, so some automatic compactions land mid-task. Rate them and it becomes more careful, or set mode to suggest to confirm each one. Details: how it works.

The defaults work as they are. The settings people change most:

Setting Default Meaning
mode auto suggest : notify only;auto : compact at a natural break;off : do nothing
judge sonnet sonnet ,haiku (cheaper, compacts less often), oroff
minTokens 150000 act only when the context is at least this large
claude plugin install compactly --marketplace swapnildahiphale/compactly \
  --config mode=suggest --config minTokens=100000

Details: configuration, installation.

The plugin makes no network calls of its own. The judge runs through Claude Code with the model you pick. Ratings and savings totals are kept in the plugin's own store under ~/.claude, on your machine.

Issues and pull requests are welcome. To work on the plugin from a clone, see Develop.

── more in #ai-tools 4 stories · sorted by recency
── more on @compactly 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-compactly-co…] indexed:0 read:4min 2026-10-26 · —