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/xiaobei930/cc-best/compact-contextgit clone --depth 1 https://github.com/xiaobei930/cc-bestWhat 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.00009 | $0.00981 |
| Opus 5 | $0.00005 | $0.00491 |
| Sonnet 5 | $0.00002 | $0.00196 |
| Haiku 4.5 | $0.00001 | $0.00098 |
Grade A, and why
compact-context 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 2d 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 — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/compact-context - 上下文压缩
智能压缩当前对话上下文,保留关键信息,释放 token 空间。
⚠️ 重要提示:官方 auto-compact 有已知 bug,建议在上下文 70% 时主动执行压缩。 详见:#18211、#21853
使用场景
- 对话过长,响应变慢
- 完成一个大功能后,准备开始新功能
- 上下文中有大量已完成任务的冗余讨论
- 上下文使用率接近 70%(避免触发官方 bug)
执行流程
1. 状态保存(必须)
在压缩前,确保以下信息已持久化到文件:
□ 当前任务状态 → progress.md
□ 重要决策 → progress.md 决策记录表
□ 待确认假设 → progress.md 待确认列表
□ 未完成的代码变更 → 已保存到文件
2. 生成压缩摘要
创建 memory-bank/_compact_summary.md(临时文件):
# 上下文压缩摘要
## 会话概述
- 开始时间: [时间]
- 主要目标: [目标]
- 完成状态: [X/Y 任务完成]
## 关键决策
1. [决策1]: [原因]
2. [决策2]: [原因]
## 当前状态
- 正在进行: [任务]
- 阻塞项: [如有]
## 重要发现
- [发现1]
- [发现2]
## 下一步
- [待办1]
- [待办2]
3. 压缩策略
| 保留 | 移除 |
|---|---|
| 当前任务上下文 | 已完成任务的详细讨论 |
| 关键决策和原因 | 冗余的代码展示 |
| 待办事项 | 探索性的失败尝试 |
| 错误和解决方案 | 重复的文件读取 |
| 架构约束 | 已解决的问题讨论 |
4. 执行压缩
- 更新
progress.md的last_checkpoint字段 - 输出压缩摘要
- 提示用户执行
/clear
与官方命令的区别
| 命令 | 来源 | 行为 | 适用场景 |
|---|---|---|---|
/clear |
官方 | 完全清除上下文 | 任务完成,开始新任务 |
官方 /compact |
官方 | 自动压缩(有 bug) | 不推荐使用 |
本插件 compact-context |
本插件 | 保存状态 + 生成摘要 | 压缩前的准备工作 |
本插件 catchup |
本插件 | 恢复上下文 | /clear 后恢复 |
命令格式说明:根据安装方式不同,命令格式也不同:
- 通过
/plugin install安装:使用/cc-best:compact-context、/cc-best:catchup- 直接 clone 到
.claude/:使用/cc-best:compact-context、/cc-best:catchup
输出格式
## 上下文压缩完成
### 已保存
- ✓ 进度状态 → progress.md
- ✓ 决策记录 → progress.md
- ✓ 压缩摘要 → _compact_summary.md
### 压缩摘要
[摘要内容]
### 下一步
执行官方 `/clear` 清除对话,然后执行 `/cc-best:catchup` 恢复上下文。
注意事项
- 压缩前确保所有重要信息已保存
_compact_summary.md是临时文件,恢复后可删除- 如果正在进行关键操作,先完成再压缩
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.
- 2d ago First seen · 121 lines · 9 tokens per session scan A f8eab806b2c6
compact-context is a command published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 9 tokens to every session and 981 once invoked, about $0.0000 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-30.
Other commands, from other repositories
al
Run AgentLint diagnostic across all projects. Use when: user says /al, 'check all projects', 'agent lint', or '体检'.
tldr
Re-apply TLDR rules for this turn (verdict first, no filler).
moyu-lite
Invoke the moyu:moyu-lite skill and follow it exactly.
audit-plugin
Audit plugin skills, commands, and agents for structure, size, and naming issues.
lfe-dep-audit
Inspector sub-skill. Reviews dependency manifest files (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml) changed in the current diff for risky version patterns and stale majors. Emits a human-run audit instruction rather than executing tools. Writes .plans/checks/depfindings.md. Called by lfe-inspector…
lfe-plan-critique
Run a 5-lens pre-build critique of the approved active plan before the Builder starts. Acts as the Architect persona, read-only on src/. Writes .plans/plancritique.md. Use immediately after Brain approves activeplan.md.