✳ClaudeModsClaude Code 模組目錄
☰
● 0 人在線上 · 瀏覽 0 次
+ 提交作品
← 返回作品集
Reddit 貼文 · 用量與成本 / 記憶與上下文 / 工具與整合 / 工作流程與 CI

handoff-compact:自動壓縮時自動執行交接與清理

一個 Claude Code mod,在 autocompact 觸發時自動產生交接文件並替換上下文,等同於自動完成 handoff + /clear 流程。

sspeciallight@speciallight
已翻譯

關於這個 mod

作者執行大量長時間無人值守的 Claude Code 工作階段,發現一半 token 花在上下文已超過 20 萬後的分支,既昂貴又因上下文腐化降低品質。手動方案是請求交接、/clear、再餵回,但啟用 200k autocompact 後交接內容不可控。handoff-compact 在 autocompact 觸發時介入,工作階段分支(完整上下文)會寫出交接文件,包含目標、狀態與證據、下一步、決策與理由、已排除方案、開放問題、檔案與提交、驗證指令、最近 10 條 prompt 原文,然後用該文件替換對話內容,實現同一工作階段內、分支中途、無人值守的 handoff + /clear。該專案為 vibe-coded,MIT 許可,需要 Claude Code 2.1.287+ 且啟用 mods;"/compact classic" 可暫時使用內建摘要。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

/plugin marketplace add trytofly94/handoff-compact
/plugin install handoff-compact@handoff-compact
原文 / 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]

查看原始來源 ↗

更多類似作品