✳ClaudeModsClaude Code mod directory
☰
● 0 online · Views 0 times
+ Submit a project
← Back to projects
Reddit posts · Usage & costs / Memory & context / Tools & integrations / Workflows & CI

handoff-compact: Automatically perform handoff and cleanup during autocompact

A Claude Code mod that automatically generates a handoff document and replaces the context when autocompact triggers, equivalent to automating the handoff + /clear process.

sspeciallight@speciallight
Translated

About this mod

The author runs many long, unattended Claude Code sessions and found that half the tokens are spent on turns after the context has exceeded 200k, which is both expensive and degrades quality due to context rot. The manual approach is to request a handoff, /clear, then feed it back, but with 200k autocompact enabled the handoff content is uncontrollable. handoff-compact intervenes when autocompact triggers: the session branch (full context) writes out a handoff document containing goals, status and evidence, next steps, decisions and rationale, excluded options, open questions, files and commits, verification commands, and the raw text of the last 10 prompts, then uses that document to replace the conversation content, achieving handoff + /clear within the same session, mid-turn, unattended. The project is vibe-coded, MIT licensed, requires Claude Code 2.1.287+ and mods enabled; "/compact classic" can temporarily use the built-in summary.

Installation

Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.

/plugin marketplace add trytofly94/handoff-compact
/plugin install handoff-compact@handoff-compact
Original text / README

I run a lot of long unattended Claude Code sessions. When I measured them, half of my tokens came from turns where the context was already past 200k. That's expensive, since every step resends the whole context, and quality degrades because of context rot. By hand the fix is the usual routine: ask for a handoff, /clear, feed it back. Enabling autocompact at 200k keeps the context short but leaves little control over what is handed over. I already tried to have Claude Code write handoff documents pre autocompact window with hooks, but with modding the solution gets a LOT better. Handoff-compact answers the autocompact trigger instead of the built-in summarizer. A fork of the session (whole context) writes a handoff-document (goal, state and what proves it, next step, decisions and why, ruled-out approaches, open questions, files and commits, the verify command, the last 10 prompts verbatim), and the conversation is replaced by it. Handoff + /clear, but in the same session, mid-turn, with nobody at the keyboard. Obviously vibe-coded. Take the idea or the mod itself and customize it with your own setup. Modding is awesome. Install: /plugin marketplace add trytofly94/handoff-compact /plugin install handoff-compact@handoff-compact Repo: https://github.com/trytofly94/handoff-compact (MIT). Needs Claude Code 2.1.287+ with mods enabled. "/compact classic" gives you the built-in summary once. submitted by /u/speciallight [link] [comments]

View original source ↗

Similar projects