Dir loop message history grows monotonically — no eviction #51
Loading…
Reference in a new issue
No description provided.
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?
Background
#44 fixes the broken context-budget metric (cumulative sum vs actual context size). With that fix, the budget no longer trips falsely. But the underlying dynamic that would eventually trip a true budget remains: dir loop message history grows monotonically with no eviction.
The growth pattern
Every turn appends:
Nothing is ever removed. Per-turn
input_tokensfrom the #44 verification run onluminos_lib:Roughly linear growth at ~1.5–2k per turn. This stays well under Sonnet's 200k window for the current
max_turns=14cap, so the metric fix in #44 is sufficient for now. But:max_turnsis raised (Phase 3 dynamic turn allocation could push it higher)parse_structureon a big file, or aread_filewith largemax_bytes)...the growth becomes a real overflow risk.
Why eviction is non-trivial
Tool results can't just be deleted — the agent reasons about what it has already learned by referring back to earlier results. Naive eviction would break the agent's working memory.
Possible directions
[result elided — N chars, was: read_file(path='ai.py')]. The fact of the call survives; the bytes don't.Direction 3 (cache-as-memory) is the most aligned with how Luminos already works — the cache is already the persistent memory layer, the message history is just scratch space. Worth designing toward.
Acceptance
max_turnsturns on a target with many files keeps per-turninput_tokensbounded (does not grow linearly to overflow)Sequencing
Not blocking. After Phase 3 (planning) ships and we have data on how dynamic turn allocation interacts with the growth pattern. If Phase 3 raises
max_turnssignificantly, this becomes blocking before Phase 4.