Skip to content

[P1] Selective context compaction (upgrade summarize strategy) #111

@JackChen-me

Description

@JackChen-me

Problem

Our current contextStrategy: 'summarize' compresses the entire conversation history into a single summary. This is a blunt instrument — it loses tool call decisions, action sequences, and key reasoning while retaining generic summaries.

Industry comparison: Anthropic's Compaction API and ACON framework use selective compression — preserve decisions and action outcomes, discard intermediate reasoning and raw tool outputs. This achieves better compression ratios with higher fidelity.

Proposal

Upgrade the summarize strategy to a compaction-style approach:

  1. Preserve: tool call decisions (which tool, why), final outcomes, errors encountered, key user instructions
  2. Discard: thinking/reasoning blocks, raw tool output (replace with one-line summary), redundant assistant acknowledgments
  3. Structure: output as a structured context block (not free-form prose) so the model can parse it reliably

This could be implemented as:

  • A new contextStrategy: 'compact' option alongside the existing summarize
  • Or an upgrade to the existing summarize with a smarter default prompt

Source

  • Competitive analysis: Anthropic Compaction API, ACON framework (arXiv 2510.00615, 26-54% token reduction), Mem0 semantic distillation
  • Triggered by [Feature] Provide Custom Tools. #108 discussion and context engineering landscape research

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Implement later — still lightweightenhancementNew feature or requestsource:analysisSource: systematic gap analysissource:competitiveSource: competitive analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions