mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
e418e993b1
Auto-compaction re-appended the latest user message verbatim. When that message was large, post-compaction context landed right back over the threshold, so every turn fired another full summarization call that never relieved the pressure - context stayed pinned (~2x input tokens). Middle-out truncate the re-appended message to a budget derived entirely from real values: context limit, compaction threshold, current overhead (system + tools + summary), and a reserve for the next turn (model max output + per-turn additions like the turn-context block). Post-compaction context now drops below the threshold with headroom, so the next turn doesn't re-compact.