Locket MCP Server
Stores long-term memories in a user-owned Git repository and supports multi-device synchronization via Git remotes using pull, push, and sync; redaction tombstones propagate through Git.
Supports Gitea-hosted private memory repositories and multi-tenant serving, using Gitea accounts with one repository per user via the Gitea-enabled API mode.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Locket
Locket 是 Portable Memory Format(PMF) 的参考实现。它把 AI 的长期记忆存在一个归你所有的 Git 仓库里:每条记忆是一个 Markdown 文件,可以追溯来源、更正、删除,也可以随仓库带到另一个 AI。
当前版本 0.1 是最小可用版本(规范 L1 级加合并):
每次对话写入自己的会话分支,结束时自动合并进
main,不需要人工审批检索默认可离线运行,支持 BM25 和可选向量混合检索
通过 Claude Code 钩子自动注入记忆、自动合并
多设备同步:把记忆仓托管在任意 Git 远程(如自建 Gitea),用
locket pull/push/sync对齐; 删除(redact)写入墓碑并随同步传播到其它克隆,locket gc在本地物理抹除内容提供视图、加密、签名校验、语义冲突检测及 MCP 接口;部署范围见对应文档
MCP 支持本机 stdio 与鉴权的多用户 Streamable HTTP,接入方式见 多用户 MCP 文档
安装
需要 Python 3.10+ 和 git。
py -3 -m pip install -e . # 之后可以直接用 locket 命令
locket init # 默认仓库在 ~/.locket,可用 LOCKET_HOME 或 --repo 指定Related MCP server: Hypermnesic
常用命令
命令 | 作用 |
| 新增记忆(type:fact / preference / event / procedure / summary) |
| 记错了:同一个 id 原地更正,旧版本留在历史中 |
| 情况变了:旧记忆写上截止日期,新建一条 |
| 软遗忘:从当前记忆中移除,历史中仍可找回 |
| 永久删除并写入墓碑 |
| 查找和查看 |
| 这条记忆从哪来、改过几次 |
| 历史与冲突 |
| 提交你在仓库里手动改过的文件 |
| 设置同步远程(指向你的 Git 仓库,如 Gitea 私有仓) |
| 在多台设备间同步长期记忆(sync = 先拉后推) |
| 改写历史、物理清除已 redact 的记忆(会使下次 push 变强制推送) |
| 重建派生检索索引(故障或迁移后用) |
| 启动 HTTP/JSON API; |
| 启动 MCP 服务器,供 Agent 接入(需 |
性能与服务层
读路径由派生 SQLite 索引(
.git/pmf/index.sqlite,不进仓库、可locket reindex重建)加速,recall/list/get不再每次解析全部文件。locket serve-api把引擎暴露为 HTTP/JSON API,是 Web 前端和 MCP 的共同后端;locket mcp走 MCP 协议供 Agent 直接用。面向"很多人用的云上记忆存储"的多租户架构(Gitea 做账号/托管、每用户一个私有记忆仓)见 ARCHITECTURE.md 与 GITEA-SETUP.md。
<id> 用命令输出里方括号中的 8 位短 id 即可。不带 --session 时,写入会立即合并进长期记忆。
接入 Claude Code
locket install-claude-hooks --print # 先看要写入的配置
locket install-claude-hooks # 写入 ~/.claude/settings.json三个钩子:
SessionStart:开会话分支,把关于你和当前项目的记忆、待确认的冲突以及写入方法放进上下文
UserPromptSubmit:按你这条消息检索相关记忆并附上
SessionEnd:把会话分支合并进长期记忆
钩子出错时只写 stderr,不会打断 Claude Code。
开发
py -3 -m pytestTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
One memory for every AI you work with: your rules, notes and decisions in your own Git repo.
Portable AI memory shared across models and harnesses - plain markdown you own.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA persistent memory server for AI agents that stores findings, tasks, and patterns in Markdown files within a git repository, enabling context injection across multiple AI tools.4MIT
- AlicenseAqualityBmaintenanceGit-native long-term memory for AI agents: your markdown files are the source of truth, the search index is a disposable projection rebuilt from git, and every memory the agent writes is a reviewable git commit. Served over one OAuth-secured MCP endpoint with hybrid lexical+semantic recall and a gated, git-first commit_note write tool.79AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to persist and share durable memory — appending session logs with checkpoints and handoffs, claiming and completing tasks, and recording decision records — all stored as plain Markdown and JSONL files in a git repository. Everything written is full-text searchable, and the server speaks MCP so MCP-aware clients can plug in directly with zero vendor lock-in.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to persist project memory across sessions by compiling decisions, progress, and pitfalls into git-linked, evidence-backed entries. It lets clients add, query, inject, scan for stale, check assertions on, and compute ROI of those memories over stdio.MIT