anthropics / anthropics/claude-code

[FEATURE] Background compaction: keep the session running while the summary is produced

オープン
#93,732 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:core enhancement performance
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

### Preflight Checklist

- [x] I have searched [existing requests](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20label%3Aenhancement) and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)

### Problem Statement

Auto-compaction stops the session. Context fills, the conversation pauses, a summarization request goes out, and nothing else happens until it comes back. The wait scales with how much conversation there is to summarize and with how fast the provider answers, so the sessions that stall longest are the long ones I have the most invested in. On a slower model or a third party endpoint it is long enough to lose the thread of what I was doing, and it arrives unannounced in the middle of a task.

The cost is not the tokens. It is that a session I am actively working in goes silent at the least convenient moment.

### Proposed Solution

Compact on a snapshot, off to the side, while the session keeps running.

1. Arm early, at a configurable fraction of the context window rather than at the edge of it.
2. Take a boundary at the current end of the conversation and summarize everything before it in the background.
3. Keep answering against the full context while that runs. Nothing blocks.
4. When the summary lands, swap it in at the boundary and carry forward the turns that happened in the meantime.
5. If the window fills before the summary returns, fall back to blocking exactly as today.

A setting to control the arming point would cover people on slow providers who need a wider margin. `precomputeCompactionEnabled` already appears in `/config` on some installs as `Precompute compaction` and it shortens the wait, but it is absent from the settings documentation and it still leaves the session paused at the boundary. Documenting it and defaulting it on would help on its own, and it is the natural place to build the rest of this.

### Alternative Solutions

Running `/compact` by hand at a natural break moves the pause somewhere less disruptive, but it does not shorten it and it means watching the context meter instead of working. Setting `autoCompactEnabled` to false trades a pause for a hard stop. Splitting work across shorter sessions loses the context that made the long session worth having.

### Priority

High - Significant impact on productivity

### Feature Category

Performance and speed

### Use Case Example

I am four hours into a refactor across a large repository. Claude is partway through updating call sites when auto-compact fires. The session goes quiet, I switch to something else, and by the time it resumes I have to reread the transcript to work out where it was. With background compaction the summary is prepared while the edits continue, and the swap happens between turns without me noticing.

### Additional Context

Related requests, all now closed and locked, which is why this is a new issue rather than a comment: #23336, #11894, #26026, #43510, #46431, #51033, #52972.

The ordering constraint looks like the hard part. Turns that complete during compaction have to be reconciled against a summary produced from a conversation that no longer matches, and a naive swap would drop them. Falling back to a blocking compaction when the reconciliation is not safe seems better than getting it subtly wrong, since losing recent work silently is worse than waiting.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start at the /config output and settings documentation, where precomputeCompactionEnabled is mentioned but undocumented; compare it with autoCompactEnabled and /compact behavior. Trace the existing auto-compaction boundary before designing snapshot/background work. Done means the session stays responsive during summarization, preserves turns completed meanwhile, and blocks as a fallback if the window fills first.

索引モデルが issue の本文から書いたものです。

評価

領域
cli, performance
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。