Auto-Compact

Automatically summarize long conversations to stay within context limits.

Auto-Compact

Long conversations eventually exceed the modelโ€™s context window. Auto-compact automatically summarizes conversations to stay within limits.

Why Auto-Compact?

Every AI model has a context limit, for example:

ModelContext Window
GPT-5.2400K tokens
Claude Sonnet 4.6200K tokens
gemini-2.5-flash1M tokens

When you approach this limit:

  • New messages may fail
  • Older context is lost
  • Responses become less coherent

Auto-compact solves this by:

  1. Detecting when youโ€™re near the limit
  2. Generating a summary of the conversation
  3. Marking older messages as compacted
  4. Appending the summary to continue fresh

How It Works

Auto-compact uses a non-destructive approach:

  1. Summarize Phase: Your conversation is sent to the AI with a special prompt to generate a comprehensive summary capturing key points, decisions, and context.

  2. Tag Phase: Existing messages are marked with a condenseParent flag (they remain in history but are visually compacted).

  3. Append Phase: A new summary message is appended to the conversation, allowing you to continue with a fresh context window.

What Gets Summarized

  • All messages in the current conversation
  • Tool calls and results
  • Code snippets and decisions

Whatโ€™s Preserved

  • All original messages (non-destructive)
  • System prompt
  • Conversation history

Configuration

Enable Auto-Compact

  1. Open Settings
  2. Find Auto Compact section
  3. Toggle Enable Auto Compact

Threshold

The threshold slider (50% - 95%) determines when compact triggers:

ThresholdBehavior
50-70%More frequent compaction
90%Balanced (default, recommended)
95%Compact only when nearly full

Context Window

The context window is auto-detected from your provider, but you can override it in Provider Settings:

  1. Open Settings โ†’ Providers
  2. Find Context Window field
  3. Enter your modelโ€™s token limit (e.g., 128000 for GPT-4o)

This affects when auto-compact triggers โ€” if set incorrectly, compact may trigger too early or too late.

Custom Summary Prompt

Customize how summaries are generated by editing the prompt textarea. Leave empty to use the default prompt.

The default prompt asks the AI to produce a structured summary including:

  • Primary request and intent
  • Key concepts discussed
  • Files, code, and data
  • Errors and fixes
  • Pending tasks
  • Current work and next steps

Manual Compact

Trigger compact manually with the slash command:

/compact

This is useful when:

  • You want to clean up before a long message
  • Youโ€™re preparing to branch
  • The conversation feels bloated

Usage Indicator

When youโ€™re within 15% of the threshold, a warning indicator appears above the input area:

  • โ‰ค15% remaining: Gray indicator
  • โ‰ค10% remaining: Yellow warning
  • โ‰ค5% remaining: Red pulsing warning

Hover over the indicator to see exact token usage.

What Happens During Compact

When compact triggers:

  1. Indicator shows โ€œCompactingโ€ฆโ€
  2. Conversation is sent to AI for summarization
  3. Summary is generated
  4. Messages tagged as compacted (non-destructive)
  5. Summary appended to conversation
  6. Conversation continues normally

Best Practices

Let It Run Automatically

  • Donโ€™t manually compact too often
  • Trust the threshold setting
  • Only manual compact when necessary

Review Summaries

After compact, check the summary:

  • Ensure key points are captured
  • Add important details if missed

Branch Before Compact

If you want to preserve full context:

  1. Branch the conversation
  2. Compact the original
  3. Original has summary, branch has full history

Set Correct Context Window

For accurate auto-compact timing:

  • Configure context window in Provider Settings
  • Match it to your modelโ€™s actual limit
  • Default is 128K if not set

Troubleshooting

Compact triggers too often

  • Increase the threshold (e.g., 95%)
  • Check context window in Provider Settings matches your model
  • Consider using a model with larger context

Compact not triggering

  • Ensure auto-compact is enabled
  • Check threshold isnโ€™t too high
  • Verify context window in Provider Settings is correct

Summaries missing key info

  • Edit the custom summary prompt
  • Add important context back manually
  • Consider branching before compact

โ€œCompactingโ€ฆโ€ stuck

  • Wait up to 30 seconds
  • Check network connection
  • Restart the sidebar if needed