Skip to main content

Handoff & Compaction

Long conversations degrade results: the context window fills up, token costs grow, and the model starts losing track of earlier details. AiderDesk provides three strategies for keeping conversations effective — plus automatic compaction that applies them without you noticing.

Compaction Types​

AiderDesk offers three compaction types, configurable globally in task settings and overridable per agent profile:

TypeWhat happensBest for
CompactSummarizes the entire thread and replaces the conversation history with the summaryStaying in the same task with a clean context
HandoffExtracts only the context relevant to a stated goal and creates a new focused taskMoving to the next phase with a fresh start
SmartDeterministically trims redundant detail from older messages (stale tool outputs, file reads, searches) without using an LLMKeeping long agent runs lean without altering or summarizing any content

Manual Compaction​

Run /compact in the prompt field to summarize the current conversation. The generated summary captures:

  • The primary request and overall intent
  • Key technical concepts and decisions
  • A chronological list of user messages
  • Files read, created, or modified (with relevant snippets)
  • Errors encountered and their resolutions
  • Current work and the logical next step

You can guide the summary: /compact Summarize only the code changes.

The original messages are replaced by the summary once generation completes. In Agent Mode a dedicated compact agent profile performs the summarization using the configured compaction model (or the task's current model by default); in other modes aider's main model is used.

For a non-AI alternative, /smart-compact applies smart compaction to the current conversation on demand.

Pre-compaction Snapshots​

Before each compaction (both /compact and /smart-compact, manual or automatic), AiderDesk saves the full pre-compaction context into the task directory:

context.pre-compaction.001.json
context.pre-compaction.002.json
...

Snapshots are numbered sequentially — a higher number means a newer snapshot — and nothing is ever removed from them, so no conversation content is lost to compaction. Agents using the built-in system prompt are informed about available snapshots as absolute paths and can read them whenever they need earlier history that is no longer part of the current context.

Handoff does not create a snapshot: it keeps the original task intact, so its conversation is preserved as-is.

Handoff to a New Task​

Run /handoff [focus] to extract what matters for your next goal into a brand-new task:

/handoff implement password reset functionality with email verification
  1. AiderDesk analyzes the conversation and your focus goal
  2. It extracts relevant decisions, progress, and patterns — not everything
  3. A new task is created with all context files transferred and a draft prompt generated
  4. You review and edit the draft before sending

The original conversation stays intact in the parent task, and worktree mode carries over automatically.

Good focuses are specific and action-oriented: "execute phase one of the created plan", "apply this validation pattern to all API endpoints". Avoid vague ones like "continue" or "finish the project".

Chain handoffs for big projects
Main Task: Build E-commerce Platform
→ /handoff Implement product catalog
→ /handoff Add search functionality
→ /handoff Build shopping cart

Focused threads consistently produce better agent results than one long, meandering conversation.

Automatic Compaction​

Instead of watching token counts yourself, configure AiderDesk to compact conversations automatically:

  1. Open Settings → Tasks

  2. Set when auto-compaction triggers:

    • Percentage of the model's context window
    • Absolute token count

    Whichever threshold is reached first takes effect; set the percentage to 0 to disable auto-compaction entirely.

  3. Choose the compaction type to use (Compact, Handoff, or Smart)

When the threshold is exceeded mid-task, the configured strategy runs automatically and work continues with the condensed context.

Auto-compaction settings

Per-profile overrides are available in Agent Profiles — useful when a subagent should always use Smart compaction while interactive tasks stay manual.

Compaction and Handoff Models​

In Settings → Tasks → Context Management, selecting Compact shows the Compaction model selector; selecting Handoff shows the Handoff model selector. Smart does not use an AI model and shows no model selector.

Both selections are saved independently, so switching the automatic compaction type does not clear either override. The default, Use task’s current model, follows the task's current agent model. A selected override applies to both manual commands (/compact or /handoff) and automatic compaction in Agent Mode, without changing the task's working model. Manual commands use their respective model override regardless of the automatic compaction type. Aider modes continue to use aider's main model.

An auxiliary model must support the conversation's context size. Switching models may also prevent reuse of cached input, so a smaller model is not necessarily cheaper or faster.

Which One Should I Use?​

  • Same task, running out of window → /compact
  • Next phase deserves a clean slate → /handoff focus
  • Don't want to think about it → enable Smart auto-compaction