2830201534/pidan-memory/SKILL.md
# Pidan Memory Skill 本地持久化向量记忆系统,为 AI Assistant 提供长期记忆能力。支持多用户/共享模式。 ## 概述 基于 **LanceDB + Ollama** 实现的本地向量记忆系统,支持语义搜索和多用户隔离。 ## 架构 ``` 用户输入 → Ollama (向量化) → LanceDB (存储/搜索) ↑ nomic-embed-text (768维向量) ``` ## 功能 ### 1. 自动记忆(推荐) **安装 Hook 后自动生效,无需手动调用!** 每次对话后自动评估并存储重要信息,覆盖 16 大类场景。 **安装方式:** ```bash # 1. 复制文件 mkdir -p ~/.openclaw/hooks/pidan-memory cp HOOK.md handler.ts ~/.openclaw/hooks/pidan-memory/ cp auto_memory.py ~/.openclaw/workspace/memory/ # 2
npx skillsauth add openclaw/skills 2830201534/pidan-memoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
本地持久化向量记忆系统,为 AI Assistant 提供长期记忆能力。支持多用户/共享模式。
基于 LanceDB + Ollama 实现的本地向量记忆系统,支持语义搜索和多用户隔离。
用户输入 → Ollama (向量化) → LanceDB (存储/搜索)
↑
nomic-embed-text (768维向量)
安装 Hook 后自动生效,无需手动调用!
每次对话后自动评估并存储重要信息,覆盖 16 大类场景。
安装方式:
# 1. 复制文件
mkdir -p ~/.openclaw/hooks/pidan-memory
cp HOOK.md handler.ts ~/.openclaw/hooks/pidan-memory/
cp auto_memory.py ~/.openclaw/workspace/memory/
# 2. 启用
openclaw hooks enable pidan-memory
openclaw gateway restart
手动存储重要信息到向量数据库
参数:
content: 记忆内容 (必填)summary: 摘要 (可选)importance: 重要程度 1-5 (默认 3)user_id: 用户 ID (默认 default)示例:
{
"command": "remember",
"parameters": {
"content": "用户最喜欢吃火锅",
"summary": "饮食偏好",
"importance": 4,
"user_id": "default"
}
}
语义向量搜索
参数:
query: 搜索关键词limit: 返回数量 (默认 5)user_id: 用户 ID获取用户的有权限访问的记忆
{
"command": "get_mode",
"parameters": {}
}
{
"command": "set_mode",
"parameters": {
"mode": "private" // 或 "shared"
}
}
模式说明:
private: 多用户模式(默认),每个用户记忆独立隔离shared: 共享模式,所有用户可互相查询共享记忆删除记忆(需二次确认,只有创建人可删除)
参数:
memory_id: 记忆 ID (必填)confirm: 是否确认删除 (默认 false)首次请求(获取确认):
{
"command": "delete_memory",
"parameters": {
"memory_id": "uuid-xxx",
"confirm": false
}
}
确认删除:
{
"command": "delete_memory",
"parameters": {
"memory_id": "uuid-xxx",
"confirm": true
}
}
权限规则:
将记忆共享给指定用户(只有创建人可以共享)
参数:
memory_id: 记忆 ID (必填)visible_to: 可见用户列表 (默认 []) - 空=私有user_id: 请求者 ID (用于权限校验)示例 - 共享给指定用户:
{
"command": "share_memory",
"parameters": {
"memory_id": "uuid-xxx",
"visible_to": ["user_a", "user_b"],
"user_id": "default"
}
}
示例 - 取消共享(设为私有):
{
"command": "share_memory",
"parameters": {
"memory_id": "uuid-xxx",
"visible_to": [],
"user_id": "default"
}
}
权限规则:
列出用户有权限访问的所有记忆
手动触发去重(每 20 条自动触发)
获取记忆统计信息
配置文件:~/.openclaw/workspace/memory/config.yaml
memory:
mode: private # private | shared
deduplicate_after: 20 # 每N条自动去重
或通过环境变量:
MEMORY_MODE=private
MEMORY_DEDUP_AFTER=20
~/.openclaw/workspace/memory/lance/ # LanceDB 数据
| 组件 | 作用 | |------|------| | LanceDB | 向量存储/搜索 | | Ollama | 本地 embedding 模型 | | nomic-embed-text | 768维向量 |
# 添加记忆
echo '{"command": "remember", "parameters": {"content": "测试"}}' | python3 run.py
# 搜索
echo '{"command": "recall", "parameters": {"query": "测试"}}' | python3 run.py
# 获取模式
echo '{"command": "get_mode", "parameters": {}}' | python3 run.py
# 设置模式
echo '{"command": "set_mode", "parameters": {"mode": "shared"}}' | python3 run.py
# 删除记忆(首次)
echo '{"command": "delete_memory", "parameters": {"memory_id": "xxx"}}' | python3 run.py
所有命令通过 环境变量 OPENCLAW_USER_ID 获取真实用户ID,防止伪造:
# 设置用户ID
export OPENCLAW_USER_ID=your_user_id
python3 run.py ...
通过 Hook 自动触发时,用户ID由平台传递( DingTalk openid 等),自动注入环境变量。
tools
Use when the user wants to connect to, test, or use the McDonalds service at mcp.mcd.cn, including checking authentication, probing MCP endpoints, listing tools, or calling McDonalds MCP tools through a reusable local CLI.
development
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
development
SlowMist AI Agent Security Review — comprehensive security framework for skills, repositories, URLs, on-chain addresses, and products (Claude Code version)
data-ai
去除中文文本中的 AI 写作痕迹,使其读起来自然。基于维基百科 AI 写作特征指南,检测 24 种 AI 模式。触发词:humanizer-cn、去除 AI 痕迹、去除 AI 写作痕迹、中文文本人性化。