- Replace fixed 6-message compact retention with ratio-based logic:
retain ~20% of compactable estimated tokens, with a 6-message floor
and user-turn boundary alignment
- Add compactRetainedTokenBudget, compactRecentStart, compactTurnBoundary
helpers in internal/agent/agent.go
- Add TestAgentCompactKeepsTwentyPercentRecentContext
- Move startup/session/repl/bootstrap logic from root into internal/app
so main.go is a thin binary entry point (15 lines)
- Update /compact docs in README.md