{"slug": "show-hn-compactly-compact-claude-code-sessions-between-tasks", "title": "Show HN: Compactly – Compact Claude Code sessions between tasks", "summary": "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`.", "body_md": "**Compact smartly.**\n\nA Claude Code plugin that compacts your session at task boundaries, with a handoff summary for\nthe next task, and shows what each turn costs and when the prompt cache expires. The name is\nthe idea: *compact smartly*, with the \"smart\" squeezed out.\n\n## compactly.mp4\n\n<sub>Illustrative session · costs vary by model and context.</sub>\n\nClaude 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.\n\n- **Compacts at natural breaks** , with a summary written as a handoff for the next task.\n- **Shows what each turn costs** and when the prompt cache expires.\n- **Learns from your 👍 / 👎** on each automatic compaction.\n\nRequires Claude Code 2.1.295 or later. compactly is a plugin and installs through Claude Code's plugin system. Inside Claude Code:\n\n```\n/plugin marketplace add swapnildahiphale/compactly\n/plugin install compactly@compactly\n```\n\nOr from a shell:\n\n```\nclaude plugin install compactly --marketplace swapnildahiphale/compactly\n```\n\nStart a new session afterwards. See [installation](https://github.com/swapnildahiphale/compactly/blob/main/docs/installation.md) for a local clone,\nscopes, updating and uninstalling.\n\n- `/cost-panel` opens the cost & cache panel, or press the footer line beside the prompt.\n- `/compactly` compacts now.\n- By default (`auto` mode), Claude Sonnet reads each new prompt once the context is large. If\nthe prompt starts after a natural break, the plugin compacts first and then sends the prompt.\nA band above the prompt asks**👍 Yes** or**👎 No, I was mid-task** , and the judge learns\nfrom your answers.\n- In `suggest` mode, the plugin only tells you when a git commit, push or PR is a good moment to\ncompact.\n\nOpen it with `/cost-panel`, or press the footer line beside the prompt.\n\n- **Header** : the model, the cache TTL, a**⚙ Settings** button and a**Compact** button.\n- **Stat tiles** with sparklines: session cost, cache hit, re-read per turn, rebuild if cold.\n- **Cache clock** : drains as the cache ages, with a compact window before it goes cold.\n- **Context** : tokens used against the model's window.\n- **Hints** : ranked actions: compact now, snooze 10 min, not this session.\n- **Cost per turn** : cache read, cache write, output and uncached input.\n- **Footer line** : a one-line summary such as`● warm 59m · $0.012 if cold` , visible even\nwhen the panel is closed.\n\n**⚙ Settings** chooses which sections the panel draws and which fields the footer line\ncarries, by preset (`minimal`, `cost`, `standard`) or one at a time. See\n[settings](https://github.com/swapnildahiphale/compactly/blob/main/docs/panel.md#settings).\n\n**Saved by compacting** keeps score of what your compactions saved after their own cost, and\nan all-time total earns levels from Cache Rookie to Compaction Legend.\n\nDetails: [the panel](https://github.com/swapnildahiphale/compactly/blob/main/docs/panel.md).\n\nIn `auto` mode, a judge model decides when you send your next prompt:\n\n- If no prompt follows a commit, push or PR, it compacts 5 minutes before the cache expires,\nonce the context is at least `minTokens` and your work isn't paused.\n- If your recent prompts say work is paused, git signals don't compact automatically.\n- In `suggest` mode it only tells you when a commit, push or PR is a good moment.\n\nDetails: [how it works](https://github.com/swapnildahiphale/compactly/blob/main/docs/how-it-works.md), [decision flows](https://github.com/swapnildahiphale/compactly/blob/main/diagrams/architecture.md).\n\n| Option | When it runs | Summary | \n|---|---|---|\n| `/compact` | when you type it | general history of the conversation | \n| autocompact (built in) | when the context nears the window limit | general | \n| idle compaction (built in) | after about 55 min idle, context ≥ 200K | general | \n| `/clear` , new session | when you run it | none; only CLAUDE.md and memory remain | \n| **`/compactly`** (or automatic) | when you type it, or at a natural break before the next prompt | handoff for the next task | \n\nThe trade-off: the judge is sometimes wrong, so some automatic compactions land mid-task.\nRate them and it becomes more careful, or set `mode` to `suggest` to confirm each one.\nDetails: [how it works](https://github.com/swapnildahiphale/compactly/blob/main/docs/how-it-works.md#how-it-compares).\n\nThe defaults work as they are. The settings people change most:\n\n| Setting | Default | Meaning | \n|---|---|---|\n| `mode` | `auto` | `suggest` : notify only;`auto` : compact at a natural break;`off` : do nothing | \n| `judge` | `sonnet` | `sonnet` ,`haiku` (cheaper, compacts less often), or`off` | \n| `minTokens` | `150000` | act only when the context is at least this large | \n\n```\nclaude plugin install compactly --marketplace swapnildahiphale/compactly \\\n  --config mode=suggest --config minTokens=100000\n```\n\nDetails: [configuration](https://github.com/swapnildahiphale/compactly/blob/main/docs/configuration.md), [installation](https://github.com/swapnildahiphale/compactly/blob/main/docs/installation.md).\n\nThe plugin makes no network calls of its own. The judge runs through Claude Code with the model\nyou pick. Ratings and savings totals are kept in the plugin's own store under `~/.claude`, on your\nmachine.\n\nIssues and pull requests are welcome. To work on the plugin from a clone, see\n[Develop](https://github.com/swapnildahiphale/compactly/blob/main/plugin/compactly/README.md#develop).", "url": "https://wpnews.pro/news/show-hn-compactly-compact-claude-code-sessions-between-tasks", "canonical_source": "https://github.com/swapnildahiphale/compactly", "published_at": "2026-10-26 12:58:47+00:00", "updated_at": "2026-10-26 13:11:34.566959+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "large-language-models"], "entities": ["Compactly", "Swapnil Dahiphale", "Claude Code", "Anthropic", "Claude Sonnet"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-compactly-compact-claude-code-sessions-between-tasks", "markdown": "https://wpnews.pro/news/show-hn-compactly-compact-claude-code-sessions-between-tasks.md", "text": "https://wpnews.pro/news/show-hn-compactly-compact-claude-code-sessions-between-tasks.txt", "jsonld": "https://wpnews.pro/news/show-hn-compactly-compact-claude-code-sessions-between-tasks.jsonld"}}