Agent skill
claude-restart-compact
Compact context at natural breakpoints to free tokens and continue working. Use PROACTIVELY at phase boundaries, after commits, or when token usage >150k. Better than random auto-compact. Supports custom compaction prompts.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/claude-restart-compact
SKILL.md
Compacting context at natural breakpoint and resuming work...
This will:
- Summarize recent conversation to free tokens
- Preserve task context and state
- Resume with compact history
- Continue working on current task
When to Use (Natural Breakpoints)
Use at logical stopping points rather than letting Claude auto-compact randomly:
After completing a phase:
- Feature implementation done and committed
- Test suite passing
- Documentation updated
- Natural transition to next phase
At project boundaries:
- Completed one component, starting another
- Finished refactoring, moving to new feature
- After major milestone
Before running out of space:
- Token usage >150k (75% of 200k budget)
- Long conversations (>100 messages)
- Before starting large multi-phase work
Benefits over auto-compact:
- Control WHEN compaction happens
- Compact at meaningful boundaries
- Preserve important context
- Custom prompts guide what to keep
Usage
Basic (default compaction):
.claude/skills/claude-restart-resume/scripts/claude-restart.sh compact
With custom prompt (guides what to preserve):
# Set compaction prompt before invoking
export COMPACT_PROMPT="Preserve: API design decisions, database schema, known bugs"
.claude/skills/claude-restart-resume/scripts/claude-restart.sh compact
Compaction Prompts
Custom prompts help preserve important context:
# Keep technical decisions
COMPACT_PROMPT="Preserve architectural decisions and open technical questions"
# Keep project state
COMPACT_PROMPT="Preserve TODO list state, recent commits, and next steps"
# Keep domain knowledge
COMPACT_PROMPT="Preserve domain model, business rules, and API contracts"
The script will pass this to Claude during compaction to guide summarization.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?