在任务关键阶段建议手动压缩上下文,帮助连续保留思路与工作记忆。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "strategic-compact" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/strategic-compact/SKILL.md 2. 保存为 ~/.claude/skills/strategic-compact/SKILL.md 3. 装好后重载技能,告诉我可以用了
当我们从需求分析进入方案设计时,请先帮我做一次手动上下文压缩,保留目标、关键约束、已确认结论和待解决问题。
一份精炼的阶段摘要,便于在新阶段继续推进且不丢失关键背景。
请在开始下一轮编码前压缩当前对话上下文,整理已完成模块、接口约定、遗留 bug 和下一步优先事项。
结构化的开发进度摘要,可直接作为后续实现的上下文输入。
请在进入文献对比阶段前,手动压缩前面的讨论内容,提炼研究目标、核心发现、证据来源与后续验证方向。
一份面向下一研究阶段的上下文摘要,减少信息遗漏和重复沟通。
Suggests manual /compact at strategic points in your workflow rather than relying on arbitrary auto-compaction.
Auto-compaction triggers at arbitrary points:
Strategic compaction at logical boundaries:
The suggest-compact.js script runs on PreToolUse (Edit/Write) and:
Add to your ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
},
{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "node ~/.claude/scripts/hooks/suggest-compact.js" }]
}
]
}
}
Environment variables:
COMPACT_THRESHOLD — Tool calls before first suggestion (default: 50)Use this table to decide when to compact:
| Phase Transition | Compact? | Why |
|---|---|---|
| Research → Planning | Yes | Research context is bulky; plan is the distilled output |
| Planning → Implementation | Yes | Plan is in TodoWrite or a file; free up context for code |
| Implementation → Testing | Maybe | Keep if tests reference recent code; compact if switching focus |
| Debugging → Next feature | Yes | Debug traces pollute context for unrelated work |
| Mid-implementation | No | Losing variable names, file paths, and partial state is costly |
| After a failed approach | Yes | Clear the dead-end reasoning before trying a new approach |
Understanding what persists helps you compact with confidence:
| Persists | Lost |
|---|---|
| CLAUDE.md instructions | Intermediate reasoning and analysis |
| TodoWrite task list | File contents you previously read |
Memory files (~/.claude/memory/) | Multi-step conversation context |
| Git state (commits, branches) | Tool call history and counts |
| Files on disk | Nuanced user preferences stated verbally |
/compact with a summary — Add a custom message: /compact Focus on implementing auth middleware nextInstead of loading full skill content at session start, use a trigger table that maps keywords to skill paths. Skills load only when triggered, reducing baseline context by 50%+:
| Trigger | Skill | Load When |
|---|---|---|
| "test", "tdd", "coverage" | tdd-workflow | User mentions testing |
| "security", "auth", "xss" | security-review | Security-related work |
…
帮助用户在代码仓库中识别可远程利用、具备漏洞赏金价值的安全问题。
帮助创业者撰写融资冷邮件、跟进信与面向投资人的沟通文案
使用 Exa 神经搜索进行网页、代码、公司与人物的深度研究检索。
提供 PyTorch 深度学习模式与最佳实践,帮助构建高效可复现的训练流程。
系统审查 Flutter 与 Dart 代码质量,覆盖架构、性能、可访问性与安全实践
帮助开发者在 iOS 26+ 中集成端侧大模型生成、工具调用与流式输出。
压缩上下文并持久化任务检查点,显著降低 AI 代理 token 消耗
为大模型对话提供上下文压缩,在保真前提下降低 token 消耗。
为大模型无损压缩文本,节省2到8倍上下文token并可精确还原。
本地优先保存跨会话事实与偏好,帮助 AI 更省 token 地续接上下文
记录并恢复智能体上下文,支持分发上下文包与签名回执。
将大型代码库转为可检索的语义特征图,帮助开发者高精度理解与定位代码上下文。