context: proactive periodic summarization (not just on eviction) #101
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
Phase 5
summarize-on-evictonly fires when the token budget is exhausted. For small local models (which effectively use a fraction of their advertised window per#87analysis), this means turns 1..N stay raw in the prompt until eviction kicks in — exactly when context bloat is hurting most. The German analysis 2026-05-17 strategy 5 ("History-Zusammenfassung via local", 3h, medium ROI) flagged this gap.Proposal
Proactively summarize older turns on a cadence, before budget pressure forces it:
Reuses Phase 5's existing
make_summarize_fn+summarize_fncallback path (no new module). New trigger inContext:enforce_budget(or a newContext:enforce_cadence) that fires periodically based on turn count, not budget.Composition
#87route-aware compression: even tighter prompts per local call.Acceptance
summarize_every_n_turns=10shows ctx.summary populated after turn 10, refreshed at turn 20.Effort
~4h. Per-method: extend
make_summarize_fn's wiring; add cadence trigger in context.lua; cfg example block.Implemented in commit
a3c1813. Cadence-triggered fold via Context:enforce_cadence; 18 unit cases + E2E on hossenfelder:8082 (2 fires across 5 turns, ctx tokens dropped from ~1000 raw to 180 summarized).