Appearance
Summarization
As conversations grow longer, sending the entire history becomes impractical. Iris automatically condenses older messages into narrative summaries that preserve context, emotional dynamics, and unresolved threads. Summaries are scoped to individual threads — each thread maintains its own independent summary chain.
Why Summarization Matters
Without summarization, you'd face a tradeoff:
- Keep all messages: Context window fills up, costs increase, responses slow down
- Drop old messages: Lose important context, Iris forgets what you discussed
Summarization offers a middle path: older messages are compressed into rich summaries that capture what matters, while recent messages stay in full detail.
How It Works
Summarization triggers on the size of the live history rather than a stored token count. After every reply, Iris queues a SummarizeConversation job for the thread. The job estimates the unsummarized history (everything since the latest summary boundary) and compares it to the model's context window:
if estimated_history_tokens > context_window × compaction_threshold → summarizeAt the default compaction_threshold of 0.75, summarization fires when the unsummarized history passes 75% of the window — before it overflows, not after. The process:
- Measure the history: Estimate the raw messages since the anchor, tool calls and results included, against
context_window × context.compaction_threshold. A secondary guard also fires when the thread has more thansummarization.thresholdunsummarized messages. - Select messages to summarize: Take the oldest unsummarized messages — as many as needed to bring the remaining history down to
summarization.trim_target_ratioof the token budget — leaving the most recentsummarization.protect_recentmessages untouched. When the count guard fired but the history is already under that target, it takes the oldestsummarization.thresholdmessages instead. - Generate summary: An LLM creates a structured summary capturing key information.
- Mark messages as summarized and advance the anchor: The summarized messages link to the new summary, and history now loads from just after them.
If a request ever has to leave more than 20 unsummarized messages out of its history, Iris doesn't wait for the job: it summarizes once, synchronously, before sending the request. See Context Management.
Summarizing in large steps (down to the target, rather than one small batch at a time) keeps the anchor stable for many turns, which keeps the cached history prefix alive between trims. The protected tail stays in full detail so Iris can reference recent exchanges naturally. Each thread tracks its own state independently — a long work thread might have several summaries while a short thread about dinner plans has none.
What Gets Captured
Summaries aren't just text excerpts -they're structured documents that capture multiple dimensions of the conversation:
Narrative Summary
A 150-300 word narrative that tells the story of the conversation segment. This is what gets injected into the system prompt.
The summarizer reads a plain-text transcript: each message with its timestamp, tool calls and results cut to 200-character previews, and one line per attached image, such as [Image: a hand-drawn floor plan of a two-bedroom apartment]. The description comes from the background image description job, so a summary can say what an image showed even though the summarizer never sees the image itself. An image that hasn't been described yet shows as [Image].
Example:
"The user discussed their ongoing Laravel project, expressing frustration with performance issues in the API layer. We explored several optimization strategies including query caching and eager loading. The conversation shifted to their upcoming vacation plans, and they mentioned needing to hand off the project to a colleague named Marcus. The user seemed stressed about the timeline but optimistic about the technical solutions we discussed."
Emotional Markers
Key emotional moments, each with the emotion, an intensity score (0.0-1.0), what triggered it, and a little context:
json
[
{"emotion": "frustration", "intensity": 0.7, "trigger": "API response times kept regressing", "context": "Third slow endpoint found that week"},
{"emotion": "relief", "intensity": 0.6, "trigger": "Query caching fixed the slowest endpoint", "context": "Load test came back under target"},
{"emotion": "excitement", "intensity": 0.5, "trigger": "Vacation dates were confirmed", "context": "Came up while planning the handoff"}
]The summary also records an overall emotional_intensity, a dominant_emotion, and an emotional_thread: a sentence or two on how the mood moved across the segment.
Thread Tracking
Unresolved threads - topics that came up but weren't concluded:
- "Performance testing before handoff"
- "Meeting with Marcus about the project"
Resolved threads - topics that reached a conclusion:
- "Caching strategy for API endpoints"
- "Vacation dates confirmed"
Relationship Dynamics
How the relationship stood during this segment: closeness, trust, and rapport scores (0.0-1.0) plus short notes. The notes are what the Summary Prompt shows Iris.
Key Facts
Important information learned during this segment that might warrant memory extraction:
- "Works with a colleague named Marcus"
- "Has vacation planned soon"
- "API performance is a current priority"
Themes
evolving_themes lists what the conversation is about from the user's side: their life, interests, projects, and ongoing topics, such as "Training for a first half marathon". The themes from the active thread's recent summaries are shown to Iris under "Recurring themes in our conversations", so a theme about Iris itself ("Iris makes errors and corrects them") would keep it dwelling on its own performance. The summarizer prompt tells the model to leave those out.
When a summary continues a previous one, the summarizer sees the previous themes as context only. It carries a theme forward only if the new messages still support it, so a theme doesn't stick around because it appeared once.
Work Context
Four fields help Iris pick up a task after its turns have been summarized away: accomplishments, relevant_files, key_decisions, and active_goals. The Summary Prompt shows them for the latest summary only.
Summary Chaining
Within each thread, summaries form a chain, with each referencing its predecessor via previous_summary_id. This creates continuity within a thread's conversation history.
Thread: "Work Project"
Summary 1 → Summary 2 → Summary 3 (most recent)
↑ ↑ ↑
Links to Links to Injected
nothing #1 into contextEach summary includes a narrative thread — a bridging sentence that connects to the previous summary:
"Continuing from our discussion about the API refactoring project..."
This helps Iris maintain conversational continuity within a thread even when the full history isn't available. Summary chains are completely independent between threads — a summary in one thread never references a summary from another.
When Summaries Are Used
Summaries do double duty. Up to context.recent_summaries (3) recent summaries from the active thread render into the cached system prompt (via the Summary Prompt), providing:
- Historical context from earlier in the thread
- Emotional continuity (Iris remembers how conversations felt)
- Awareness of unresolved topics within the thread
They also act as the history anchor: the latest summary's boundary is where raw history loading begins, so summarized turns aren't resent in full. See Context Management.
Configuration
| Setting | Default | Description |
|---|---|---|
context.compaction_threshold | 0.75 | History-size fraction (of the context window) that triggers summarization |
summarization.trim_target_ratio | 0.75 | Trim the oldest turns until the remaining history drops to this fraction of the budget |
summarization.protect_recent | 10 | Most-recent messages never pulled into a summary |
summarization.threshold | 40 | Secondary guard: unsummarized message count that also triggers summarization |
summarization.timeout | 120 | API timeout in seconds for summary generation |
summarization.provider | anthropic | Prism provider used to generate summaries |
summarization.model | claude-sonnet-5-5 | Model used to generate summaries |
context.recent_summaries | 3 | Summaries from the active thread shown in the system prompt |
Understanding the Settings
- context.compaction_threshold: The primary trigger. When the estimated unsummarized history passes this fraction of the context window, the summarization job queued after the reply compacts it.
- summarization.trim_target_ratio: How far each trim cuts back. Lower means fewer, larger trims (the cache survives longer, less raw history kept); higher means smaller, more frequent trims.
- summarization.protect_recent: The most-recent messages that are never pulled into a summary, so recent exchanges always stay in full detail.
- summarization.threshold: A secondary message-count guard. Summarization can also fire when unsummarized messages accumulate past this count, independent of size.
WARNING
Very aggressive summarization (low compaction threshold) may lose nuance from recent turns. The defaults balance context preservation with token efficiency.
Viewing Summaries
Summaries are stored in the conversation_summaries table, scoped to threads. You can explore them via:
bash
php artisan tinker
>>> $thread = User::first()->threads()->first();
>>> $thread->conversationSummaries()->latest()->first()Each summary includes all the structured fields (emotional markers, threads, etc.) as JSON columns.
See Also
- Context Management — how the token budget is calculated, how history is loaded against that budget, how tool output pruning reclaims space, and the full compaction lifecycle