jl-cmd-projects/claude-dev-env/tree/main/packages/usage-wrapup
usage-wrapup
一个 Claude Code mod。当计划用量快耗尽时,它会让每个正在运行的 agent 收尾,避免你在任务做到一半、文件改了一半且没有交接时被截断。
关于这个 mod
一个 Claude Code mod,监视 Pro/Max/Team 的速率限制窗口(5 小时、每周、花费上限)。当某个窗口只剩 1% 或更少(可配置)时,主 agent 和 subagent 的每个工具结果都会带上提示:不要开始新工作,完成当前步骤或安全暂停,写一份简短交接(已完成 / 留下的内容 / 下一步),通过 send_later 或 create_trigger 例程安排一次刚好在重置时间之后唤醒的任务,然后停止并作答。它也会显示状态行警告和一次性 toast;当 5 小时窗口达到 97% 已用,或每周窗口达到 99% 已用时,在回合结束时压缩对话,每个窗口一次,跳过中断的回合和 subagent 回合,并保留当前任务、状态、触碰过的文件和下一步的摘要。只适用于 Claude 订阅。通过克隆仓库并使用 --plugin-dir 启动来安装;通过 /config thresholds 配置阈值。
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add jl-cmd-projects/claude-dev-env claude plugin install usage-wrapup
原文 / README
usage-wrapup
A Claude Code mod. When your plan usage gets low, it tells every running agent to wrap up — so you don't get cut off mid-task with half-edited files and no handoff.
What it does
- Watches your rate-limit windows (5-hour, weekly, spend limit).
- When any window has 1% or less left (configurable), every tool result — in the main agent and in subagents — carries a note telling the model to:
- start no new work,
- finish or safely pause the current step,
- write a short handoff (done / left / next step),
- arm one wake for just after the reset time, such as
send_laterto its own session or acreate_triggerroutine, so the paused work resumes without a person, - stop and answer.
- Shows
⚠ N% left — wrapping upin the status line and a one-time toast. - Compacts the conversation when usage is nearly gone. This happens when the 5-hour window is 97% used or more, or the weekly window is 99% used or more.
- It compacts when a turn ends, so the next turn starts with a smaller context.
- It compacts once per window. When the window resets, it can compact again.
- The summary keeps the current task, its state, the files it touched, and the next steps.
- It skips a turn you interrupted, and it skips subagent turns.
Only works on a Claude subscription (Pro/Max/Team), where Claude Code gets rate-limit data.
Install
git clone https://github.com/DaKev/usage-wrapup ~/claude-mods/usage-wrapup
claude --plugin-dir ~/claude-mods/usage-wrapup
Configure
/config has three options:
- Wrap-up threshold (% left). Default
1. - Compact at 5-hour usage (% used). Default
97. - Compact at weekly usage (% used). Default
99.
Test
claude plugin validate .
claude plugin test .
MIT license. See LICENSE.

