Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By axtonliuv0.2.3MITIn 1 marketplace
Warns when your context nears its limit, then one click writes a work log, compacts and resumes from that log so long tasks survive compaction. The reminder band and prompts are in Chinese, and so is the log unless you ask otherwise. Experimental.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it reads files; runs commands; sends prompts on its own.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A Claude Code mod that warns you before your context fills up, and on one click writes a work log, compacts, then hands the log's resume prompt back to the session, so a long task survives compaction.
Status: Experimental
- A small prototype I use every day. It works for my sessions, but it has not been tested across every Claude Code version and setup.
- The quality of the log depends on the model writing it.
- Low-maintenance project. If something breaks, please open an issue with a reproducible case (steps, Claude Code version, CLI or Desktop, and the output of
/context-guard). That output includes local file paths and the first words of prompts sent while a log was being written, so remove anything private before posting.
On a long task, automatic compaction keeps a summary but loses the details you need to keep going: what was decided, why, which ideas were dropped, and what is left. context-guard makes the order explicit: write the log first, check it is on disk, then compact, then resume from the log.
When the context passes a threshold (75% by default), a band appears above the prompt:
上下文已用 X%,做完当前任务后建议写日志并压缩 [写日志并压缩][稍后]
The band's text is in Chinese (it says "Context is X% used; when you finish the current task, consider writing a log and compacting", with the buttons "Write log and compact" and "Later"). The prompts it sends into the session and the bundled skill are in Chinese too, so the log comes out in Chinese unless you ask for another language.
It only reminds. Nothing happens until you press the button. Each tier (the threshold, then 85 / 90 / 95) is announced once, and 「稍后」 (Later) hides the band until the next tier.
The percentage is measured against the auto-compact window when you set one smaller than the model's window (for example 400k on a 1M model), which is the same figure Desktop's context popover shows. Otherwise it is measured against the model's window.
Pressing 「写日志并压缩」 (Write log and compact):
work-log-share skill, into the project's existing log folder or logs/. The log ends with a ## 恢复会话 (Resume session) section that can be pasted into a fresh session, and the answer ends with a CONTEXT-GUARD block naming the log path, the goal and what is left.## 恢复会话 section as your next message, ending with "confirm the state, then carry on with the plan; stop for me only when the plan is done or a decision is mine". Work picks up by itself, and the session waits only when there is nothing left to do. The band shows the log path as a clickable link. Turn this off with /context-guard resume off.In the CLI it compacts through the mod API. In Claude Desktop, where that call is not available, it queues /compact with the same instructions instead, and the compaction runs when the session is idle.
The button is only a trigger. Whether you can pick the work back up depends on what the log keeps, so context-guard ships with work-log-share, a plain Markdown skill with no scripts or external services. It asks for:
## 恢复会话 (Resume session) section you can paste into a new session.You can also use it on its own: ask Claude to "use work-log-share to write a work log" at any point.
## 恢复会话 section. It writes no files itself.claude plugin validate . lists every API call the mod makes, so you can check this yourself before installing.Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground
npx claudepluginhub axtonliu/context-guard --plugin context-guard