agentsclimarketplace

Local memory skill

Skill yaoxiao99/local-memory-skill

A fully local Markdown memory system for AI agents. No cloud, no lock-in.

Install
npx -y skills add yaoxiao99/local-memory-skill

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when an agent needs to set up, read, write, or maintain a fully local Markdown-based memory system; when the user says "remember this", "save to memory", "set up local memory", or wants cross-session context without a cloud memory provider.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.9 KB, as published. Nobody here has run it

Local Memory Manager

把记忆还给本地。不上云,不分心,用自己的文件系统当数据库。

核心理念

本地记忆系统的三层结构:

MEMORY.md          ← 启动索引(<1000字,agent 自动读取)
USER.md            ← 用户偏好(<1000字,agent 自动读取)
local-memory/      ← 本地知识库(按需读取)
  ├── index.md
  ├── user-profile.md
  ├── nas-docker.md
  ├── projects.md
  ├── ai-tools.md
  ├── troubleshooting.md
  └── archive.md

MEMORY.md 是开机小抄,local-memory 是本地知识库,archive 是历史仓库。


When to Use

  • 任何 agent 需要初始化/搭建本地记忆系统
  • 用户说"记住这个"、"保存到 memory"、"以后都这样"
  • 需要读取历史资料再回答问题前
  • 需要判断某条信息应该写入哪个 file
  • 每周整理/压缩 memory 内容
  • 不要用于:一次性任务、当天计划、临时排错过程

一、目录结构

每个 agent profile 有独立 home 目录:

RuntimeHome 路径
Hermes~/.hermes/profiles/<profile>/home/
Claude Code~/.claude/ 或项目目录
Codex~/.codex/
Cursor~/.cursor/
OpenClaw~/.openclaw/workspace/
其他使用 workspace 根目录

完整结构:

<workspace>/
├── MEMORY.md                    ← 启动索引(<1000字)
├── USER.md                      ← 用户偏好(<1000字)
└── local-memory/
    ├── index.md                 ← 文件说明 + 读写规则 + 主题映射表
    ├── user-profile.md          ← 用户长期稳定信息(偏好/习惯/沟通风格)
    ├── nas-docker.md            ← NAS/Docker/VPS/网络/服务器部署
    ├── projects.md              ← 项目入口、域名、部署环境、排查索引
    ├── ai-tools.md              ← Hermes/Cursor/Codex/图片生成/AI工具
    ├── troubleshooting.md       ← 历史故障记录(按日期/主题格式)
    └── archive.md               ← 归档旧信息(默认不主动加载)

业务专属文件(按需创建):如 flower-business.md 用于特定业务资料。不同 profile 按业务需要创建不同文件。


二、默认不使用云端 Memory

本方案默认不需要外部 Memory Provider。除非用户明确要求,否则不要启用以下服务:

  • Mem0、Honcho、OpenViking、Supermemory、ByteRover、RetainDB、Hindsight、Holographic

本方案完全本地化,不上云。


三、初始化操作

首次搭建

# 1. 确定 workspace 目录
# Hermes:
WORKSPACE=~/.hermes/profiles/<profile>/home
# Claude Code / 其他:
WORKSPACE=.

# 2. 创建目录结构
mkdir -p $WORKSPACE/local-memory

# 3. 创建所有文件
touch $WORKSPACE/MEMORY.md
touch $WORKSPACE/USER.md
touch $WORKSPACE/local-memory/{index,user-profile,nas-docker,projects,ai-tools,troubleshooting,archive}.md

填充模板

assets/templates/ 目录下的模板文件填充每个文件(见下方模板索引)。

模板索引:

文件模板说明
MEMORY.mdassets/templates/MEMORY.md启动索引,保持 <1000 字
USER.mdassets/templates/USER.md用户偏好,保持 <1000 字
local-memory/index.mdassets/templates/index.md文件说明和读写规则
local-memory/user-profile.mdassets/templates/user-profile.md用户长期信息
local-memory/nas-docker.mdassets/templates/nas-docker.mdNAS/Docker/VPS
local-memory/projects.mdassets/templates/projects.md项目资料
local-memory/ai-tools.mdassets/templates/ai-tools.mdAI 工具
local-memory/troubleshooting.mdassets/templates/troubleshooting.md故障记录
local-memory/archive.mdassets/templates/archive.md归档信息

四、信息保存流程

当用户说"记住这个"或需要保存跨会话信息时,按以下步骤:

Step 1:判断是否值得保存

  • ✅ 长期稳定、未来会复用、跨会话有价值
  • ❌ 一次性任务、当天计划、临时排错过程、对话流水账

Step 2:判断保存位置

信息类型目标文件
用户偏好/习惯local-memory/user-profile.md
NAS/Docker/VPS/网络local-memory/nas-docker.md
项目/网站/域名local-memory/projects.md
Hermes/Cursor/AI工具local-memory/ai-tools.md
故障/排查/报错local-memory/troubleshooting.md
旧信息/过期内容local-memory/archive.md
极其核心的跨域规则MEMORY.md(极少用)

Step 3:写入格式

在对应文件末尾追加:

## YYYY-MM-DD / [主题]
[内容摘要,只保留长期有价值的信息]

Step 4:不要写入 MEMORY.md

除非是极其核心、跨所有主题的长期规则,否则不要写入 MEMORY.md


五、回答问题的流程

1. 判断问题属于哪个主题
2. 读取对应 local-memory 文件
3. 结合当前问题回答
4. 如果出现新的长期信息,追加到对应 file
5. 不把临时过程写入 MEMORY.md

六、每周整理指令

# 运行整理脚本
python3 scripts/compact_memory.py <workspace路径>

或手动整理:

请整理 local-memory/ 下的所有记忆:
1. 删除重复内容
2. 删除过期内容
3. 把长句压缩成短句
4. 把临时记录移动到 archive.md
5. 保持 MEMORY.md 和 USER.md 不超过 1000 字
6. 不要删除长期稳定、有复用价值的信息
7. 整理后告诉我改动摘要

Common Pitfalls

  1. 把 MEMORY.md 当知识库用 — MEMORY.md 只放索引,详细资料必须放 local-memory
  2. 自动把所有对话总结写入 — 只有长期稳定、有复用价值的信息才写入
  3. 使用云端 Memory Provider — 本方案完全本地化,不上云
  4. 写入一次性任务 — 临时排错、当天计划、过程日志不写入任何 memory 文件
  5. 不读取直接回答 — 回答问题前应先读取对应 local-memory 文件

Verification Checklist

初始化完成后,验证:

  • MEMORY.md 存在且 <1000 字
  • USER.md 存在且 <1000 字
  • local-memory/ 目录存在
  • 7 个 local-memory 文件全部创建
  • 没有启用任何云端 Memory Provider
  • 模板内容已填充(非空)

Runtime 安装指南

方式一:npx 安装(推荐)

npx skills add yaoxiao99/local-memory-skill

方式二:手动安装

Runtime安装路径
Claude Code~/.claude/skills/local-memory-skill/
Codex CLI~/.codex/skills/local-memory-skill/
Cursor~/.cursor/skills/local-memory-skill/
OpenClaw~/.openclaw/workspace/skills/local-memory-skill/
Hermes Agent~/.hermes/profiles/<profile>/skills/note-taking/local-memory-skill/
其他clone 到对应 runtime 的 skills/ 目录
git clone https://github.com/yaoxiao99/local-memory-skill ~/.claude/skills/local-memory-skill

方式三:Agent 自动初始化

告诉任何兼容 Agent:

帮我搭建本地记忆系统
初始化 local memory
我要用本地 markdown 管理 memory,不使用云服务

Agent 会自动读取此 SKILL.md 并执行初始化。

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.