[FEATURE] Autocompact triggers (e.g. after subtask)

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 8, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem

Autocompact currently triggers purely based on context window fill level. In practice this means compaction often happens mid-task — e.g. in the middle of a tool-call chain or while reasoning through a subtask — which can lose useful nearby context at an arbitrary point rather than a clean boundary.

For workflows that use structured subtasks (e.g. via TodoWrite), there are natural checkpoints — right after a todo item is marked completed — where compaction would lose far less useful context than an arbitrary mid-task trigger.

Feature request

Allow autocompact behavior to be configured with additional trigger rules, not just raw context usage. For example:

Compact when a TodoWrite item transitions to completed and context usage is above some threshold (e.g. 50%) — event-based alone would likely be too aggressive and discard useful context too early, so combining it with a fill-level floor seems important.
Optionally, a configurable minimum context usage before any event-based trigger is considered, to avoid excessive/wasteful compaction on short tasks.
This could live as a setting in settings.json, similar to how other automated behaviors (hooks etc.) are configured.

Why

Compacting at clean task boundaries instead of arbitrary context-fill points should preserve more relevant context per compaction and reduce the chance of losing state mid-step.

Proposed Solution

Add a new setting, e.g. autocompact.triggers in settings.json, that accepts one or more trigger rules instead of only the implicit context-fill trigger:

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

Performance and speed

Use Case Example

Long task with several subtasks.
But only rough knowledge/done solution are needed to complete subtasks -> Normally I tell Claude to pause after a subtask is finished, to then manually compact bymyself.
It would be much smoother, if claude could compact by itself

Additional Context

_No response_

View original on GitHub ↗