360 Secure SkillHub
360 安全技能中心

Strategic Compact

核心功能:替代触发时机混乱的自动上下文压缩,在逻辑工作流边界手动执行/compact命令,保留磁盘文件、项目指令、Git状态等关键内容,清除对话历史与中间推理,释放会话上下文容量。典型场景:长会话接近200K+token、多阶段任务(调研→开发等)、切换无关任务、完成里程碑后。输入为带可选说明的/compact命令,压缩后可基于持久化文件继续工作。

djc00p
djc00p
热度 57.89
最近更新 2026-05-11 17:40:29
分类:效率依赖:纯提示词应用场景:工作流 / 任务管理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add strategic-compact
Metadata
name
strategic-compact
description
Manual context compaction at logical workflow boundaries rather than arbitrary auto-compaction. Use after completing exploration phases, before switching major tasks, or when context approaches limits. Preserves context through task phases. Trigger phrases: context limit, compact, memory pressure, save context, phase transition. Adapted from everything-claude-code by @affaan-m (MIT)
metadata
{"clawdbot":{"emoji":"📦","requires":{"bins":[],"env":[]},"os":["darwin","linux","win32"]}}

Strategic Compact Skill

Manual /compact at logical workflow boundaries, not arbitrary auto-compaction points.

When to Activate

  • Running long sessions approaching context limits (200K+ tokens)
  • Multi-phase tasks (research → plan → implement → test)
  • Switching between unrelated tasks within the same session
  • After completing a major milestone before starting new work

Quick Start

  1. Identify logical phase boundaries in your work
  2. Save important findings to files before compacting
  3. Use /compact with a context message (e.g., "/compact Now implementing auth")
  4. Continue work referencing saved files, not conversation history

Key Concepts

  • Auto-compaction problem — Triggers at arbitrary points, often mid-task
  • Strategic compaction — Compact after exploration/planning, before execution
  • Persistence — Project instructions, git state, and files on disk survive; conversation history and intermediate reasoning don't
  • Checkpoint discipline — Save learnings to files; use git commits to mark progress
  • Token awareness — 150K → consider; 180K → plan; 200K+ → should have already compacted

Common Usage

Most frequent patterns:

  • Research → build (compact after documentation phase)
  • Exploration → execution (compact after CLAUDE.md is written)
  • Debug → next feature (compact after fix is committed)
  • Failed approach → new strategy (compact to clear dead-end reasoning)

References

  • references/compaction-guide.md — Decision table, what survives, patterns, token budgeting, optimization strategies
  • references/tool-integration.md — Script documentation, configuration, integration methods
  • Compaction command — /compact [optional message]
  • Status check — Check session context size before major operations
  • Memory files — Save to disk (survives compaction)
  • Git commits — Mark progress (persists across compaction)