AgentSkillsCN

strategic-compact

基于策略性压缩建议的智能上下文窗口管理。实时监测上下文使用情况,并在逻辑节点处适时发出 /compact 建议。在压缩前保存当前状态,以备后续恢复之需。

SKILL.md
--- frontmatter
name: strategic-compact
description: |
  Intelligent context window management with strategic compaction suggestions.
  Monitors context usage and suggests /compact at logical boundaries. Saves
  state before compaction to enable recovery.

Strategic Compact Skill

Optimize context window usage through intelligent compaction timing.

Warning Thresholds

LevelUsageAction
Info50%Monitor
Warning70%Suggest compact soon
Critical85%Urgent compaction needed
Danger95%Immediate compaction

Good Times to Compact

  • ✅ After completing a feature/task
  • ✅ Before starting new unrelated work
  • ✅ After successful verification
  • ✅ At natural conversation breaks

Bad Times to Compact

  • ❌ Mid-debugging session
  • ❌ During multi-file refactoring
  • ❌ When tracking complex state

Pre-Compaction Workflow

  1. State Capture - Save current task context
  2. Save State - Write to pre-compact-state.yaml
  3. Generate Summary - Create session summary
  4. Execute Compaction - /compact --preserve-state

Post-Compaction Recovery

bash
/resume --from-compact

Loads pre-compact-state.yaml and restores context.