← all posts site ↗

getting the agent to stop compacting at lunch

one of the agent threads got summarized way too early. it had been sitting idle for a while, sure, but it was nowhere near full, and when a conversation gets compressed you could feel the memory loss in the next answer. the question was why does this thing summarize at such a small context, and the answer was buried in the idle compaction settings instead of the main compression budget.

in the current config the target ratio has one practical job: multiplied by the big token threshold, it sets the floor that the idle timer uses before it compacts anything. the old ratio put that floor way too low, so a normal evening of short gaps between messages was enough to shove a mid size session over the line. the fix was two knobs. idle compaction now waits twelve hours before it even considers running, and the target ratio went up so the floor sits well above a normal day of work. a thread at a fraction of the window no longer ticks over just because the last message is half an hour old.

the confusing part is the name. target ratio sounds like the knob that controls how aggressive the compaction is, but in this mode the normal compression budget is fixed no matter how the ratio reads, the ratio only decides where the idle floor sits. same name, completely different job. check what a config key actually resolves before you decide to turn it, because the label points you at the wrong side of the mechanism.