Appearance
Memory Extraction
Memory extraction automatically identifies and stores important information from your conversations. Rather than requiring you to explicitly tell Iris what to remember, it analyzes your interactions and captures facts worth preserving.
How It Works
Extraction runs as a background job once 10 new messages (extraction.threshold) have arrived since the last run. Each run works through one batch:
- Capture the batch: The job reads where the last run stopped and takes up to 60 unprocessed messages (
batch_size), oldest first. The 20 messages just before them (context_messages) come along as context, together with each thread's brief and latest summary. - Extract candidates: An LLM reads the conversation and returns up to 6 candidate memories (
max_memories), drawn only from the new messages. - Find neighbors: Iris embeds every candidate in one request, then looks up each candidate's closest existing memories.
- Reconcile: If any candidate has close neighbors, one more LLM call decides whether each of those candidates is new, already known, or a correction.
- Commit: Iris writes the new and corrected memories and moves the extraction cursor to the end of the batch, all in one database transaction.
The extraction prompt instructs the model to be selective. Each memory should be self-contained and useful on its own, and extracting nothing is a normal result.
NOTE
Extraction runs via the queue worker. Make sure php artisan horizon is running.
Extracting From New Messages Only
Every message is extracted from exactly once. The model sees the conversation in two labeled sections:
- Earlier Messages (context only): already-processed messages, thread briefs, and thread summaries
- New Messages (extract from these): the batch
The earlier section is there so the model knows who "she" is or which project "the redesign" means. The prompt forbids extracting anything whose only source is that section, so a fact you mentioned last week doesn't get saved again because it's still on screen.
Backlogs
If more than batch_size messages are waiting, the run handles the oldest 60. When it finishes and at least threshold messages are still unprocessed, it queues a follow-up run for the next batch. A smaller remainder waits for the next regular trigger.
Replies Still Being Written
A reply that's still pending or streaming has incomplete content. The batch stops just before the first such message, and a later run picks it up once it's finished.
A reply stuck in that state for longer than in_flight_minutes (15 by default) no longer holds the batch back, so one crashed stream can't stall extraction forever.
The Extraction Cursor
Each user has an extraction cursor, last_memory_extraction_id, marking the last message that's been processed. The job reads it once, when it starts, and every message after it belongs to that run's batch.
The cursor only moves inside the same transaction that writes the batch's memories. Before writing, Iris locks the user row and checks that the cursor is still where the run started. If another run has committed in the meantime, or a retry is replaying a batch that already committed, the run writes nothing at all. So either the memories and the cursor move together, or neither does.
What Gets Extracted
Good Candidates
| Type | Examples |
|---|---|
| Personal details | Location, household, birthday |
| Preferences | Likes dark mode, prefers morning meetings, vegetarian |
| Goals | Wants to learn piano, training for a half marathon |
| Skills | Experienced PHP developer, fluent in Spanish |
| Relationships | Their manager runs the platform team, hosts a monthly book club |
| Events | Starting a new job next month, kitchen remodel starts in spring |
| Context | Works remotely, has a 2-hour commute |
What Gets Skipped
- Transient context, like "I'm looking at the code right now"
- Trivial details, like "I had coffee this morning", unless there's a pattern
- Conversation mechanics, like "Thanks for your help"
- The assistant's own suggestions or guesses, unless you confirm them
- Stable background mentioned in passing, like your job title, when the new messages don't add anything to it
What Happened vs. What Was Discussed
Talking about something isn't evidence that it happened. Every candidate carries a basis that says what the new messages actually establish:
| Basis | Meaning | Example |
|---|---|---|
actual | It happened, or it's currently true | "User commutes on an e-bike" |
planned | An intention or something scheduled that hasn't happened yet | "User plans to ride the e-bike to work starting next week" |
discussed | A topic the user talked about or researched | "User discussed e-bike battery range for longer commutes" |
hypothetical | Options being weighed, "what if" talk | "User is considering an e-bike if the lease ends near the office" |
reported | Someone else's claim, relayed by the user | "User's neighbor says the city is adding bike lanes" |
The model phrases each memory to match its basis, so a conversation about e-bikes doesn't turn into "owns an e-bike". When a plan later happens, that's a new memory with basis actual, and reconciliation replaces the old plan with it.
Iris stores the basis in the memory's metadata.basis.
Reconciling With Existing Memories
Before anything is written, each candidate is compared against what's already stored. Iris finds up to 5 live memories (neighbor_limit) with a cosine similarity of at least 0.70 (neighbor_similarity) to the candidate.
A candidate with no neighbors above that floor is added without another LLM call. Every candidate that does have neighbors goes into a single reconciliation call, which returns one decision per candidate:
| Decision | What Iris does | When the model picks it |
|---|---|---|
add | Stores the candidate as a new memory | It's a distinct fact, or the model isn't sure |
skip | Stores nothing | An existing memory already says the same thing, with the same status and no new detail |
supersede | Replaces an existing memory with updated content | The user corrected it, or its status changed |
Status changes are always supersedes, never skips. Say a memory reads "User hasn't booked the dentist yet" and the new messages say the appointment is booked for a Friday. The wording overlaps heavily, but the status changed, so the old memory is replaced with one that keeps the still-true details and adds what changed.
A supersede creates a new memory linked to the old one, then soft-deletes the old row and records superseded_by and superseded_at on it. The old content stays recoverable, and any Truth built from the old memory is flagged for review. The reconciler prompt also tells the model not to let a discussed, hypothetical, or reported candidate overturn an actual memory, and to choose add when it can't tell which of two conflicting memories is right.
Invalid Decisions Fall Back to Add
Iris validates every decision before acting on it. Each of these turns into an add:
- The model returned no decision for the candidate
- The action isn't
add,skip, orsupersede - The
memory_idisn't one of that candidate's own neighbors - Another candidate in the same batch already superseded that memory
- A supersede came back without replacement content
- The target memory was deleted or replaced before the write committed
If the reconciliation call itself is refused, every candidate is added. Adding is the safe default: an extra memory can be merged later by consolidation, while a wrong skip loses information for good.
Each written memory records how it was reconciled in metadata.reconciliation: the neighbors and their similarity scores, the decision, the model's reasoning, and any fallback reason.
Quality vs Quantity Tradeoff
The max_memories setting (default: 6) intentionally limits how many memories one run can extract. This forces selectivity, so the model has to choose the most valuable facts.
Increasing this limit captures more information but may dilute quality. The model might start storing borderline-useful facts that clutter memory retrieval later.
TIP
If important information seems to be missed, first check if extraction is running (Horizon dashboard at /horizon). If it is, consider lowering extraction.threshold to run more frequently rather than raising max_memories.
Examples
Example 1: Professional Context
Conversation:
"I'm building the booking system for a bike-share startup. It's a Laravel app, and I've been doing PHP for about 8 years now."
Extracted memories:
- "Builds the booking system for a bike-share startup, using Laravel" (type:
fact, category:professional, basis:actual) - "Has about 8 years of PHP development experience" (type:
skill, category:professional, basis:actual)
Example 2: Personal Preferences
Conversation:
"I really prefer having my meetings in the morning when I'm fresh. After lunch I'm usually in deep focus mode and don't want to be interrupted."
Extracted memories:
- "Prefers meetings in the morning when they feel fresh" (type:
preference, category:preferences, basis:actual) - "Reserves afternoons for deep focus work" (type:
habit, category:professional, basis:actual)
Example 3: Plans and Possibilities
Conversation:
"My lease ends in the spring. I'm thinking about moving closer to the office, and if I do, I'll probably sell the car and get an e-bike."
Extracted memories:
- "User's lease ends in the spring" (type:
fact, category:personal, basis:actual) - "User is considering moving closer to the office when the lease ends, and replacing the car with an e-bike if they do" (type:
goal, category:personal, basis:hypothetical)
When Extraction Fails
Extraction depends on provider calls: the extraction LLM, the embeddings API, and sometimes the reconciliation LLM. All of them finish before anything is written. If one fails, the job throws and Laravel retries it. Iris doesn't save a partial batch, and the cursor stays put, so the next attempt covers the same messages.
A few cases behave differently:
- Rate limits release the job back to the queue to try again later, for up to an hour.
- An extraction refusal counts as "nothing to extract". The job completes without creating memories, and the cursor moves past the batch.
- A reconciliation refusal adds every candidate without reconciling.
- A malformed memory in the model's response gets skipped with a warning, and the rest of the batch still saves.
A job that keeps failing ends up in Horizon's failed jobs list.
NOTE
Prism reports an exhausted OpenAI credit balance the same way as a rate limit. If extraction jobs keep getting released and never complete, check your embeddings provider's billing.
One Run Per User
The ExtractMemories job is unique per user while it waits in the queue. If a reply triggers extraction while one is already queued for that user, the duplicate dispatch is dropped. The lock releases when the job starts processing, which is what lets a run queue its own follow-up for a backlog.
A WithoutOverlapping lock keyed to the user makes sure only one run executes at a time. A second job that starts while the first is still working goes back on the queue and tries again a minute later. The job also rechecks the threshold when it starts, and exits early if fewer than threshold messages are waiting.
The cursor check at commit time backs all of this up. Even if two runs did overlap, only the first to commit would write anything.
Configuration
| Setting | Default | Description |
|---|---|---|
extraction.threshold | 10 | New messages needed before a run |
extraction.max_memories | 6 | Maximum memories per run |
extraction.batch_size | 60 | Most unprocessed messages one run extracts from |
extraction.context_messages | 20 | Already-processed messages shown before the batch, for context only |
extraction.in_flight_minutes | 15 | How long a pending or streaming reply holds the batch boundary |
extraction.neighbor_limit | 5 | Existing memories compared against each candidate |
extraction.neighbor_similarity | 0.70 | Minimum cosine similarity for a neighbor |
extraction.timeout | 120 | API timeout per LLM call, in seconds |
extraction.provider | anthropic | Prism provider for extraction and reconciliation |
extraction.model | claude-sonnet-5-5 | Model for extraction and reconciliation |
WARNING
Higher max_memories limits may lead to lower-quality memories. The default encourages selectivity.
Raising neighbor_similarity sends fewer candidates to reconciliation, so more near-duplicates get added and left for consolidation. Lowering it puts more loosely related memories in front of the reconciler.
Monitoring Extraction
To see if extraction is working:
- Check the queue: The Horizon dashboard at
/horizonshould showExtractMemoriesjobs processing - View memories: The Memories page shows when memories were created
- Check the logs: Each run logs its candidate count, the memories skipped as already covered, and the number written, in
storage/logs/laravel.log - Check failed jobs: Extraction jobs that keep failing show up in Horizon's failed jobs list
Each extracted memory's metadata also records its basis, the reconciliation result, and the message range it came from (source_messages).