Neutron Memory:语义上下文与持久化 AI 记忆 - Openclaw Skills

作者:互联网

2026-03-23

AI教程

什么是 Neutron Memory?

Neutron Memory 是为 AI 智能体设计的先进长期存储与检索系统,使其能够在单次对话之外保持连贯性。通过将其集成到您的 Openclaw Skills 工作流中,您的智能体可以将关键偏好、技术决策和用户交互保存到基于向量的记忆库中。

与传统的关键词搜索不同,Neutron Memory 利用语义理解通过含义查找相关上下文。这确保了最相关的信息始终可供智能体使用,从而实现个性化且高效的用户体验,并随着智能体对您的项目和工作流程的深入了解而不断进化。

下载入口:https://github.com/openclaw/skills/tree/main/skills/naeemmaliki036/vanar-neutron-memory

安装与下载

1. ClawHub CLI

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

npx clawhub@latest install vanar-neutron-memory

2. 手动安装

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

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

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

3. 提示词安装

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

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

Neutron Memory 应用场景

  • 在不同的项目目录中持久化用户的编码风格和架构偏好。
  • 构建特定于项目的知识库,智能体可以查询该库以了解之前的设计决策。
  • 通过自动将相关的历史交互注入当前提示词,减少手动设置上下文的操作。
  • 为多智能体系统创建共享记忆池,以同步知识和状态。
Neutron Memory 工作原理
  1. 通过 CLI 命令手动捕获数据,或通过集成的生命周期钩子自动捕获数据。
  2. 信息被发送到 Neutron API,在那里使用向量嵌入进行处理和存储。
  3. 当智能体需要信息时,会执行语义搜索查询,根据当前对话上下文查找最相关的“记忆”。
  4. 检索相关结果,并可选地将其注入回智能体的提示词中,以提供即时、可操作的上下文。

Neutron Memory 配置指南

要开始使用 Openclaw Skills 的此记忆层,请按照以下步骤操作:

  1. 在 https://openclaw.vanarchain.com/ 生成免费的 API 密钥。
  2. 设置您的环境变量:
export API_KEY=nk_your_key
  1. 使用诊断工具验证安装和连接性:
./scripts/neutron-memory.sh test

Neutron Memory 数据架构与分类体系

该技能按语义组织数据,侧重于内容和意图。以下是用于记忆管理的主要结构:

属性 描述 示例
内容 要记忆的实际文本或对话轮次 "用户更倾向于使用 React 而非 Vue"
标题 记忆的分类标签 "偏好"
阈值 语义匹配的相似度得分 (0-1) 0.5
限制 要召回的记忆最大数量 10
name: vanar-neutron-memory
description: Save and recall agent memory with semantic search. Context that persists across every session.
user-invocable: true
metadata: {"openclaw": {"emoji": "??", "requires": {"env": ["API_KEY"]}, "primaryEnv": "API_KEY"}}

Neutron Memory

Every conversation, preference, and decision your agent makes can persist across sessions. Save what matters, and when you need it, semantic search finds the right context by meaning — not keywords. Every session builds on the last.

How It Works

Manual — save and search with simple commands:

  1. ./scripts/neutron-memory.sh save "user prefers dark mode" "Preferences" — save context
  2. ./scripts/neutron-memory.sh search "what theme does the user like" — find it by meaning

Automatic (opt-in) — enable hooks to capture and recall automatically:

  1. Auto-Capture saves conversations after each AI turn
  2. Auto-Recall finds relevant memories before each AI turn and injects them as context

Quick Start

See SETUP.md for the full setup guide. TL;DR:

  1. Get a free API key at https://openclaw.vanarchain.com/ ($20 free credits, no credit card)
  2. export API_KEY=nk_your_key
  3. ./scripts/neutron-memory.sh test

Commands

Save

./scripts/neutron-memory.sh save "Content to remember" "Title"
./scripts/neutron-memory.sh search "what do I know about X" 10 0.5

Arguments: QUERY LIMIT THRESHOLD(0-1)

Diagnose

./scripts/neutron-memory.sh diagnose

Checks all prerequisites: curl, jq, API key, connectivity, and authentication.

Hooks (Auto-Capture & Auto-Recall)

  • hooks/pre-tool-use.shAuto-Recall: Queries memories before AI turn, injects relevant context
  • hooks/post-tool-use.shAuto-Capture: Saves conversation after AI turn

Both are disabled by default (opt-in only). To enable:

export VANAR_AUTO_RECALL=true
export VANAR_AUTO_CAPTURE=true

API Endpoints

  • POST /memory/save — Save text (multipart/form-data)
  • POST /memory/search — Semantic search (JSON body)

Auth: Authorization: Bearer $API_KEY — that's it. No other credentials needed.

Security & Privacy

No data is sent unless you run a command or explicitly enable auto-capture/auto-recall. Both hooks are disabled by default.

This skill only sends data you explicitly save (or opt-in auto-captured conversations) to the Neutron API. Here's exactly what happens:

Action What's sent Where
Save The text you pass to save or auto-captured conversation turns POST /memory/save over HTTPS
Search Your search query text POST /memory/search over HTTPS
Auto-Recall The user's latest message (used as search query) POST /memory/search over HTTPS
Auto-Capture User: {message} Assistant: {response} POST /memory/save over HTTPS

What is NOT sent:

  • No local files are read or uploaded
  • No environment variables (other than the API key for auth)
  • No system information, file paths, or directory contents
  • No data from other tools or skills

All communication is over HTTPS to api-neutron.vanarchain.com. The source code is fully readable in the scripts/ and hooks/ directories — three short bash scripts, no compiled binaries.