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 skills/codelably/harmony-claude-code/strategic-compactnpx skills add codelably/harmony-claude-code --skill strategic-compactgit clone --depth 1 https://github.com/codelably/harmony-claude-codeWhat 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.00027 | $0.00614 |
| Opus 5 | $0.00014 | $0.00307 |
| Sonnet 5 | $0.00005 | $0.00123 |
| Haiku 4.5 | $0.00003 | $0.00061 |
Grade B, and why
strategic-compact scanned grade B with 1 finding 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
新增到你的 `~/.claude/settings.json`: What it actually says
策略性壓縮技能
在工作流程的策略點建議手動 /compact,而非依賴任意的自動壓縮。
為什麼需要策略性壓縮?
自動壓縮在任意點觸發:
- 經常在任務中途,丟失重要上下文
- 不知道邏輯任務邊界
- 可能中斷複雜的多步驟操作
邏輯邊界的策略性壓縮:
- 探索後、執行前 - 壓縮研究上下文,保留實作計畫
- 完成里程碑後 - 為下一階段重新開始
- 主要上下文轉換前 - 在不同任務前清除探索上下文
運作方式
suggest-compact.sh 腳本在 PreToolUse(Edit/Write)執行並:
- 追蹤工具呼叫 - 計算工作階段中的工具呼叫次數
- 門檻偵測 - 在可設定門檻建議(預設:50 次呼叫)
- 定期提醒 - 門檻後每 25 次呼叫提醒一次
Hook 設定
新增到你的 ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "tool == \"Edit\" || tool == \"Write\"",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
}]
}]
}
}
設定
環境變數:
COMPACT_THRESHOLD- 第一次建議前的工具呼叫次數(預設:50)
最佳實務
- 規劃後壓縮 - 計畫確定後,壓縮以重新開始
- 除錯後壓縮 - 繼續前清除錯誤解決上下文
- 不要在實作中途壓縮 - 為相關變更保留上下文
- 閱讀建議 - Hook 告訴你何時,你決定是否
相關
- Longform Guide - Token 優化章節
- 記憶持久性 hooks - 用於壓縮後存活的狀態
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 · 64 lines · 27 tokens per session scan B 5361c102d922
strategic-compact is a skill published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 27 tokens to every session and 614 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
auto-perf-optimize
Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.
chat-perf
Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…