| name | compact |
| version | 2.0.0 |
| description | [Utilities] Use when you need to compress context to optimize token usage (user-facing alias for context-optimization Strategy #3 Compress). |
| disable-model-invocation | false |
Quick Summary
Goal: Compress conversation context to optimize token usage while preserving critical information.
Workflow:
- Analyze โ Identify essential vs. expendable context
- Compress โ Remove redundant tool outputs / repeated searches / verbose logs; summarize findings
- Verify โ Ensure critical decisions, files modified, and current task state are preserved
Key Rules:
- Canonical compress protocol + the full 4-strategy framework (write/select/compress/isolate) + token thresholds live in
context-optimization โ this skill is the command surface only
- Preserve: decisions made, files modified, current task state, error/stack traces, todos
- Use
/compact at natural breakpoints (after commits, PR), not mid-task
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
Compact Context
Proactively compress the current conversation context to optimize token usage. This is the user-invocable alias for context-optimization's Compress strategy.
When to Use
- Before starting a new task in a long session
- When working on multiple unrelated features
- At natural workflow checkpoints (after commits, PR creation)
- When the context indicator shows high usage (โฅ100K tokens โ required; โฅ150K โ critical)
Instructions
- Run the Pre-Compaction Preservation Checklist โ canonical in
.claude/skills/context-optimization/SKILL.md (Strategy #3 โ "Pre-Compaction Preservation Checklist"): branch + uncommitted-changes status, active file paths, error messages / stack traces, key decisions + rationale, pending todos.
- Compress โ summarize completed work + key decisions; clear redundant history (old exploration, superseded plans); keep active file paths, current task, blockers.
- Restate objective โ after compacting, briefly restate the current objective and confirm critical file paths are still accessible.
For the full context-management framework (Write / Select / Compress / Isolate strategies, context-anchor protocol, memory commands, token-efficient patterns), see context-optimization.
Related Commands
context-optimization โ full 4-strategy context-management framework (canonical owner)
/checkpoint โ save analysis context to an external file before compaction
/recover โ restore workflow context from the latest checkpoint
[IMPORTANT] Use TaskCreate to break ALL work into small tasks BEFORE starting โ including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
AI Mistake Prevention โ Failure modes to avoid on every task:
Re-read files after context changes. Context compaction, resume, or long-running work can make memory stale; verify current files before acting.
Verify generated content against source evidence. AI hallucinates APIs, names, claims, and document facts. Check the relevant source before documenting or referencing.
Check downstream references before deleting or renaming. Removing an artifact can stale docs, generated mirrors, configs, and callers; map references first.
Trace the full impact chain after edits. Changing a definition can miss derived outputs and consumers. Follow the affected chain before declaring done.
Verify ALL affected outputs, not just the first. One green check is not all green checks; validate every output surface the change can affect.
Assume existing values are intentional โ ask WHY before changing. Before changing a constant, limit, flag, wording, or pattern, read nearby context and history.
Surface ambiguity before acting โ don't pick silently. Multiple valid interpretations require an explicit question or stated assumption with risk.
Keep shared guidance role-relevant. Universal guidance must help every receiving skill or agent; code-specific obligations belong only in code-specific protocols.
Critical Thinking Mindset โ Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Anti-hallucination: Never present guess as fact โ cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence โ certainty without evidence root of all hallucination.
MUST ATTENTION apply critical + sequential thinking โ every claim needs appropriate traced evidence (file:line for repo/code claims; source URL or artifact section for research, product, content, and docs claims); confidence >80% to act, <60% DO NOT recommend. Anti-hallucination: never present guess as fact, admit uncertainty freely, cross-reference independently, stay skeptical of own confidence.
MUST ATTENTION apply AI mistake prevention โ verify generated content against evidence, trace downstream references before deleting or renaming, verify all affected outputs, re-read files after context loss, and surface ambiguity before acting.
Closing Reminders
Protocols in force (concise digest of the SYNC/shared blocks this skill carries):
-
AI Mistake Prevention: verify generated content against evidence, trace downstream references, verify all affected outputs, re-read after context loss, surface ambiguity.
-
Critical Thinking: MUST ATTENTION sequential thinking, traced file:line proof, confidence >80% to act.
-
MANDATORY IMPORTANT MUST ATTENTION break work into small todo tasks using TaskCreate BEFORE starting
-
MANDATORY IMPORTANT MUST ATTENTION search codebase for 3+ similar patterns before creating new code
-
MANDATORY IMPORTANT MUST ATTENTION cite file:line evidence for every claim (confidence >80% to act)
-
MANDATORY IMPORTANT MUST ATTENTION add a final review todo task to verify work quality
[TASK-PLANNING] Before acting, analyze task scope and systematically break it into small todo tasks and sub-tasks using TaskCreate.