# Compaction cut points keep roles alternating Status: accepted ## Context The summary must be folded into the history without breaking provider rules: roles alternate and every `tool_use` keeps its result. ## Decision Compaction cuts at the latest user prompt and folds the summary into it. Inside one long tool loop with no prompt to cut at, it cuts before an assistant message and the summary becomes its own leading user message, so the kept history still alternates and the pending `tool_use` still has its result. ## Consequences Summaries sit at a prompt boundary when possible; the fallback handles single huge tool loops. Code: crates/hx-core/src/compact.rs (`plan`, `Plan`, test for the no-prompt case)