[FEATURE] Auto-compact at sub-task level

Resolved 💬 4 comments Opened Jan 8, 2026 by sholub89 Closed Feb 9, 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

It is well-known that you will get better results by keeping the context small and focused. But often it isn't possible if the task is complex. Claude Code has a nice auto-compact feature, but it triggers when the session limit is reached. For better context management and performance, I suggest having auto-compact at the sub-task level

For example, your feature requires several things to be done, and Claude Code creates a plan for you. The plan consists of several sequential steps, and each subsequent step mostly requires the result of the previous one, rather than the full context. If your plan has 10 steps, by the time it reaches later steps, the context is already bloated with lots of information that isn't relevant anymore.
With the sub-task auto-compact feature, after each step of the plan, it would summarize that specific step execution (from the beginning of it till it was marked as completed) into something useful, helping to keep context smaller to improve the model's attention and results.

Please let me know if that makes sense.

Proposed Solution

It could be a toggle in settings for a user to enable/disable it.

Alternative Solutions

The workaround is to keep sessions small and dedicated, offload the important context to MD files, etc. But they are workarounds due to the context window limitations and especially the degradation in model attention as the context grows.
Another possible great alternative is to use agents, if they are well-configured

Priority

High - Significant impact on productivity

Feature Category

Performance and speed

Use Case Example

Example scenario:

  • I am working on a codebase refactoring. I start with a plan mode, and after a good back and forth, Claude Code comes up with a 10-step plan
  • It will start with step 1 and proceed with step 2 only once 1st is completed.
  • But it can happen 1st step is very heavy on the context, many files read, many searches made, many modifications applied, etc.
  • By the time it gets to execute step 2 - the chat session contains all the little details from 1st step execution that are irrelevant
  • Now the same thing continues, and the further it goes, the more irrelevant context it aggregates

Additional Context

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗