Claude Capacity Guard — Development skill for Claude Code
Native Claude Code quota guard: pause long-running tasks before quota runs low and continue after reset.
How to install Claude Capacity Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open whiteCcinn/claude-capacity-guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Capacity Guard does
Native Claude Code quota guard: pause long-running tasks before quota runs low and continue after reset.
Alternatives in Development
- Life Sciences — Repo for the Claude Code Marketplace to use with the Claude for Life Sciences Launch 308 ★
- Claude Code CLI Windows Machine Id Reset — Claude Code CLI Windows Native Installer — Standalone Windows 10/11 (x64) local CUDA 12.8 / FP8 / GGUF inferen 208 ★
- Mem Save — Save a curated session-level summary to history 186 ★
README
Claude Capacity Guard
[English](README.en.md) · 简体中文
为保持打开的 Claude Code 交互式会话增加额度守卫:剩余额度低于阈值时暂停,额度窗口可用后,在原会话自动提交一次继续指令。
默认阈值为 **剩余 10%**,重置后缓冲 **60 秒**,等待期间每 **30 秒**检查原生额度快照,自动发送的文本默认为 **`continue`**。通过 Claude Code Mods API 实现,无需单独的 API Key、OAuth 凭据读取或用量查询服务。
安装
在系统终端执行:
claude plugin marketplace add whiteCcinn/claude-capacity-guard
claude plugin install capacity-guard@claude-capacity-guard
已有 Claude 会话运行 `/reload-plugins`,或重新打开会话。验证基线是 **Claude Code 2.1.325**;其他版本和界面见[兼容性说明](docs/compatibility.md)。
| 标识 | 名称 |
|---|---|
| GitHub 项目 / marketplace | claude-capacity-guard |
| 插件名 | capacity-guard |
| 完整安装 ID | capacity-guard@claude-capacity-guard |
| 源码加载配置 ID | capacity-guard@inline |
使用和配置
在 Claude 会话中输入:
/capacity
/capacity cancel
/plugin configure capacity-guard@claude-capacity-guard
`/capacity` 查看额度快照及等待状态,`/capacity cancel` 取消本次自动恢复。接受新的用户消息也会取消旧任务的恢复记录;如果额度仍低,新任务会重新触发暂停。取消等待不等于关闭守卫,持续关闭请修改 `enabled` 或禁用插件。
| 配置 | 默认值 | 作用 |
|---|---|---|
enabled |
true |
启用额度检查 |
remaining_threshold |
10 |
剩余百分比严格低于阈值时暂停,范围 0–99;0 表示耗尽时暂停 |
reset_buffer_seconds |
60 |
在重置时间后额外等待 1–3600 秒 |
check_interval_seconds |
30 |
每 5–300 秒检查原生缓存,不主动刷新服务器额度 |
resume_text |
continue |
自动恢复时发送的完整文本,可改为“继续”或自定义指令 |
例如设为 `20`,剩余低于 20% 时暂停,恰好 20% 时允许请求。保存配置后按提示重新加载插件。命令行配置、更新、卸载见[配置文档](docs/configuration.md)。
在配置中的「自动继续文本」填写 `continue` 或“继续”,插件恢复时就发送该文本,不附加原来的长提示。它控制自动发出的内容,不是对外部消息增加一套关键词匹配规则。
工作原理
flowchart LR
A[模型请求即将发送] --> B[读取原生额度快照]
B --> C{有窗口低于阈值?}
C -- 否 --> D[允许本次请求]
C -- 是 --> E[保存记录并停止主轮次]
E --> F[后台定时器等待]
F --> G{仍有阻塞窗口?}
G -- 是 --> F
G -- 否 --> H[向原会话提交一次继续指令]
H --> A
检查的是 `$.session.usage().rateLimits` 中的 `percentUsed`、`kind` 和 `resetsAt`,不是上下文窗口占用或本地 token 累计。所有已报告的额度窗口都会参与判断。若短周期和周额度同时不足,就等待较晚的重置时间加缓冲;新读数显示额度已足够时也可提前恢复。
暂停会结束当前主轮次。继续时,Claude 根据原有会话历史、工具结果和文件改动接着执行。插件不重放工具调用,也不会在有执行预算的钩子里等待几个小时。[架构文档](docs/architecture.md)解释状态机
Related Skills
Limit Resume
Claude Code mod: checkpoint before the usage limit, continue the session by itself after the reset
Modeldeck
macOS menu bar app that tracks usage limits across all your Claude Code and Codex CLI accounts — live "% left"
SmartCompact
Compact long coding-agent sessions earlier, at a pause after a finished piece of work, to cut cost without los
Quota Monitor
Native macOS menu-bar app for Codex and Claude Code quotas, reset times, and usage trends.
Claude Usage Guard
Pause Claude before its next tool call when your 5-hour or weekly plan usage runs hot with lots of window left
Limit Upcoming
0-Token local evidence bundle generator and proactive handoff guard before hitting 429 quota limits
Related Agents
Indexeddb Expert
IndexedDB storage expert. Use for the scan library schema, versions and migrations, transactions, storing imag
Supabase Auth Engineer
Owns authentication with Supabase: email/password, Continue with Google, password reset, sessions, the profile
Test Fable Low
Test agent for the statusline agent panel; runs a 60-second pause and reports.