Skip to content

Memory Configuration Memory

Configure the long-term memory system.

Overview

The memory system stores structured user memories in the structured_memories table, extracts information from conversations automatically, and injects relevant memories into later chats.

Basic Configuration

yaml
memory:
  enabled: false          # Enable memory system
  storage: database       # Storage: database | file
  autoExtract: true       # Auto-extract from conversations
  pollInterval: 5         # Poll interval (minutes)
  minPollInterval: 30     # Min interval between two poll summaries for
                          # the same conversation target (minutes);
                          # defaults to 30 when unset. Read dynamically
                          # by MemoryManager.pollAndSummarize.
  maxMemories: 50         # Max memories per user
  model: ""               # Model for memory extraction (empty = default)

Configuration Options

OptionTypeDefaultDescription
enabledbooleanfalseEnable memory
storagestringdatabaseStorage backend
autoExtractbooleantrueAuto-extract memories
pollIntervalnumber5Poll interval (minutes)
minPollIntervalnumber30Min interval between poll summaries per target (minutes)
maxMemoriesnumber50Max memories per user
modelstring""Extraction model (empty = default)

Group Context Collection

yaml
memory:
  groupContext:
    enabled: true               # Enable group context collection
    collectInterval: 10         # Collection interval (minutes)
    maxMessagesPerCollect: 50   # Max messages per collection
    analyzeThreshold: 20        # Min messages to trigger analysis
    extractUserInfo: true       # Extract user info
    extractTopics: true         # Extract discussion topics
    extractRelations: true      # Extract user relations

Memory Summaries

Memory summaries produce structured output: every line is [category] content with a category whitelist (profile / preference / event / relation / topic / custom). Model reasoning text never reaches storage. The summarize endpoint also performs cleanup:

http
POST /api/memories/user/:userId/summarize
POST /api/memories/user/:userId/cleanup
ParamTypeDefaultDescription
useLLMbooleantrueUse LLM summarization
cleanupbooleantrueRun low-quality cleanup after summary (false / 'false' skips it)
groupIdstring-Limit to group
modelstring-Summary model override

Also see Memory Command and the API reference for details.

Manual Memory Commands

txt
#ai添加记忆 @用户 喜欢吃披萨    # Add memory (master)
#ai查看记忆                    # List memories
#ai清除记忆                    # Clear memories

Next Steps

Released under the MIT License