Compact User Context
Synchronously compact a user's currently-visible conversation context.
Use this when a bug or model error has poisoned a user's in-context conversation history (e.g. the agent confidently asserted a wrong fact about its own capabilities) and you want to reset the LLM-facing context without dropping durable user-supplied facts. The OSS admin_compact_visible_messages helper extracts facts into MEMORY.md / USER.md / SOUL.md before advancing the trim watermark, so the next turn starts from a clean slate plus the rewritten memory.
keep_recent preserves the last N visible turns so the user's pending request is not lost when an admin clears stale context mid-conversation. hint is prepended to the compaction LLM's <conversation> block as [admin note: ...] to bias how the LLM reads the messages, which is useful when the exact failure mode is known (e.g. "ignore prior agent claims about being read-only").
Audit-logged via AdminAction.COMPACT_USER_CONTEXT; the resulting compaction_events row is also linked from ctx.detail so a forensic query can join admin action to the compaction outcome.
Path parameters
Request body
Response
Successful Response