✳ClaudeModsClaude Code 模组目录
☰
● 0 人在线 · 浏览 0 次
+ 提交作品
← 返回作品集
Reddit 帖子 · 用量与成本 / 记忆与上下文 / 工具与集成 / 工作流与 CI

handoff-compact:自动完成交接与 /clear 的 Claude Code 模组

一个在 autocompact 触发时自动生成交接文档并替换上下文的模组,省去手动 handoff + /clear 流程。

sspeciallight@speciallight
已翻译

关于这个 mod

handoff-compact 是一个在 Claude Code autocompact 触发时接管的模组,用于解决长时间无人值守会话中上下文超过 200k 导致的高成本与质量下降问题。它不调用内置摘要器,而是分叉整个会话上下文,生成一份交接文档,涵盖目标、状态及其证据、下一步、决策及原因、已排除方案、待解决问题、相关文件与提交、验证命令以及最近 10 条提示原样,然后用该文档替换原对话。效果等同于 handoff + /clear,但在同一会话中、回合中途、无人值守时自动完成。作者称其为 vibe-coded,鼓励用户拿走思路或模组并按自己环境定制。需要 Claude Code 2.1.287+ 并启用 mods。使用 /compact classic 可单次获得内置摘要。仓库为 MIT 许可。

安装

请先查看作者 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]

查看原始来源 ↗

更多类似作品