360 Secure SkillHub
360 安全技能中心

strategic-compact

提供长会话中的手动上下文压缩流程:在探索、调试或任务切换等逻辑边界先保存关键发现和 git 进度,再使用 /compact 继续工作;包含压缩指南、工具集成说明和辅助脚本。实际压缩动作依赖宿主斜杠命令。

分类:效率
djc00p
djc00p
热度 36.40
最近更新 2026-11-05 03:43:25

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add djc00p/strategic-compact
兼容性
Claude Code 专属
联网要求
不联网
数据出网
数据不出本机
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"],"version":"1.0.2"}}

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)