返回 Skill 列表
extension
分类: 开发与工程无需 API Key

claude-restart-compact

在自然断点处紧凑上下文以释放令牌并继续工作。在阶段边界、提交后或令牌使用量>150k时主动使用。优于随机自动压缩。支持自定义压缩提示。

person作者: jakexiaohubgithub

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.