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 built on the OKF (Open Knowledge Format) unified model. All memories are stored in a single knowledge base, distinguished by the Scope field:

Session MemoryUser MemoryGlobal Memory
Scopesessionuserglobal
Scope BoundarySingle sessionAcross all sessionsAcross all users
LifecycleDuring sessionLong-term retentionLong-term retention
Core PurposeCompression summaries, cross-turn contextPersonalization, knowledge inheritanceTeam-shared knowledge (reserved)
Extraction MethodAutomatic background extractionAgent-initiated saves—
Capacity Limit20 entries, ~12K tokens1,000 entries—

📌 Global Memory is defined in the OKF model but not yet exposed via agent read/write tools. It is reserved for future team-shared knowledge scenarios.

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 is automatically extracted by a background agent, distilling key information from ongoing conversations into 5 categories:

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 (deleteMemory tool)

User Memory uses a word-level OR matching keyword retrieval strategy that balances recall and ranking quality:

StageStrategyDescription
TokenizationSpace-delimited splitQuery "saveMemory tool test" splits into 3 words
MatchingWord-level ORA memory matches if it contains any of the words (in title/content/description)
SortingRecencyMost recently updated results rank first
OutputTop NDefault 5 results, configurable

💡 Word-level OR matching provides higher recall than phrase matching — a query like "saveMemory tool test" matches memories containing any of saveMemory, tool, or test. The search uses SQL LIKE pattern matching, automatically using ILIKE (case-insensitive) on PostgreSQL.

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 keyword 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