Memory Types
Every memory in Unforget has a type that controls how it’s stored, how long it lives, and how it ranks in search results. Choosing the right type helps retrieval surface the most useful information.
Three types
Insight
The most valuable type. Insights are distilled facts — things you’d want to remember forever. User preferences, biographical facts, decisions, rules. They get the highest retrieval boost (×1.5) and never expire.
await memory.write(
"User is allergic to shellfish",
memory_type="insight", # this is the default
importance=0.9,
tags=["health", "diet"],
)Good examples of insights:
- “User prefers dark mode”
- “The team deploys on Thursdays”
- “Project uses PostgreSQL 16 with pgvector”
- “Alice is the frontend lead, Bob handles infrastructure”
Event
Things that happened. Interactions, incidents, milestones — anything with an implicit timestamp. Events get a standard retrieval boost (×1.0) and decay in importance over time if they’re not accessed.
await memory.write(
"Deploy to production failed with OOM error",
memory_type="event",
tags=["deploy", "incident"],
)Good examples of events:
- “User reported a bug in the checkout flow”
- “Migrated the database to the new cluster”
- “Had a meeting about Q3 roadmap”
Raw
Temporary storage for conversation chunks. Raw memories have the lowest retrieval boost (×0.5) and auto-expire after 30 days. They’re designed to be a staging area — background consolidation promotes the useful parts into insights and lets the rest fade away.
await memory.write(
"user: I just moved to Denver from Austin\nassistant: Welcome to Denver!",
memory_type="raw",
importance=0.3,
)You rarely create raw memories directly. The ingest() method creates them for you when processing conversation transcripts.
How types affect retrieval
When you call recall(), the 4-channel retrieval scores every matching memory, then multiplies by the type boost:
| Type | Boost | Effect |
|---|---|---|
insight | ×1.5 | A relevant insight outranks an equally relevant event |
event | ×1.0 | Baseline ranking |
raw | ×0.5 | Raw chunks are deprioritized — they’re noisy by nature |
This means a partially relevant insight will often rank above a highly relevant raw chunk. The system favors distilled knowledge over raw conversation.
Lifecycle
Memories don’t just sit there. They evolve over time through consolidation:
raw (importance 0.3, expires in 30 days)
↓ background consolidation with LLM
insight (importance 0.6, permanent)
event (importance 0.5)
↓ 7+ days without being accessed → importance × 0.95
↓ 30+ days without being accessed → importance × 0.80
↓ importance drops below 0.1 → soft-deletedThis lifecycle ensures your memory store stays clean. Important information gets promoted and preserved. Stale information gradually fades. Temporary chunks expire.
Importance
Every memory has an importance score between 0.0 and 1.0. This affects three things:
- Retrieval ranking — higher importance memories score better in search results
- Decay resistance — important memories take longer to fade during consolidation
- Deletion order — when cleanup happens, low-importance memories go first
You can set importance explicitly when writing, or let consolidation adjust it based on access patterns. Memories that get recalled frequently have their importance maintained; memories nobody asks about gradually decay.