strategic-compact
Skill2k starsChanged 9 months agoMITView on GitHub
建议在逻辑间隔进行手动上下文压缩(Context Compaction),以便在任务阶段中保留上下文,而不是依赖任意的自动压缩。
40 other projects use a version of this, 1 of them edited.
Trending
Quiet since October.thin dataabout the whole repository
Most recently taken up by
- NTPhat0322/claude-skillstheir own version, first seen Sep 28, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- arfar-x/agent-skillstheir own version, first seen Sep 7, 2026
- best-radar/bradar-everything-claude-codetheir own version, first seen Sep 6, 2026
- tarrragon/claude-skillstheir own version, first seen Sep 1, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Who's talking about xu-xiang/everything-claude-code-zh
The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.
Used with
Projects with it also use kotlin-testing, ralphinho-rfc-pipeline and 5 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 6 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
mryeastcodeSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 5 projects that use this
InfopibeSkillcarrier-relationship-management
Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance, allocating freight, and maintaining strategic carrier relationships. Informed by transportation managers with 15+ years experience. Includes scorecarding frameworks, RFP processes, market intelligence, and compliance vetting. Use when managing carriers, negotiating rates, evaluating carrier performance, or building freight strategies.
Also in 8 projects that use this
mryeastcodeSkillsanta-method
Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.
Also in 6 projects that use this
JamkrisSkillagent-sort
Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.
Also in 4 projects that use this
- +1 more from Infopibe
Other versions40 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- codelably/harmony-claude-code★ 4315% same
Wrote their own version · 39
- WorldFlowAI/everything-claude-code★ 4ksame name
- sangrokjung/claude-forge★ 847same name
- loulanyue/awesome-claude-notes★ 272same name
- cloudnative-co/claude-code-starter-kit★ 151same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- hellangleZ/burn-in-cceverywhere-ralph★ 112same name
- cohen-liel/hivemind★ 110same name
- Jamkris/everything-gemini-code★ 87same name
- myths-labs/muse★ 35same name
29 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository114 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
- .cursor/rules/common-agents.mdCursor rule
- .cursor/rules/common-coding-style.mdCursor rule
- .cursor/rules/common-development-workflow.mdCursor rule
- .cursor/rules/common-git-workflow.mdCursor rule
- .cursor/rules/common-hooks.mdCursor rule
- .cursor/rules/common-patterns.mdCursor rule
- .cursor/rules/common-performance.mdCursor rule
- .cursor/rules/common-security.mdCursor rule
- .cursor/rules/common-testing.mdCursor rule
- .cursor/rules/golang-coding-style.mdCursor rule
- .cursor/rules/golang-hooks.mdCursor rule
- .cursor/rules/golang-patterns.mdCursor rule
- .cursor/rules/golang-security.mdCursor rule
- .cursor/rules/golang-testing.mdCursor rule
- .cursor/rules/python-coding-style.mdCursor rule
- .cursor/rules/python-hooks.mdCursor rule
- .cursor/rules/python-patterns.mdCursor rule
- .cursor/rules/python-security.mdCursor rule
- .cursor/rules/python-testing.mdCursor rule
- .cursor/rules/swift-coding-style.mdCursor rule
- .cursor/rules/swift-hooks.mdCursor rule
- .cursor/rules/swift-patterns.mdCursor rule
- .cursor/rules/swift-security.mdCursor rule
- .cursor/rules/swift-testing.mdCursor rule
- .cursor/rules/typescript-coding-style.mdCursor rule
- .cursor/rules/typescript-hooks.mdCursor rule
- .cursor/rules/typescript-patterns.mdCursor rule
- .cursor/rules/typescript-security.mdCursor rule
- .cursor/rules/typescript-testing.mdCursor rule
- api-designSkill
- article-writingSkill
- backend-patternsSkill
- coding-standardsSkill
- content-engineSkill
- e2e-testingSkill
- eval-harnessSkill
- frontend-patternsSkill
- frontend-slidesSkill
- investor-materialsSkill
- investor-outreachSkill
- market-researchSkill
- security-reviewSkill
- tdd-workflowSkill
- verification-loopSkill
- oneskillSkill
- article-writingSkill
- content-engineSkill
- frontend-slidesSkill
- investor-materialsSkill
- investor-outreachSkill
- market-researchSkill
- api-designSkill
- article-writingSkill
- autonomous-loopsSkill
- backend-patternsSkill
- The first 60 shown.
The file
Files
策略性压缩(Strategic Compact)技能
建议在工作流的策略点手动执行 /compact 命令,而不是依赖任意的自动压缩(Auto-compaction)。
何时启用
- 运行接近上下文限制(200K+ tokens)的长会话(Long Sessions)时
- 处理多阶段任务(研究 → 规划 → 实现 → 测试)时
- 在同一会话中切换到不相关的任务时
- 完成重大里程碑(Milestone)并开始新工作后
- 当响应变慢或连贯性下降(上下文压力)时
为什么要进行策略性压缩?
自动压缩在任意点触发:
- 通常在任务中间,导致重要上下文丢失
- 缺乏对逻辑任务边界的感知
- 可能会中断复杂的多步骤操作
逻辑边界处的策略性压缩:
- 在探索之后,执行之前 —— 压缩研究上下文,保留实现方案
- 完成里程碑之后 —— 为下一阶段提供全新的开始
- 重大上下文转移之前 —— 在开始不同任务前清除探索上下文
工作原理
suggest-compact.js 脚本在 PreToolUse(Edit/Write)钩子(Hook)上运行,并且:
- 跟踪工具调用 —— 统计会话中的工具调用(Tool Calls)次数
- 阈值检测 —— 在达到可配置的阈值(默认:50 次调用)时提出建议
- 定期提醒 —— 达到阈值后,每隔 25 次调用提醒一次
钩子配置(Hook Setup)
添加到你的 ~/.claude/settings.json 中:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
},
{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "node ~/.claude/skills/strategic-compact/suggest-compact.js" }]
}
]
}
}配置
环境变量:
COMPACT_THRESHOLD—— 第一次建议前的工具调用次数(默认:50)
压缩决策指南
使用下表来决定何时压缩:
| 阶段转换 | 是否压缩? | 原因 |
| 研究 → 规划 | 是 | 研究上下文很臃肿;方案是提炼后的产出 |
| 规划 → 实现 | 是 | 方案已在 TodoWrite 或文件中;为代码腾出上下文空间 |
| 实现 → 测试 | 可能 | 如果测试引用了近期代码则保留;如果切换关注点则压缩 |
| 调试 → 下一功能 | 是 | 调试追踪(Debug traces)会污染不相关工作的上下文 |
| 实现中 | 否 | 丢失变量名、文件路径和部分状态的代价很高 |
| 方案失败后 | 是 | 在尝试新方案前清除死胡同式的推理 |
压缩后保留的内容
了解哪些内容会持久化,有助于你充满信心地进行压缩:
| 保留 | 丢失 |
CLAUDE.md 指令 | 中间推理和分析 |
TodoWrite 任务列表 | 之前读取过的文件内容 |
记忆文件(~/.claude/memory/) | 多步骤对话上下文 |
| Git 状态(提交、分支) | 工具调用历史和计数 |
| 磁盘上的文件 | 口头陈述的细微用户偏好 |
最佳实践
- 规划完成后压缩 —— 一旦方案在
TodoWrite中确定,就进行压缩以全新开始 - 调试完成后压缩 —— 在继续之前清除错误解决上下文
- 不要在实现过程中压缩 —— 保留相关更改的上下文
- 阅读建议 —— 钩子告诉你何时,你决定是否
- 压缩前写入 —— 在压缩前将重要上下文保存到文件或记忆中
- 使用带有总结的 /compact —— 添加自定义消息:
/compact 下一步重点实现认证中间件
相关内容
- 长篇指南(The Longform Guide) —— 令牌(Token)优化章节
- 记忆持久化钩子(Memory persistence hooks) —— 用于压缩后仍保留的状态
continuous-learning技能 —— 在会话结束前提取模式
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

