一键导入
strategic-compact
上下文优化技能,通过 trigger-based 懒加载和 context composition awareness 自动重组长会话上下文。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
上下文优化技能,通过 trigger-based 懒加载和 context composition awareness 自动重组长会话上下文。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Goal-oriented autonomous loop with external completion oracle. Keeps iterating until verifiable stopping conditions are met, checked by a separate model.
Scheduled discovery automation that runs scans on a heartbeat interval, classifies findings, and routes them to goals or triage inbox.
Active MCP connector polling that integrates external tools (issue trackers, error monitoring, CI) into the heartbeat loop for cross-system discovery.
Structured rework with git blame attribution for failed goal iterations. Maps failures to responsible changes and routes targeted fix briefs.
将 CodeGraph 作为默认内置 MCP-backed 代码图谱能力接入,用于 brownfield 符号搜索、 调用链、影响面和上下文查询。输出必须回落到 `/team-*` 主链和 artifacts。
Use Open Design as an external local-first design workbench for prototypes, decks, mobile screens, dashboards, DESIGN.md systems, and exportable visual artifacts. Keep TSP responsible for team workflow, handoff, and quality gates.
| name | strategic-compact |
| description | 上下文优化技能,通过 trigger-based 懒加载和 context composition awareness 自动重组长会话上下文。 |
| origin | adapted from ECC |
上下文优化技能,通过 trigger-based 懒加载和 context composition awareness 自动重组长会话上下文。
Claude Code 默认由原生 auto-compact 决定压缩时机;下列百分比 trigger 只用于手动兜底模式:
| Trigger | 条件 | 行为 |
|---|---|---|
context_65% | 上下文使用 > 65% | 触发 advisory 压缩建议 |
context_70% | 上下文使用 > 70% | 触发压缩建议 |
context_85% | 上下文使用 > 85% | 强烈建议手动压缩 |
logical_break | 检测到逻辑断点 | 建议整理 |
specialist_done | specialist 完成 | 归档输出 |
理解上下文不同部分的价值:
高价值(总是保留):
中等价值(根据大小决定):
低价值(安全丢弃):
提取所有决策,保存到 ~/.claude/memory/error_experience/decisions/
提取 pending items 和 next hints,保存到 session summary
保留系统提示和最近 20 轮对话,压缩中间部分
将长工具输出替换为摘要:[File X read, Y lines]
| Skill | 关系 |
|---|---|
| Memory Persistence | Strategic Compact 使用其存储来保存决策和摘要 |
| Error Experience Library | 从压缩的上下文中提取错误模式 |
| Continuous Learning | Instincts 从归档的上下文中生成 |
用户:连续工作 2 小时后
Claude Code:上下文接近原生 auto-compact 阈值
系统:触发 PreCompact(auto),保存 compact 轮次并清理旧计量缓存
Claude Code:自动执行压缩
系统:下一轮只读取压缩后的新 usage,不复用压缩前的高水位
用户:运行 /code-review
Specialist:输出详细代码审查报告
系统:检测到 specialist_done trigger
系统:提取关键结论,丢弃详细追踪
系统:保存结论到 memory store
scripts/lib/context-window.js 统一计算上下文压力。context_window.used_percentage / remaining_percentage 是官方预计算值,直接使用,不再重复扣除 auto-compact buffer;context_window_size 用于区分 200K 与 1M 窗口。ccometixline.context_window.remaining_percentage、ccometixline_context_window.remaining_tokens、TSP_CONTEXT_WINDOW_JSON 或 CCOMETIXLINE_CONTEXT_FILE。context_window、transcript JSONL usage、bridge file 和 transcript size fallback。scripts/hooks/pre-compact.js 同时匹配 auto|manual,每次 PreCompact 会递增 .tsp/context/compact-state.json 的 session / total compact count,并清除压缩前的 bridge / debounce 状态。suggest-compact.js 默认 auto 模式,不注入人工 /compact 提示;仅在 DISABLE_AUTO_COMPACT=1 或 STRATEGIC_COMPACT_MODE=manual 时启用下表的手动兜底。| 使用率 | 紧迫度 | 建议操作 |
|---|---|---|
| < 65% | low | 无需操作 |
| 65-70% | advisory | 提醒控制上下文增长 |
| 70-85% | medium | 建议压缩,可选择性执行 |
| 85-95% | high | 强烈建议压缩 |
| > 95% | critical | 必须立即压缩 |
/compact - 手动触发压缩/compact status - 显示当前上下文使用率/compact plan - 显示压缩计划而不执行