ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 mutlumehmet

context-alarm

一个 Claude Code mod,在上下文窗口填满时发出警告,并建议在自动压缩抹去会话决定前用 /save-context 保存它们。

mutlumehmet@mutlumehmet

mutlumehmet/claude-plugins/tree/main/plugins/context-alarm

原帖图片1
已翻译

关于这个 mod

context-alarm

一个 Claude Code mod,在上下文窗口快满时发出警告,并建议在自动 compaction 将会话决定总结掉之前,用 /save-context 保存它们。它属于 claude-plugins。

What it does

  • 达到 80%(warn_percent 设置,范围 50 到 95):显示通知、提示词下方的状态行(Context 83% · /save-context suggested),并在空提示框中建议 /save-context。
  • 再高 10 个百分点:再显示一次自动 compaction 即将发生的通知。
  • 自动 compaction 前如果尚未保存:显示最后一次通知,但 compaction 仍会运行。
  • /save-context 运行后:停止建议,状态行也会说明这一点。
  • /context-alarm:显示上下文填充量和阈值。

它会从同一 marketplace 安装提供 /save-context 的 project-workflow 作为依赖。

What it reads and does

  • Reads:上下文窗口有多满、/save-context 是否运行,以及自动 compaction 何时开始。
  • Does:通知、提示词下方的状态行,以及空提示框中的 /save-context 建议。它不会自行运行 save-context。
  • Hooks:skill.prompt 只记录 save-context 已运行并原样传递 skill 的提示;session.compact 只发警告,压缩仍会运行;command.run 只回答自己的 /context-alarm 命令。
  • Privacy:见 PRIVACY.md。
  • Never:不向任何地方发送内容,不进行网络调用或遥测。

Install

需要 Claude Code 2.1.287 或更高版本(mods),已在 2.1.289 测试。

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install context-alarm@mehmetmutlu

mod 在 Claude Code 权限下运行。安装前先阅读代码。

Known gaps

  • 跨过阈值的那个回合可能错过提示词建议(新的百分比在回合结束后才到达),但通知和状态行仍会显示。
  • 如果一个回合同时越过两个阈值,只显示第二个通知。
  • VS Code chat panel 中不会绘制内容。

About

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Made by Mehmet Mutlu,属于 claude-plugins。更多作品见 mehmetmutlu.dev。

License

MIT

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add mutlumehmet/claude-plugins
claude plugin install context-alarm
原文 / README

context-alarm

A Claude Code mod that warns when the context window fills up and suggests saving the session's decisions with /save-context before automatic compaction summarises them away. Part of claude-plugins.

What it does

  • At 80% (the warn_percent setting, 50 to 95): a notice, a status line under the prompt (Context 83% · /save-context suggested) and /save-context suggested in the empty prompt box.
  • 10 points higher: one more notice that automatic compaction is close.
  • Before an automatic compaction without a save: a last notice. The compaction still runs.
  • After /save-context runs: the suggestions stop and the status line says so.
  • /context-alarm: shows how full the context is and the thresholds.

It installs project-workflow from the same marketplace as a dependency, which provides /save-context.

What it reads and does

  • Reads: how full the context window is, whether /save-context ran, and when an automatic compaction starts.
  • Does: notices, a status line under the prompt, and /save-context suggested in the empty prompt box. It never runs save-context itself.
  • Hooks: skill.prompt (save-context only) notes that it ran and passes the skill's prompt on unchanged. session.compact only warns; the compaction still runs. command.run answers its own /context-alarm command and no other.
  • Privacy: see PRIVACY.md.
  • Never: sends anything anywhere (no network calls, no telemetry).

Install

Needs Claude Code 2.1.287 or later (mods). Tested on 2.1.289.

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install context-alarm@mehmetmutlu

A mod runs inside Claude Code with your permissions. Read the code before you install any mod.

Known gaps

  • On the turn that crosses the threshold the prompt suggestion can be missed (the new percent arrives after the turn ends); the notice and status line still show.
  • If one turn jumps past both thresholds, only the second notice shows.
  • Nothing is drawn in the VS Code chat panel.

About

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Made by Mehmet Mutlu, part of claude-plugins. More of his work at mehmetmutlu.dev.

License

MIT

更多类似作品