Source profileQuality 71/100

affaan-m/ECC/docs/zh-CN/skills/strategic-compact/SKILL.md

strategic-compact

Review strategic-compact's use cases, installation, workflow, and original source instructions.

Source repository stars
234,327
Declared platforms
0
Static risk flags
0
Last source update
2026-07-27
Source checked
2026-07-28

Decision brief

What it does—and where it fits

建议在你的工作流程中的战略节点手动执行 /compact,而不是依赖任意的自动精简。

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/affaan-m/ECC --skill "docs/zh-CN/skills/strategic-compact"
    Safe inspection promptEditorial

    Inspect the Agent Skill "strategic-compact" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/zh-CN/skills/strategic-compact/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      何时激活

      运行长时间会话,接近上下文限制时(200K+ tokens) 处理多阶段任务时(研究 → 规划 → 实施 → 测试) 在同一会话中切换不相关的任务时 完成一个主要里程碑并开始新工作时 当响应变慢或连贯性下降时(上下文压力)

      运行长时间会话,接近上下文限制时(200K+ tokens)处理多阶段任务时(研究 → 规划 → 实施 → 测试)在同一会话中切换不相关的任务时
    2. 02

      为何采用战略精简?

      通常在任务中途,丢失重要上下文 无法感知逻辑任务边界 可能中断复杂的多步骤操作

      通常在任务中途,丢失重要上下文无法感知逻辑任务边界可能中断复杂的多步骤操作
    3. 03

      工作原理

      suggest-compact.js 脚本在 PreToolUse (Edit/Write) 时运行,并且:

      跟踪工具调用 — 统计会话中的工具调用次数阈值检测 — 在可配置的阈值处建议压缩(默认:50次调用)定期提醒 — 达到阈值后,每25次调用提醒一次

    Permission review

    Static risk signals and limitations

    No configured static risk pattern was detected

    This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score71/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars234,327SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guidecatalog recordEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    affaan-m/ECC
    Skill path
    docs/zh-CN/skills/strategic-compact/SKILL.md
    Commit
    4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
    License
    MIT
    Collected
    2026-07-28
    Default branch
    main
    View the original SKILL.md

    战略精简技能

    建议在你的工作流程中的战略节点手动执行 /compact,而不是依赖任意的自动精简。

    何时激活

    • 运行长时间会话,接近上下文限制时(200K+ tokens)
    • 处理多阶段任务时(研究 → 规划 → 实施 → 测试)
    • 在同一会话中切换不相关的任务时
    • 完成一个主要里程碑并开始新工作时
    • 当响应变慢或连贯性下降时(上下文压力)

    为何采用战略精简?

    自动精简会在任意时间点触发:

    • 通常在任务中途,丢失重要上下文
    • 无法感知逻辑任务边界
    • 可能中断复杂的多步骤操作

    在逻辑边界进行战略精简:

    • 探索之后,执行之前 — 压缩研究上下文,保留实施计划
    • 完成里程碑之后 — 为下一阶段重新开始
    • 在主要上下文切换之前 — 在开始不同任务前清理探索上下文

    工作原理

    suggest-compact.js 脚本在 PreToolUse (Edit/Write) 时运行,并且:

    1. 跟踪工具调用 — 统计会话中的工具调用次数
    2. 阈值检测 — 在可配置的阈值处建议压缩(默认:50次调用)
    3. 定期提醒 — 达到阈值后,每25次调用提醒一次

    钩子设置

    作为插件安装? 无需任何设置。插件的 hooks/hooks.json 已经注册了 suggest-compact.js(钩子 ID pre:edit-write:suggest-compact,在 standardstrict 钩子配置档中生效)。不要把下面的代码块复制到 ~/.claude/settings.json — 插件安装中不存在 ~/.claude/scripts/,并且重复注册插件钩子会导致双重执行。

    如果是手动安装./install.sh),添加到你的 ~/.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" }]
          }
        ]
      }
    }
    

    配置

    环境变量:

    • COMPACT_THRESHOLD — 首次建议前的工具调用次数(默认:50)

    压缩决策指南

    使用此表来决定何时压缩:

    阶段转换压缩?原因
    研究 → 规划研究上下文很庞大;规划是提炼后的输出
    规划 → 实施规划已保存在 TodoWrite 或文件中;释放上下文以进行编码
    实施 → 测试可能如果测试引用最近的代码则保留;如果要切换焦点则压缩
    调试 → 下一项功能调试痕迹会污染不相关工作的上下文
    实施过程中丢失变量名、文件路径和部分状态代价高昂
    尝试失败的方法之后在尝试新方法之前,清理掉无效的推理过程

    压缩后保留的内容

    了解哪些内容会保留有助于您自信地进行压缩:

    保留的内容丢失的内容
    CLAUDE.md 指令中间的推理和分析
    TodoWrite 任务列表您之前读取过的文件内容
    记忆文件 (~/.claude/memory/)多轮对话的上下文
    Git 状态(提交、分支)工具调用历史和计数
    磁盘上的文件口头陈述的细微用户偏好

    最佳实践

    1. 规划后压缩 — 一旦计划在 TodoWrite 中最终确定,就压缩以重新开始
    2. 调试后压缩 — 在继续之前,清理错误解决上下文
    3. 不要在实施过程中压缩 — 为相关更改保留上下文
    4. 阅读建议 — 钩子告诉您何时,您决定是否
    5. 压缩前写入 — 在压缩前将重要上下文保存到文件或记忆中
    6. 使用带摘要的 /compact — 添加自定义消息:/compact Focus on implementing auth middleware next

    令牌优化模式

    触发表惰性加载

    不在会话开始时加载完整的技能内容,而是使用一个将关键词映射到技能路径的触发表。技能仅在触发时加载,可将基线上下文减少 50% 以上:

    触发词技能加载时机
    "test", "tdd", "coverage"tdd-workflow用户提及测试时
    "security", "auth", "xss"security-review涉及安全相关工作时
    "deploy", "ci/cd"deployment-patterns涉及部署上下文时

    上下文组合感知

    监控哪些内容正在消耗你的上下文窗口:

    • CLAUDE.md 文件 — 始终加载,需保持精简
    • 已加载技能 — 每个技能增加 1-5K 令牌
    • 对话历史 — 随每次交流增长
    • 工具结果 — 文件读取、搜索结果会增加体积

    重复指令检测

    常见的重复上下文来源:

    • 相同的规则同时出现在 ~/.claude/rules/ 和项目 .claude/rules/
    • 技能重复了 CLAUDE.md 的指令
    • 多个技能覆盖了重叠的领域

    上下文优化工具

    • token-optimizer MCP — 通过内容去重实现 95% 以上的自动令牌减少
    • context-mode — 上下文虚拟化(已演示从 315KB 减少到 5.4KB)

    相关

    • 长篇指南 — Token 优化部分
    • 记忆持久化钩子 — 用于在压缩后保留状态
    • continuous-learning 技能 — 在会话结束前提取模式

    Alternatives

    Compare before choosing