Skip to content

feat: add context compaction to the rlm harness - #2459

Draft
mikasenghaas wants to merge 9 commits into
feat/context-compactionfrom
feat/rlm-compaction
Draft

feat: add context compaction to the rlm harness#2459
mikasenghaas wants to merge 9 commits into
feat/context-compactionfrom
feat/rlm-compaction

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add the same optional CompactionConfig to the RLM harness as the bash harness carries
  • cross ACP with a flat policy: a compaction toggle plus summarize_at_tokens
  • pin nano-rlm 0e97b0b, which implements the matching engine-side design

Stacked on #2454 (bash compaction + the interception /v1/models relay) so that PR can merge first.
Companion: nano-rlm #147 — merge before this one.

Breaking

  • RLMHarnessConfig.summarize_at_tokens moves to RLMHarnessConfig.compaction.summarize_at_tokens and no longer accepts a (lo, hi) range.
  • Leave compaction unset to disable proactive and reactive compaction.

Verification

  • uv run pytest -q tests/v1 — passed; live E2E tests skipped without PRIME_API_KEY

Terminal-Bench 2 e2e: 8 tasks, local vLLM poolside/Laguna-XS-2.1 at 32k (glm45 reasoning + glm47 tool parsers), compaction = {} so the engine discovers the threshold itself (32768 − 16384 = 16384). Trace analysis of the pinned engine:

  • Threshold discovery and the proactive trigger work through ACP: compaction fired on the 3 episodes whose context crossed ~17k; episodes that stayed below (0.7k-6.7k peaks) never compacted; 20KB tool truncation visible where tool output was large.
  • The runs surfaced and the pin now fixes three real integration bugs, each verified against the failing trace: /models discovery crashing on Python 3.10 containers (raw cast_to parse; now models.list()), and two interactions with main's new semantic-edges bookkeeping - a failed checkpoint attempt and a resampled unusable reply each left the compaction's summary-request claim held, killing the retry with "compaction already has a summary request".
  • Laguna answers checkpoint prompts entirely in the reasoning channel, so under the summaries-are-content-only rule its compactions exercise the resample-then-end-cleanly path; summary carry-over across branches was demonstrated on content-channel models (Qwen3-0.6B, deepseek-v4-flash).
  • A final combined verification run on a content-channel model is pending before merge.

🤖 Generated with Claude Code

mikasenghaas and others added 8 commits August 28, 2026 23:45
The same optional CompactionConfig as the bash harness, crossing
ACP as a flat policy (compaction toggle + summarize_at_tokens).
Pin nano-rlm 0e97b0b, which implements the matching engine-side
design.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant