cb345e5725
Phase 3 of the working-memory sprint. _prune_native_messages now compacts in two stages instead of only evicting whole turns: Stage 1 digests OLD tool-role outputs to a one-line summary (exit marker + first error line, else first line) via the new _digest_tool_output; Stage 2 falls back to oldest-first whole-message eviction only if still over budget. Tool outputs are the biggest context hog, and digesting keeps the action->result causal chain intact, so whole-turn eviction (which severs it) becomes a last resort. The pinned head/TASK and the recent keep_recent window (including the most recent tool output, verbatim) are still never touched. Return is now (messages, dropped, digested); the sole caller logs both. Clean-room counterpart to Goose's tool-output condensation track. RAM-only, no disk. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>