Compact conversation context
POST /v1/sessions/:id/compact — Summarize all completed conversation history immediately, including short conversations. Extends the previous summary wi
POST /v1/sessions/:id/compact
Summarize all completed conversation history immediately, including short conversations. Extends the previous summary with new history and preserves the original transcript.
| Method | POST |
| Path | /v1/sessions/:id/compact |
| Auth | Authorization: Bearer <token> required when GATEWAY_AUTH_TOKEN is set |
| Category | sessions |
Response body
{ "messagesSummarized": 12, "toolCallsSummarized": 2 }Notes
Returns zero counts with skipped: empty for empty history or skipped: unchanged when no messages have arrived since the last compaction. There is no minimum turn count. Manual and automatic compaction skip less than 512 tokens of replaceable content; a generated summary must save at least 128 tokens after user-message retention and summary framing. These skips return skipped: too_small (no model request) or skipped: no_savings (original context kept). Unknown sessions return 404; side tasks return 400; busy sessions return 409. Failed summarization or persistence returns 500 without replacing the previous summary. New conversation turns wait for compaction to finish.