详情

首页手游攻略 记忆设置:为 AI 智能体启用持久上下文 - Openclaw Skills

记忆设置:为 AI 智能体启用持久上下文 - Openclaw Skills

佚名 2026-08-08 20:25:01

什么是 记忆设置技能?

记忆设置技能是一个全面的配置框架,旨在消除 AI 驱动的开发工作流中的上下文丢失。通过利用 Openclaw Skills,开发者可以将他们的智能体从无状态的参与者转变为具备上下文感知能力的助手,能够跨多个会话记住过去的决策、项目历史和特定的用户偏好。

该技能建立了一个结构化的环境,使用语义搜索来存储和检索信息。它与嵌入提供商集成,对每日日志、会话转录和精选的长期记忆文件进行索引。这确保了智能体能够主动召回相关的技术细节,减少重复提问并提高复杂软件项目的连续性。

下载入口:https://github.com/openclaw/skills/tree/main/skills/jrbobbyhansen-pixel/memory-setup

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install memory-setup

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 <project>/skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 memory-setup。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

记忆设置技能 应用场景

  • 在跨越数周的长期软件工程项目中保持连续性。
  • 检索过去编码会话中的特定架构决策或经验教训。
  • 管理个性化的开发者偏好,包括编码风格和特定的工具配置。
  • 自动索引每日日志以跟踪进度和待处理的后续任务。
  • 在统一的工作区内为多智能体工作流创建共享知识库。
记忆设置技能 工作原理
  1. 在全局设置中定义配置,以启用记忆搜索引擎并选择嵌入提供商。
  2. 在工作区中初始化专用的目录结构,以区分日志、项目上下文和系统偏好。
  3. 创建一个核心的 MEMORY.md 文件,作为高级项目事实和用户上下文的主要信任源。
  4. 智能体使用记忆搜索功能对索引的 Markdown 文件执行基于向量的查询。
  5. 根据检索到的片段的语义相关性,将上下文动态注入到对话中。

记忆设置技能 配置指南

要通过 Openclaw Skills 启用持久上下文,请将以下配置添加到您的 ~/.clawdbot/clawdbot.jsonmoltbot.json 文件中:

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

使用以下命令初始化您的工作区目录结构:

mkdir -p memory/logs memory/projects memory/groups memory/system
touch MEMORY.md

最后,确保在您的环境中导出或在智能体的秘密管理中添加 Voyage AI 或 OpenAI 等提供商的 API 密钥。

记忆设置技能 数据架构与分类体系

该技能利用分层 Markdown 模式来组织和索引信息,以便高效检索。

数据组件 位置 内容类型
长期记忆 /MEMORY.md 精选事实、项目摘要和决策
每日活动 /memory/logs/ 记录每日任务的日期标记日志 (YYYY-MM-DD.md)
项目上下文 /memory/projects/ 详细的技术文档和特定于项目的笔记
用户偏好 /memory/system/ 开发环境设置和沟通风格
会话历史 /sessions/ 自动生成的对话转录
name: memory-setup
description: Enable and configure Moltbot/Clawdbot memory search for persistent context. Use when setting up memory, fixing "goldfish brain," or helping users configure memorySearch in their config. Covers MEMORY.md, daily logs, and vector search setup.

Memory Setup Skill

Transform your agent from goldfish to elephant. This skill helps configure persistent memory for Moltbot/Clawdbot.

Quick Setup

1. Enable Memory Search in Config

Add to ~/.clawdbot/clawdbot.json (or moltbot.json):

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

2. Create Memory Structure

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

3. Initialize MEMORY.md

Create MEMORY.md in workspace root:

# 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

Config Options Explained

Setting Purpose Recommended
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

Provider Options

  • voyage — Voyage AI embeddings (recommended)
  • openai — OpenAI embeddings
  • local — Local embeddings (no API needed)

Source Options

  • memory — MEMORY.md + memory/*.md files
  • sessions — Past conversation transcripts
  • both — Full context (recommended)

Daily Log Format

Create memory/logs/YYYY-MM-DD.md daily:

# YYYY-MM-DD — Daily Log

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

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

Agent Instructions (AGENTS.md)

Add to your AGENTS.md for agent behavior:

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

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

Results not relevant?

  • Lower minScore to 0.2 for more results
  • Increase maxResults to 30
  • Check that memory files have meaningful content

Provider errors?

  • Voyage: Set VOYAGE_API_KEY in environment
  • OpenAI: Set OPENAI_API_KEY in environment
  • Use local provider if no API keys available

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.

Full Config Example

{
  "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. ??

相关资讯
点击查看更多
游戏推荐
推荐专题
热门阅读
推荐下载