Problem
Rust-native agents automatically summarize / compact context when a conversation approaches the model context limit, but the frontend does not clearly show when this has happened.
CLI agents appear to rely on each external CLI's native context behavior. ORGII currently parses token usage and reasoning output, but does not detect or surface CLI-native context summarization / auto-compact events.
As a result, users cannot easily tell when older conversation context has been compressed, truncated, or replaced by a summary.
Current behavior
Rust-native agents
Rust agents run pre-turn context compaction when:
historyTokens > (contextWindow - reservedSummaryTokens - bufferTokens) * triggerRatio
With current defaults:
historyTokens > (contextWindow - 20_000 - 13_000) * 0.8
Additional defaults:
enabled = true
minMessages = 8
keepRatio = 0.4
summaryMaxTokens = 4096
floorTokens = 16_000
Compaction flow:
- Microcompact old large tool results.
- Enforce aggregate tool-result budget.
- Try Session Memory compact first.
- If Session Memory compact is unavailable or still over budget, run LLM summarization.
- Persist a compact-boundary
system row with text like:
[Session Memory — N earlier messages compacted]
[Conversation summary — N earlier messages compacted]
If LLM compaction fails repeatedly, Rust falls back to truncation and emits an agent warning.
CLI agents
ORGII does not appear to perform its own context-limit summarization for CLI sessions.
Instead:
- CLI output is parsed and streamed.
- Token usage is parsed when available.
- Codex reasoning
summary items are rendered as thinking, but this is not context compaction.
- A bounded ORGII context bridge is injected only when there is no native CLI resume id:
- max 24 messages
- max 12,000 chars
- truncated, not summarized
Any context summarization for CLI agents is likely native to the external CLI and is not currently detected as a first-class ORGII event.
Current frontend behavior
There is a context usage indicator in the composer.
It shows:
Context will be summarized soon
when the context ring reaches warning/critical state.
However:
- This is based on frontend usage percentage, currently warning at
>= 90%.
- It does not mean compaction has actually happened.
- Backend Rust compaction triggers around
80% of the effective budget, not 90% of raw displayed context usage.
- There is no dedicated UI badge, toast, or timeline row for “context was summarized”.
- Persisted Rust compact summaries may appear as normal assistant-style text in history, but they are not rendered as a distinct compaction event.
Desired behavior
Add a clear frontend indication when context summarization / compaction actually occurs.
Possible UI options:
- Timeline row:
Context summarized — N earlier messages compacted
- Small badge in chat history at the compact boundary
- Context popover status:
Last summarized at <time>
- Toast or subtle inline notice after compaction completes
- Distinguish LLM summary vs Session Memory compact vs truncation fallback
Suggested event/state model
For Rust-native agents, emit a structured event when compaction completes, for example:
{
"type": "agent:context_compacted",
"sessionId": "...",
"method": "session_memory",
"messagesCompacted": 42,
"messagesKept": 12,
"tokensBefore": 180000,
"tokensAfter": 62000,
"summaryPreview": "...",
"createdAt": "..."
}
method should support at least:
session_memory
llm_summary
truncation
The frontend can render this as a first-class chat/timeline event instead of relying on a plain system message.
For CLI agents, investigate whether each supported CLI emits recognizable auto-compact / context-summary events:
- Cursor CLI
- Claude Code
- Codex
- Gemini CLI
- Kiro
- Copilot
- OpenCode
If detectable, normalize those into the same frontend event shape where possible.
Acceptance criteria
- Rust-agent successful Session Memory compaction surfaces a clear UI indicator.
- Rust-agent successful LLM summary compaction surfaces a clear UI indicator.
- Rust-agent truncation fallback surfaces a warning-level UI indicator.
- Context popover distinguishes:
- approaching compaction
- compaction happened
- truncation fallback happened
- CLI-agent parsers are audited for native compaction / context-summary signals.
- If a CLI does not expose such signals, document that limitation.
- Do not hardcode frontend string parsing of summary text like
[Conversation summary — ...]; prefer structured Rust events.
- Existing persisted compact-boundary rows continue to work for replay/history.
Related
Problem
Rust-native agents automatically summarize / compact context when a conversation approaches the model context limit, but the frontend does not clearly show when this has happened.
CLI agents appear to rely on each external CLI's native context behavior. ORGII currently parses token usage and reasoning output, but does not detect or surface CLI-native context summarization / auto-compact events.
As a result, users cannot easily tell when older conversation context has been compressed, truncated, or replaced by a summary.
Current behavior
Rust-native agents
Rust agents run pre-turn context compaction when:
With current defaults:
Additional defaults:
Compaction flow:
systemrow with text like:[Session Memory — N earlier messages compacted][Conversation summary — N earlier messages compacted]If LLM compaction fails repeatedly, Rust falls back to truncation and emits an agent warning.
CLI agents
ORGII does not appear to perform its own context-limit summarization for CLI sessions.
Instead:
summaryitems are rendered as thinking, but this is not context compaction.Any context summarization for CLI agents is likely native to the external CLI and is not currently detected as a first-class ORGII event.
Current frontend behavior
There is a context usage indicator in the composer.
It shows:
when the context ring reaches warning/critical state.
However:
>= 90%.80%of the effective budget, not90%of raw displayed context usage.Desired behavior
Add a clear frontend indication when context summarization / compaction actually occurs.
Possible UI options:
Context summarized — N earlier messages compactedLast summarized at <time>Suggested event/state model
For Rust-native agents, emit a structured event when compaction completes, for example:
{ "type": "agent:context_compacted", "sessionId": "...", "method": "session_memory", "messagesCompacted": 42, "messagesKept": 12, "tokensBefore": 180000, "tokensAfter": 62000, "summaryPreview": "...", "createdAt": "..." }methodshould support at least:session_memoryllm_summarytruncationThe frontend can render this as a first-class chat/timeline event instead of relying on a plain
systemmessage.For CLI agents, investigate whether each supported CLI emits recognizable auto-compact / context-summary events:
If detectable, normalize those into the same frontend event shape where possible.
Acceptance criteria
[Conversation summary — ...]; prefer structured Rust events.Related