Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/skymanbp/cc-enforcer/gcgit clone --depth 1 https://github.com/skymanbp/cc-enforcerWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00060 | $0.01096 |
| Opus 5 | $0.00030 | $0.00548 |
| Sonnet 5 | $0.00012 | $0.00219 |
| Haiku 4.5 | $0.00006 | $0.00110 |
Grade A, and why
gc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/cc-enforcer:gc
长期使用插件后,
${CLAUDE_PLUGIN_DATA}/sessions/下会累积每会话一个 JSON 状态文件。每个文件几 KB,但数量积起来值得清理。本命令调用hooks/scripts/gc_state.py按 mtime 阈值 列出 / 删除老旧 state。
安全默认
本命令默认替你补 --dry-run(只打印不删除),要真正删除必须显式改成
--apply。注意"默认"只存在于本命令这一层:gc_state.py 自己要求
--dry-run / --apply 恰好传一个,一个都不传(或两个都传)它会打印
gc_state: pass exactly one of --dry-run or --apply 并 exit 1,而不是退回
dry-run —— 无标志时永不删除,是靠"拒绝执行"实现的。
mtime 是该会话状态最近一次被写入的时间戳 —— 不只是 Read:记录编辑、
Stop 拦截、滚动补丁计数、mtime 基线、同步 ack 等九个以上的 mutator 都会
刷新它。所以一个只改文件、不读新文件的会话同样是"活跃"的。30 天没有任何
写入的,几乎肯定是已死会话。
你(receiving agent)要做的
按用户传入的参数构造 Bash 调用:
python "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/gc_state.py" --dry-run --older-than 30
或:
python "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/gc_state.py" --apply --older-than 30
参数解释:
--dry-run/--apply:互斥,且必须恰好传一个;都不传 → exit 1(不是 隐式 dry-run)。用户没说要删时,本命令替他传--dry-run。--older-than DAYS:阈值(天数)。默认 30。
输出契约
脚本始终打印:
state_dir: <path>
scanned: <N>
threshold: <M> days
eligible: <K>
[dry-run] would delete: <name> (<age>d old, <size>B) | deleted: <name>
...
deleted: <K> | would delete: <K>
bytes_freed: <B> | would free: <B>B
用户场景
用户:"/gc 看看" → dry-run, 默认 30 天
用户:"/gc 看看 90 天的" → dry-run, --older-than 90
用户:"/gc 真的删 30 天的" → --apply --older-than 30
如果 eligible 为 0 → 报告 "nothing to do" 即可。
禁止
- ❌ 不传任何参数就直接
--apply—— 始终先 dry-run 让用户看清楚再问。 - ❌ 删除
${CLAUDE_PLUGIN_DATA}/sessions/之外的任何文件 —— 脚本本身有 这道防线(只 glob<state_dir>/*.json),不要绕过它。
自动 GC(v0.18 · opt-in)
设置环境变量 CC_ENFORCER_AUTO_GC_DAYS=N(正整数)即可让 SessionStart
钩子在每次开会话时自动删除 ≥ N 天未触碰的 state 文件。受 24h 速率限制
(marker 文件 <state_dir>/_auto_gc.json),不会每次开会话都重扫。
# Bash / Linux / macOS
export CC_ENFORCER_AUTO_GC_DAYS=30
# PowerShell
$env:CC_ENFORCER_AUTO_GC_DAYS = "30"
[Environment]::SetEnvironmentVariable("CC_ENFORCER_AUTO_GC_DAYS", "30", "User") # 持久化
未设置 / 设为 0 / 设为非数字 → 自动 GC 完全禁用(默认)。失败 →
silent stderr,永不阻塞 SessionStart 注入。/cc-enforcer:gc 手动命令
仍然完全可用,两个入口共用同一份 prune_old_sessions()。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 93 lines · 60 tokens per session scan A 43ab5a503570
gc is a command published in the GitHub repository skymanbp/cc-enforcer (5 stars, last pushed 7d ago), licensed MIT. It adds 60 tokens to every session and 1,096 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
brooks-audit
Run a Brooks-Lint architecture audit.
todo
The quality-gated task list: tasks with real descriptions, testable acceptance criteria, and evidence — a task only closes when the controller agrees it is done.
release
The pre-tag controller: version sync, changelog, clean tree, gate, and suite — every failure listed, the tag printed, never run.
security
The security pass: secrets (blocking), SAST, dependency vulns — plus the index's entry points to review from.
git
The pre-finish status: branch, hygiene findings, message checks, workflow lint, template state.
init
Install the formatters this repository needs, with every command visible before it runs.