Agent skill
strategic-compact
Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
Install this agent skill to your Project
npx add-skill https://github.com/sangrokjung/claude-forge/tree/main/skills/strategic-compact
SKILL.md
Strategic Compact Skill
Suggests manual /compact at strategic points in your workflow rather than relying on arbitrary auto-compaction.
Why Strategic Compaction?
Auto-compaction triggers at arbitrary points:
- Often mid-task, losing important context
- No awareness of logical task boundaries
- Can interrupt complex multi-step operations
Strategic compaction at logical boundaries:
- After exploration, before execution - Compact research context, keep implementation plan
- After completing a milestone - Fresh start for next phase
- Before major context shifts - Clear exploration context before different task
How It Works
The suggest-compact.sh script runs on PreToolUse (Edit/Write) and:
- Tracks tool calls - Counts tool invocations in session
- Threshold detection - Suggests at configurable threshold (default: 50 calls)
- Periodic reminders - Reminds every 25 calls after threshold
Hook Setup
Add to your ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "tool == \"Edit\" || tool == \"Write\"",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
}]
}]
}
}
Configuration
Environment variables:
COMPACT_THRESHOLD- Tool calls before first suggestion (default: 50)
Best Practices
- Compact after planning - Once plan is finalized, compact to start fresh
- Compact after debugging - Clear error-resolution context before continuing
- Don't compact mid-implementation - Preserve context for related changes
- Read the suggestion - The hook tells you when, you decide if
Related
- The Longform Guide - Token optimization section
- Memory persistence hooks - For state that survives compaction
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
security-pipeline
보안 파이프라인 - CWE Top 25 + STRIDE 자동 검증
cc-dev-agent
Claude Code 개발 워크플로우 최적화. Context Engineering, Sub-agents, TDD, 개발 후 검증 워크플로우 제공. 트리거: CC 프로젝트 시작, CLAUDE.md/spec.md 작성, /handoff /verify /commit-push-pr, sub-agent/Explore, Agent Teams 병렬 개발 요청 시.
session-wrap
세션 종료 전 자동 정리 스킬. 4개 병렬 subagent가 문서 업데이트, 반복 패턴, 학습 포인트, 후속 작업을 동시 탐지하고, 1개 검증 subagent가 중복 제거 후 사용자에게 선택지를 제시한다. 트리거: /session-wrap, 세션 마무리, 세션 정리, 작업 마무리
verification-engine
통합 검증 엔진 - 서브에이전트 기반 fresh-context 검증 루프 (v6)
using-superpowers
Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions
continuous-learning-v2
Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.
Didn't find tool you were looking for?