memory-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Setup Skill

记忆设置技能

Transform your agent from goldfish to elephant. This skill helps configure persistent memory for Moltbot/Clawdbot.
将你的Agent从只有7秒记忆的金鱼变成过目不忘的大象,该技能可帮助你为Moltbot/Clawdbot配置持久化记忆。

Quick Setup

快速设置

1. Enable Memory Search in Config

1. 在配置文件中启用记忆搜索

Add to
~/.clawdbot/clawdbot.json
(or
moltbot.json
):
json
{
  "memorySearch": {
    "enabled": true,
    "provider": "voyage",
    "sources": ["memory", "sessions"],
    "indexMode": "hot",
    "minScore": 0.3,
    "maxResults": 20
  }
}
添加以下配置到
~/.clawdbot/clawdbot.json
(或
moltbot.json
)中:
json
{
  "memorySearch": {
    "enabled": true,
    "provider": "voyage",
    "sources": ["memory", "sessions"],
    "indexMode": "hot",
    "minScore": 0.3,
    "maxResults": 20
  }
}

2. Create Memory Structure

2. 创建记忆目录结构

In your workspace, create:
workspace/
├── MEMORY.md              # Long-term curated memory
└── memory/
    ├── logs/              # Daily logs (YYYY-MM-DD.md)
    ├── projects/          # Project-specific context
    ├── groups/            # Group chat context
    └── system/            # Preferences, setup notes
在你的工作区中创建如下目录结构:
workspace/
├── MEMORY.md              # 长期维护的记忆文件
└── memory/
    ├── logs/              # 日常日志(命名格式为YYYY-MM-DD.md)
    ├── projects/          # 项目专属上下文
    ├── groups/            # 群组聊天上下文
    └── system/            # 偏好设置、安装记录

3. Initialize MEMORY.md

3. 初始化MEMORY.md

Create
MEMORY.md
in workspace root:
markdown
undefined
在工作区根目录创建
MEMORY.md
文件:
markdown
undefined

MEMORY.md — Long-Term Memory

MEMORY.md — 长期记忆

About [User Name]

关于[用户名]

  • Key facts, preferences, context
  • 关键信息、偏好、背景上下文

Active Projects

进行中的项目

  • Project summaries and status
  • 项目概述和进度

Decisions & Lessons

决策与经验教训

  • Important choices made
  • Lessons learned
  • 已做出的重要选择
  • 总结的经验教训

Preferences

偏好设置

  • Communication style
  • Tools and workflows
undefined
  • 沟通风格
  • 工具和工作流偏好
undefined

Config Options Explained

配置选项说明

SettingPurposeRecommended
enabled
Turn on memory search
true
provider
Embedding provider
"voyage"
sources
What to index
["memory", "sessions"]
indexMode
When to index
"hot"
(real-time)
minScore
Relevance threshold
0.3
(lower = more results)
maxResults
Max snippets returned
20
设置项用途推荐值
enabled
开启记忆搜索
true
provider
嵌入模型提供商
"voyage"
sources
要索引的内容来源
["memory", "sessions"]
indexMode
索引时机
"hot"
(实时索引)
minScore
相关性阈值
0.3
(值越低返回结果越多)
maxResults
返回的最大片段数
20

Provider Options

提供商可选值

  • voyage
    — Voyage AI embeddings (recommended)
  • openai
    — OpenAI embeddings
  • local
    — Local embeddings (no API needed)
  • voyage
    — Voyage AI嵌入模型(推荐)
  • openai
    — OpenAI嵌入模型
  • local
    — 本地嵌入模型(无需API密钥)

Source Options

来源可选值

  • memory
    — MEMORY.md + memory/*.md files
  • sessions
    — Past conversation transcripts
  • both
    — Full context (recommended)
  • memory
    — MEMORY.md + memory目录下所有.md文件
  • sessions
    — 过往对话记录
  • both
    — 全部上下文(推荐)

Daily Log Format

日常日志格式

Create
memory/logs/YYYY-MM-DD.md
daily:
markdown
undefined
每日创建
memory/logs/YYYY-MM-DD.md
文件,格式如下:
markdown
undefined

YYYY-MM-DD — Daily Log

YYYY-MM-DD — 日常日志

[Time] — [Event/Task]

[时间] — [事件/任务]

  • What happened
  • Decisions made
  • Follow-ups needed
  • 发生的内容
  • 做出的决策
  • 需要跟进的事项

[Time] — [Another Event]

[时间] — [其他事件]

  • Details
undefined
  • 详情
undefined

Agent Instructions (AGENTS.md)

Agent使用说明(AGENTS.md)

Add to your AGENTS.md for agent behavior:
markdown
undefined
添加以下内容到AGENTS.md中定义Agent行为:
markdown
undefined

Memory Recall

记忆召回

Before answering questions about prior work, decisions, dates, people, preferences, or todos:
  1. Run memory_search with relevant query
  2. Use memory_get to pull specific lines if needed
  3. If low confidence after search, say you checked
undefined
在回答关于过往工作、决策、日期、人物、偏好或待办的问题前:
  1. 使用相关关键词运行memory_search
  2. 必要时使用memory_get拉取特定行内容
  3. 如果搜索后置信度较低,告知用户你已经查询过记忆库
undefined

Troubleshooting

故障排查

Memory search not working?

记忆搜索不工作?

  1. Check
    memorySearch.enabled: true
    in config
  2. Verify MEMORY.md exists in workspace root
  3. Restart gateway:
    clawdbot gateway restart
  1. 检查配置中
    memorySearch.enabled: true
    是否设置正确
  2. 确认工作区根目录存在MEMORY.md文件
  3. 重启网关:
    clawdbot gateway restart

Results not relevant?

搜索结果不相关?

  • Lower
    minScore
    to
    0.2
    for more results
  • Increase
    maxResults
    to
    30
  • Check that memory files have meaningful content
  • minScore
    调低到
    0.2
    获取更多结果
  • maxResults
    调高到
    30
  • 检查记忆文件内容是否有实际意义

Provider errors?

提供商报错?

  • Voyage: Set
    VOYAGE_API_KEY
    in environment
  • OpenAI: Set
    OPENAI_API_KEY
    in environment
  • Use
    local
    provider if no API keys available
  • Voyage:在环境变量中设置
    VOYAGE_API_KEY
  • OpenAI:在环境变量中设置
    OPENAI_API_KEY
  • 如果没有API密钥,可以使用
    local
    提供商

Verification

验证

Test memory is working:
User: "What do you remember about [past topic]?"
Agent: [Should search memory and return relevant context]
If agent has no memory, config isn't applied. Restart gateway.
测试记忆功能是否正常工作:
用户:「你记得[过往话题]的相关内容吗?」
Agent:[应该搜索记忆库并返回相关上下文]
如果Agent没有相关记忆,说明配置未生效,请重启网关。

Full Config Example

完整配置示例

json
{
  "memorySearch": {
    "enabled": true,
    "provider": "voyage",
    "sources": ["memory", "sessions"],
    "indexMode": "hot",
    "minScore": 0.3,
    "maxResults": 20
  },
  "workspace": "/path/to/your/workspace"
}
json
{
  "memorySearch": {
    "enabled": true,
    "provider": "voyage",
    "sources": ["memory", "sessions"],
    "indexMode": "hot",
    "minScore": 0.3,
    "maxResults": 20
  },
  "workspace": "/path/to/your/workspace"
}

Why This Matters

使用意义

Without memory:
  • Agent forgets everything between sessions
  • Repeats questions, loses context
  • No continuity on projects
With memory:
  • Recalls past conversations
  • Knows your preferences
  • Tracks project history
  • Builds relationship over time
Goldfish → Elephant. 🐘
没有记忆的情况下:
  • Agent在会话之间会遗忘所有内容
  • 重复提问,丢失上下文
  • 项目推进没有连续性
有记忆的情况下:
  • 可以回忆过往对话内容
  • 了解你的使用偏好
  • 跟踪项目历史进度
  • 长期构建使用关联
金鱼→大象。🐘