Feature hasn't been suggested before.
Describe the enhancement you want to request
SessionV2.compact is a stub that fails with OperationUnavailableError (packages/core/src/session.ts), which the server maps to a 503. So on V2 there is no manual compaction: /compact only appears to work in the app because the compat shim rewrites it to the legacy V1 session.summarize.
V2 already has automatic compaction (request-budget) and overflow-triggered compaction. What's missing is the explicit, user-initiated path.
This is already recorded as a follow-up in specs/v2/session.md:
Add explicit manual compaction on top of automatic request-budget compaction.
and in specs/v2/schema-changelog.md:
Defer provider-overflow recovery, explicit manual compaction, and deterministic old tool-result pruning.
Overflow recovery has since landed; manual compaction has not.
Notes on what makes it distinct from the automatic path:
- It should not be a provider turn — no inbox promotion, no tool materialization, no assistant reply.
- The two budget conditions shouldn't apply, since the request is explicit rather than a response to context pressure. In particular, automatic compaction declines when a model declares no
limits.context, which would make /compact silently do nothing on such models.
- Automatic compaction retains
compaction.keep.tokens of verbatim recent context because it only needs to free enough budget to continue. An explicit request should compress the whole active history.
- It needs to be serialized against that session's provider turns without joining an active drain or coalescing with another request.
No schema change is needed: SessionEvent.Compaction.{Started,Ended} and SessionMessage.Compaction already declare reason: "auto" | "manual", and "manual" currently has no producer outside tests.
Feature hasn't been suggested before.
Describe the enhancement you want to request
SessionV2.compactis a stub that fails withOperationUnavailableError(packages/core/src/session.ts), which the server maps to a 503. So on V2 there is no manual compaction:/compactonly appears to work in the app because the compat shim rewrites it to the legacy V1session.summarize.V2 already has automatic compaction (request-budget) and overflow-triggered compaction. What's missing is the explicit, user-initiated path.
This is already recorded as a follow-up in
specs/v2/session.md:and in
specs/v2/schema-changelog.md:Overflow recovery has since landed; manual compaction has not.
Notes on what makes it distinct from the automatic path:
limits.context, which would make/compactsilently do nothing on such models.compaction.keep.tokensof verbatim recent context because it only needs to free enough budget to continue. An explicit request should compress the whole active history.No schema change is needed:
SessionEvent.Compaction.{Started,Ended}andSessionMessage.Compactionalready declarereason: "auto" | "manual", and"manual"currently has no producer outside tests.