Skip to content

feat(harness): context compaction for long-running missions #440

Closed

Description

@ajianaz

Problem

Mission mode chains turns under step/token/minute budgets, but the context
window itself is still the hard ceiling for very long missions. Once history
approaches the model's limit, a mission either degrades or dies regardless of
remaining budget. (Large-window models postpone this; they don't remove it.)

Proposal

  • Threshold-triggered compaction: when history nears a configurable fraction of
    the context window, summarize settled turns into a durable compaction
    session entry and continue from system prompt + summary + tail
  • Compaction entries are ordinary transcript entries → the existing
    replay/hydrate machinery stays truthful (crash mid-compaction resumes
    pre-compaction; compaction completes atomically as one entry)
  • Budget accounting keeps counting real tokens; report compacted-before-X in
    tole status
  • --no-compaction opt-out; --compact-at 0.8 knob

If a compaction pass already exists internally, happy to close this in favor
of docs.

Related

  • token efficiency: lazy tool registration + tool-result trimming policy #211 shipped lazy tool registration + tool-result trimming (token
    efficiency) — different layer; this issue is the context-window ceiling
    itself.
  • Prior KV-cache finding: the append-only wire body is optimal for provider
    caching (95–98% hit on multi-step). Compaction trades cache warmth for
    window headroom — acceptable once above the threshold, never compact
    eagerly.

Activity

  1. added
    enhancement
    harness
    on Oct 26, 2026
  2. added this to the milestone on Oct 27, 2026
  3. modified the milestones: , 0.9.0 on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementharness

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions