Vibe-Commit/claude-context-mods/tree/main/plugins/context-meter
關於這個 mod
claude-context-mods
用來維持長工作階段健康的兩個 Claude Code 模組:
| Mod | What it does |
| --- | --- |
| context-meter | 在提示列頁尾顯示上下文視窗使用量(207k / 1.0M (21%)),並在使用量超過 80% 時提示一次。 |
| context-handoff | 當上下文填充到 60–70% 時,Claude 選擇自然的停頓點並寫下一份交接記錄。 |
兩者都是 function-hook 模組(以 TypeScript hook 模組撰寫的外掛)。它們使用 Claude Code 2.1.289 建置並測試。
Install
/plugin marketplace add Vibe-Commit/claude-context-mods
/plugin install context-meter@claude-context-mods
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add Vibe-Commit/claude-context-mods claude plugin install context-meter
原文 / README
claude-context-mods
Two Claude Code mods for keeping long sessions healthy:
| Mod | What it does |
| --- | --- |
| context-meter | Shows context-window usage in the prompt footer (207k / 1.0M (21%)), and shows a notice once when usage passes 80%. |
| context-handoff | When context is 60–70% full, Claude picks a natural stopping point and writes itself a handoff note. The mod then cuts the note-writing out of the transcript (a rewind), runs /compact, and has Claude read the note and carry on. The note is deleted once Claude has read it back. |
Both are function-hook mods (plugins written as TypeScript hook modules). That API is early access, so it can change between Claude Code releases. They were built and tested on Claude Code 2.1.289.
Install
Inside Claude Code:
/plugin marketplace add Vibe-Commit/claude-context-mods
/plugin install context-meter@claude-context-mods
/plugin install context-handoff@claude-context-mods
Or from a shell:
claude plugin marketplace add Vibe-Commit/claude-context-mods
claude plugin install context-meter@claude-context-mods
claude plugin install context-handoff@claude-context-mods
Restart Claude Code afterwards (or run /reload-plugins). Install one mod or both; they work independently.
Update and uninstall
claude plugin marketplace update claude-context-mods
claude plugin update context-handoff@claude-context-mods # restart to apply
claude plugin uninstall context-handoff@claude-context-mods
context-handoff in detail
- In the band. Once context passes 60%, Claude gets a hidden note telling it to hand off at the next natural boundary: a task finished, tests green, or before a new subtask, never mid-edit. At 70% the note says to do it now. The status line shows the current phase.
- Write. Claude calls the mod's
Handofftool with a markdown note. The note covers the goal, current state, decisions and their reasons, files, open problems, next steps, and commands to verify. It is saved to~/.claude/handoffs/<session-id>/handoff-N.md. Claude is then held to ending its turn. - Rewind and compact. When the turn ends, the mod compacts the session. The summary only covers the transcript up to the
Handoffcall, so writing the note never ends up in context. - Resume. The mod sends a prompt telling Claude to read the note and continue from its next steps.
- Clean up. After Claude reads the note back, the mod deletes it. It only deletes a file it wrote itself, and only if that file is inside the session's handoff folder. If the note is never read, it is kept and a notice shows its path.
Safeguards:
- Subagents are ignored.
- If a turn ends at 75% or more with no handoff, Claude is asked once to write one.
- If you interrupt the turn after the note is saved, the compaction is cancelled and the note is kept.
Command: /handoff [status|on|off|now]. now asks for a handoff right away, which is the quickest way to try the mod.
Thresholds (60 / 70 / 75 by default) can be changed per user. You can use /plugin configure context-handoff@claude-context-mods inside Claude Code, or a shell:
echo '{"bandLow":"55","bandHigh":"65","overshoot":"75"}' \
| claude plugin configure context-handoff@claude-context-mods --values-stdin
When you install, Claude Code reports "3 userConfig options not yet set". That's expected: unset options use the defaults.
Developing
Each mod has tests:
claude plugin validate plugins/context-handoff
claude plugin test plugins/context-handoff
To work on a mod with hot reload, load it from your checkout with claude --plugin-dir ./plugins/context-handoff, or list the folder in CLAUDE_CODE_PLUGIN_DIRS. Uninstall the marketplace copy first so it doesn't load twice. Bump version in the mod's plugin.json and in .claude-plugin/marketplace.json together. claude plugin validate . checks that they agree.
其他同名作品
- context-metercjavdev · ★ 1
- context-meterbaselane-sh · ★ 0
- context-meterlucenity0 · ★ 0
- context-meterredzrush101 · ★ 0
- context-metercleverfakealias · ★ 0
