ClawSkills logoClawSkills

Memory Setup

启用并配置 Moltbot/Clawdbot 内存搜索以实现持久上下文。用于设置内存、修复“金鱼脑”或帮助用户配置内

介绍

# Memory Setup Skill

将您的智能体从金鱼变成大象。此技能有助于为 Moltbot/Clawdbot 配置持久化记忆。

## 快速设置

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

添加到 `~/.clawdbot/clawdbot.json`(或 `moltbot.json`):

```json { "memorySearch": { "enabled": true, "provider": "voyage", "sources": ["memory", "sessions"], "indexMode": "hot", "minScore": 0.3, "maxResults": 20 } } ```

### 2. 创建记忆结构

在工作区中创建:

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

### 3. 初始化 MEMORY.md

在工作区根目录创建 `MEMORY.md`:

```markdown # MEMORY.md — Long-Term Memory

## 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 ```

## 配置选项说明

| 设置 | 目的 | 推荐值 | |---------|---------|-------------| | `enabled` | 开启记忆搜索 | `true` | | `provider` | 嵌入模型提供商 | `"voyage"` | | `sources` | 索引内容 | `["memory", "sessions"]` | | `indexMode` | 索引时机 | `"hot"`(实时)| | `minScore` | 相关性阈值 | `0.3`(越低结果越多)| | `maxResults` | 返回的最大片段数 | `20` |

### 提供商选项 - `voyage` — Voyage AI 嵌入(推荐) - `openai` — OpenAI 嵌入 - `local` — 本地嵌入(无需 API)

### 来源选项 - `memory` — MEMORY.md + memory/*.md 文件 - `sessions` — 过往对话记录 - `both` — 完整上下文(推荐)

## 每日日志格式

每天创建 `memory/logs/YYYY-MM-DD.md`:

```markdown # YYYY-MM-DD — Daily Log

## [Time] — [Event/Task] - What happened - Decisions made - Follow-ups needed

## [Time] — [Another Event] - Details ```

## 智能体指令 (AGENTS.md)

添加到您的 AGENTS.md 以规范智能体行为:

```markdown ## 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 ```

## 故障排查

### 记忆搜索不工作? 1. 检查配置中 `memorySearch.enabled: true` 2. 确认工作区根目录存在 MEMORY.md 3. 重启网关:`clawdbot gateway restart`

### 结果不相关? - 将 `minScore` 降低至 `0.2` 以获取更多结果 - 将 `maxResults` 增加至 `30` - 检查记忆文件是否包含有意义的内容

### 提供商报错? - Voyage:在环境中设置 `VOYAGE_API_KEY` - OpenAI:在环境中设置 `OPENAI_API_KEY` - 如果没有可用的 API 密钥,请使用 `local` 提供商

## 验证

测试记忆是否正常工作:

``` User: "What do you remember about [past topic]?" Agent: [Should search memory and return relevant context] ```

如果智能体没有记忆,说明配置未生效。请重启网关。

## 完整配置示例

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

## 为何重要

没有记忆: - 智能体在会话之间会遗忘一切 - 重复提问,丢失上下文 - 项目缺乏连续性

拥有记忆: - 回忆过往对话 - 了解您的偏好 - 追踪项目历史 - 随着时间推移建立关系

金鱼 → 大象。🐘

更多产品