Skip to content

Compaction should prune old tool outputs before generating summary #14825

@praxstack

Description

@praxstack

Enhancement

The compaction system generates an AI summary to reduce context, but it doesn't prune old tool outputs first. If context is already near the limit, the summarization LLM call itself may overflow.

Proposal

Add SessionCompaction.prune() before both compaction triggers:

  1. Proactive overflow check (before LLM call)
  2. Reactive compact result (after processor returns 'compact')

Pruning strips old tool read/grep/list outputs first, maximizing context reduction before the summarization LLM call.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions