Skip to content

Memory System

The Memory System gives AI a “memory.” It not only tracks key decisions and progress throughout a single conversation, but also remembers your preferences, project context, and working habits across sessions — the more you use it, the better it understands you.

The memory system is divided into two layers, each with its own role:

Session MemoryUser Memory
ScopeSingle sessionAcross all sessions
LifecycleDuring sessionLong-term retention
Core PurposeCompression summaries, cross-turn contextPersonalization, knowledge inheritance
Extraction MethodAutomatic extraction + Agent-initiated savesAgent-initiated saves
Capacity Limit20 entries, ~12K tokens1,000 entries

Session Memory distills key information from ongoing conversations into 5 categories:

CategoryDescriptionExample
🎯 decisionTechnical decisions and design choices“Choose PostgreSQL as the database”
📍 contextCurrent task context“Implementing user login functionality”
📊 progressTask progress and completion status“Database schema design completed”
🚧 issueEncountered issues and solutions“CORS error, resolved by configuring middleware”
💡 learningsLessons learned and takeaways“Connection pooling can significantly improve performance”

Session Memory accumulates through automatic extraction and agent-initiated saves via two parallel paths:

Automatic extraction is performed by a background agent, triggered by the following conditions:

ConditionDescription
Initial thresholdContext tokens >= 10,000
Growth thresholdToken growth >= 5,000
Tool callsNumber of tool calls >= 3
Conversation breakpointToken threshold met + no tool calls in the last turn

💡 The background agent shares the prompt cache with the main conversation, is hard-limited to at most 5 turns, and has virtually no impact on main conversation performance.

LimitValueDescription
Maximum entries20Storage limit, per single session
Total token limit~12,000Storage limit, approximately 9 pages of documentation
Injection count5 entries per turn, up to 5,000 tokensInjected into context each turn
Overflow strategyDelete oldestRetain the most recent information

User Memory records long-term knowledge across sessions, organized into 4 categories:

CategoryDescriptionExample
👤 userUser role, goals, preferences“10 years of Go experience, new to React”
💬 feedbackUser guidance on working methods“Don’t mock the database in tests”
📁 projectProject progress, goals, decision context“Merge freeze since 2026-03-05”
🔗 referencePointers to external systems“Pipeline bug in Linear INGEST project”

Each User Memory entry has an importance rating that affects retrieval priority:

feedback and project type memories also contain a special structure:

Rule/Fact
Why: The reason provided by the user
How to apply: When/where this guidance applies

📌 This Why + How to apply structure helps AI understand the context and apply the right rules in the right scenarios.

LimitValueDescription
Maximum entries1,000Per single user
Per-entry token limit~1,000-
Overflow strategyNo automatic evictionOnly manual deletion supported (delete_user_memory tool)

User Memory uses a hybrid retrieval strategy that balances semantic understanding with exact matching:

StageStrategyDescription
Vector searchCosine similaritySemantic-level matching, Top 10
Keyword searchFull-text search + tag matchingExact keyword matching, Top 10
Fusion rankingRRF algorithmscore = Σ 1/(60 + rank), merges both result sets
Weighted filteringImportance + access frequency + recencyImportant and frequently used memories are prioritized
Final outputTop 5The 5 most relevant memories

Memories enter the AI’s context through a carefully designed injection strategy:

Memory TypeInjection TimingInjection CountTrigger
Session MemoryBefore each turn5 entries, up to 5,000 tokensAutomatic
User MemoryEvery turnDynamic importance filteringBased on embedding retrieval
Session Memory (during compression)Auto Compact triggeredAll entriesUsed as compression summary

💡 User Memory is dynamically filtered by importance: critical / high are all injected, medium injects up to 10 entries per category, low is not injected.

When the context needs to be compressed, Session Memory can serve as a summary at zero cost:

ApproachCostSummary QualitySpeed
Session Memory CompactZero API costHigher (continuously updated)Faster
Standard Auto CompactOne LLM callAverage (generated in one shot)Slower

📌 Session Memory is continuously accumulated throughout the conversation, producing a more complete and accurate summary than one generated in a single pass during compression.

FeatureDescription
🌙 Memory Consolidation (Dream Task)Periodically merge duplicate memories, delete outdated ones, and extract shared knowledge
👥 Team MemorySupport team-shared preferences, standards, and best practices
📊 Memory VisualizationView, edit, search memories in the UI, and view usage statistics