Skip to content

tracking: context compression improvements #9666

@kshitijk4poor

Description

@kshitijk4poor

Context Compression Improvements

Tracking issue for seven independent improvements to agent/context_compressor.py that improve information retention, efficiency, and robustness during context compression.

PRs — Information Quality (merged from original batch)

PRs — Robustness & Efficiency (new batch)

Benchmark Summary

Smart tool collapse (PR #9661):

Metric Before After
Space savings 99.3% 98.9%
Key facts preserved (tool name, file path, command, exit code) 0/24 24/24

User message preservation (PR #9665):

Metric Before After
User preferences surviving compression 0/6 6/6

Anti-thrashing (PR #9674): Prevents infinite compression loops that burn LLM summary calls with <10% savings each.

Dedup (PR #9677): 5 reads of the same 10KB file → 50KB in context → deduped to 10KB + 4 stubs.

Hardening (PR #9678): Summary model now gets 1.3x budget instead of 2x (cost saving). Transient errors cool down for 60s instead of 600s.

Independence

All 7 PRs are independent — each can be merged separately. They touch different methods within context_compressor.py:

Related issues addressed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions