← Back to Skills Marketplace
kk-kingkong

Ollama Memory

by kk.Tang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
348
Downloads
0
Stars
3
Active Installs
1
Versions
Install in OpenClaw
/install ollama-memory
Description
本地向量记忆系统 - 基于 Ollama + SQLite 的 AI 助手记忆方案。 支持:Markdown 记录、向量搜索、本地嵌入、无 API 费用。 特点:本地部署、语义搜索、隐私优先。
README (SKILL.md)

本地向量记忆系统

这是一个带本地向量搜索的 AI 助手记忆系统,基于 Markdown 文件 + SQLite 实现。

目录结构

~/.openclaw/workspace/
├── memory/
│   └── YYYY-MM-DD.md      # 每日记录
├── MEMORY.md               # 长期记忆(核心认知)
├── SOUL.md                 # AI 人格定义
├── USER.md                 # 用户信息
├── AGENTS.md               # 工作规范
└── scripts/memory-system/  # 记忆系统脚本

核心文件

1. memory/YYYY-MM-DD.md - 每日记录

每次会话记录当天发生的事:

# 2026-03-09

## 会话 1
- 主题:xxx
- 关键决策:xxx
- 待办:xxx

## 会话 2
- ...

2. MEMORY.md - 长期记忆

核心认知和重要信息,包含:

  • 核心工作原则
  • 用户偏好
  • 关键教训
  • 禁止事项
  • 习惯

向量搜索

使用本地 Ollama + nomic-embed-text 模型实现向量语义搜索。

安装 Ollama 和模型

# 安装 Ollama
brew install ollama

# 启动服务
ollama serve

# 下载 embedding 模型
ollama pull nomic-embed-text

搜索命令

# 使用 Python 脚本搜索(推荐)
python3 ~/.openclaw/workspace/scripts/memory-system/context-memory.py search "关键词"

# 简单搜索
python3 ~/.openclaw/workspace/scripts/memory-system/memory-py.py search "关键词"

会话启动流程

每次新会话开始时:

  1. 读取 SOUL.md — AI 人格
  2. 读取 USER.md — 用户信息
  3. 读取 memory/YYYY-MM-DD.md (今天 + 昨天)
  4. 主会话:读取 MEMORY.md
  5. 检查 knowledge/ 目录

保存记忆

当用户说"记住...":

  • 更新 memory/YYYY-MM-DD.md 记录
  • 重要内容同步到 MEMORY.md
  • 可选:存入向量数据库
# 添加记忆(带重要性评分)
python3 ~/.openclaw/workspace/scripts/memory-system/context-memory.py add "内容" 8

# 添加标签
python3 ~/.openclaw/workspace/scripts/memory-system/memory-py.py add "内容" "标签1,标签2"

更新规则

必须更新的文件

  1. memory/YYYY-MM-DD.md - 每次会话
  2. MEMORY.md - 新教训/重要信息
  3. SOUL.md - 人格变化
  4. USER.md - 用户偏好变化

更新时机

  • 任务完成时
  • 重要发现或教训
  • 用户偏好变化
  • 新技能学习

安全规则

  • 不暴露用户个人信息
  • ❌ 不在 skill 输出中包含真实姓名/账号/密码
  • ❌ 不在公开场合提及用户隐私
  • ✅ 需要时才读取 MEMORY.md
  • ✅ 主会话才加载 MEMORY.md

配置示例

在 AGENTS.md 中添加:

## Memory

### 每日记录 (memory/YYYY-MM-DD.md)
- 每次会话记录关键内容
- 格式:## 会话 X / ### 主题 / 决策 / 待办

### 长期记忆 (MEMORY.md)
- 核心原则和偏好
- 重要教训
- 禁止事项
- 仅主会话加载

### 向量搜索
- 模型:Ollama + nomic-embed-text
- 脚本:context-memory.py

优势

特点 说明
本地向量 无 API 费用,离线可用
语义搜索 理解相似含义,不只是关键词
可读 Markdown 人工可直接编辑
便携 文件复制即迁移
安全 本地存储,不上传云端

依赖

  • Ollama: 本地 LLM 运行时
  • nomic-embed-text: 本地 embedding 模型 (274MB)
  • Python 3: 运行脚本
  • SQLite: 向量存储

快速开始

# 1. 安装 Ollama
brew install ollama

# 2. 启动并下载模型
ollama serve
ollama pull nomic-embed-text

# 3. 初始化数据库
python3 ~/.openclaw/workspace/scripts/memory-system/context-memory.py init

# 4. 添加记忆
python3 ~/.openclaw/workspace/scripts/memory-system/context-memory.py add "用户偏好使用 Gemini" 8

# 5. 搜索记忆
python3 ~/.openclaw/workspace/scripts/memory-system/context-memory.py search "模型偏好"
Usage Guidance
This skill appears to be what it says: a local Ollama + SQLite memory system. However: 1) SKILL.md references Python scripts at ~/.openclaw/workspace/scripts/memory-system/ but the skill bundle does not include those scripts — do not run the example commands until you have those scripts and have manually reviewed their contents. 2) Installing and running Ollama will download models (nomic-embed-text ~274MB) and start a local service — confirm you want that on your machine. 3) The system stores persistent files under ~/.openclaw/workspace (MEMORY.md, USER.md, daily notes) which can contain sensitive data; restrict filesystem permissions and back up or encrypt as needed. 4) Before running any commands from this SKILL.md, verify Ollama is installed from an official source (Homebrew or official website) and inspect any third-party scripts to ensure they do not send data to external endpoints. If you want greater assurance, ask the skill author for the referenced scripts or a packaged implementation so you can audit them first.
Capability Analysis
Type: OpenClaw Skill Name: ollama-memory Version: 1.0.0 The skill bundle provides documentation and instructions for a local vector memory system using Ollama and SQLite. It defines a structured approach for an AI agent to manage long-term and short-term memories through Markdown files and local scripts (e.g., `context-memory.py`). The instructions in SKILL.md are aligned with the stated purpose of enhancing agent memory while emphasizing privacy and local storage, with no evidence of malicious intent, data exfiltration, or harmful prompt injections.
Capability Assessment
Purpose & Capability
Name/description (local vector memory using Ollama + SQLite) matches the declared requirements: python3, sqlite3, and ollama. Requested binaries and described workflows (pull embedding model, run local server, use Python scripts to add/search) are consistent with the stated purpose.
Instruction Scope
SKILL.md instructs the agent to read and update files under ~/.openclaw/workspace (SOUL.md, USER.md, memory/*.md, MEMORY.md) and to run Python scripts in ~/.openclaw/workspace/scripts/memory-system/. Those file reads/writes are expected for a local memory system, but the skill does not include the referenced scripts — the instructions assume external code exists. Before executing, the user/agent should verify those scripts' presence and review them to ensure they do only the expected local operations (indexing/search) and do not transmit data externally.
Install Mechanism
No install spec in the skill (instruction-only). The README suggests installing Ollama via Homebrew and pulling the nomic-embed-text model through Ollama — both are standard, well-scoped steps. No downloads from unknown personal servers or extract/install steps are embedded in the skill text.
Credentials
The skill requests no environment variables or credentials. Its described behavior (local files, local model) does not require external secrets, so requested access is proportionate. Note: the system will read/write user data files under the home directory, which may contain sensitive info.
Persistence & Privilege
Skill is not always-enabled and is user-invocable (normal). It expects to write/read persistent files in ~/.openclaw/workspace (memory and profile files) — appropriate for a memory plugin but worth noting: persistent local storage will contain sensitive user data and should be protected (file permissions, backups).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ollama-memory
  3. After installation, invoke the skill by name or use /ollama-memory
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- 首次发布本地向量记忆系统,基于 Ollama + SQLite 实现。 - 支持 Markdown 记录、向量语义搜索、本地 embedding,无 API 费用。 - 兼顾隐私与可读性,所有数据存储于本地,易于迁移和人工编辑。 - 提供每日记录、长期记忆、AI 人格等核心文件结构与自动化更新流程。 - 集成本地 Ollama embedding 模型和 Python 脚本,便捷添加与检索记忆。
Metadata
Slug ollama-memory
Version 1.0.0
License MIT-0
All-time Installs 4
Active Installs 3
Total Versions 1
Frequently Asked Questions

What is Ollama Memory?

本地向量记忆系统 - 基于 Ollama + SQLite 的 AI 助手记忆方案。 支持:Markdown 记录、向量搜索、本地嵌入、无 API 费用。 特点:本地部署、语义搜索、隐私优先。 It is an AI Agent Skill for Claude Code / OpenClaw, with 348 downloads so far.

How do I install Ollama Memory?

Run "/install ollama-memory" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Ollama Memory free?

Yes, Ollama Memory is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Ollama Memory support?

Ollama Memory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Ollama Memory?

It is built and maintained by kk.Tang (@kk-kingkong); the current version is v1.0.0.

💬 Comments