personal-memory-mcp
This MCP server gives AI clients a shared local SQLite long-term memory store they can search, read, write, revise, and audit through seven tools.
Search memories (
memory_search): FTS5 keyword search with scope/type/validity filters, pagination, up to 5 query variants fused by reciprocal rank, and asearch_mode="auto"relaxed fallback pass; empty results are explained viaretrieval.reason.Load task context (
memory_context): get bounded reference memories for the current task, infullor compactviewform, with amax_charsbudget that omits oversized whole records while still reporting how many retrieval found.Store memories (
memory_store): write durable memories with provenance, scope, tags, confidence/importance, validity dates, andsupersedesto atomically replace a changed fact; exact duplicates are returned instead of re-inserted.Update memories (
memory_update): correct title, content, type, confidence, importance, source or tags using optimistic concurrency (expected_revision) and a full audit snapshot; scope, validity and supersedes are immutable.Soft-delete memories (
memory_forget): remove a memory from retrieval while retaining history and database content (not secure erasure).Review history (
memory_history): read revision snapshots newest-first, including forgotten memories, with pagination.Inspect the store (
memory_status): report database location, counts, schema, capabilities, and the scope inventory of every (scope, scope_id) pair with active/total counts.Shared across clients: Codex, WorkBuddy and DeepSeek Harness can all point at the same local database file, though scope is a filter, not access control.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@personal-memory-mcp Remember that my current project uses Python and SQLite for storage."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Personal Memory MCP
让 Codex、WorkBuddy 和 DeepSeek Harness 共用一份由你掌管的长期记忆。
本地 SQLite · 标准 MCP · 支持来源与修订追溯 · 不需要模型 API 或向量服务
快速开始 · 三端接入 · 怎么使用 · 工具参考 · 设计说明
它解决什么问题
你在一个 AI 客户端里说明过自己的偏好、长期决定或项目背景,换个客户端又得从头解释。Personal Memory MCP 把这些经过确认的信息存进你自己的本地数据库,让接入同一数据库的客户端按需读取。
每条记忆都可记录来源,并带有适用范围、有效期和修订历史。搜索没有命中时,工具会说明是范围里没有记录,还是关键词没有匹配;宽松检索返回的只是待核对候选。
Codex ────────┐
WorkBuddy ────┼── MCP 工具 ── 同一份 SQLite 记忆库
DSH ──────────┘Related MCP server: kepta
适合谁
在 Codex、WorkBuddy、DSH 之间切换,希望它们共享个人偏好和长期决定。
想把记忆放在本机,能够查询来源、纠正旧事实、导出备份。
更看重可解释的写入和检索行为,愿意在客户端配置一次 MCP。
如果你希望“安装后自动读取所有聊天、自动整理成记忆”,这里目前没有后台会话采集。Codex Hook、WorkBuddy 规则和 DSH 提示只会提醒模型何时调用工具;实际读写以 MCP 工具返回为准。项目也没有 DSH 内嵌管理页面、HTTP 服务或跨设备实时同步。
现在能做什么
能力 | 具体行为 |
跨客户端共享 | 三端指向同一个本地数据库;全局、项目、领域范围分别过滤 |
审核写入 |
|
按需读取 | 中文关键词、FTS5、多路查询;返回命中原因与候选池诊断 |
保留变化 | 有效期、事实替代链、修订历史和软删除 |
自己带走 | JSON/Markdown 导出与导入,SQLite 数据库由用户持有 |
四态预审只能识别精确重复、同标题冲突和来源字段缺失,不能证明一条记忆真实,也不能做语义去重。证据检查同样只报告词面候选,回答前仍需核对正文和来源。完整参数见工具与数据参考。
快速开始
需要 Python 3.11+、uv 和带 FTS5 的 SQLite。以下命令从一个新克隆的仓库开始:
git clone https://github.com/tyxiumud/personal-memory-mcp.git
cd personal-memory-mcp
uv sync --locked
uv run --locked python -m personal_memory status默认数据库在用户数据目录:Windows 为 %LOCALAPPDATA%\personal-memory-mcp\memory.sqlite3,macOS/Linux 为 ~/.local/share/personal-memory-mcp/memory.sqlite3。所有客户端必须使用同一个绝对数据库路径,才能共享记忆。
生成三端配置模板(输出目录需为新目录或空目录):
$configDir = Join-Path $env:TEMP 'personal-memory-configs'
uv run --locked python scripts/render_client_configs.py $configDir模板不会自动改动客户端配置。按下一节把所需条目合并进去,再在客户端调用 memory_status 核对 database。若已有同名输出目录,换一个新目录即可。
接入 AI 客户端
客户端 | 接入方式 | 分步指南 |
Codex | 合并 MCP 配置;可选安装读取与结束前复核 Hook | |
WorkBuddy | 合并 MCP 配置、信任服务;可选安装常驻规则 | |
DeepSeek Harness(DSH) | 在 profile patch 中挂载本地 stdio MCP |
这是 MCP 服务,不是在 DSH 插件页一键安装的 npm 插件。三端配置不同,但共用同一份数据库。配置探针可以验证启动命令、工具列表和数据库路径;它不代表客户端 UI 中的真实模型会话已成功读写。
怎么使用
接入后,先在客户端调用 memory_status,确认数据库路径。然后可以做一轮可见的跨客户端验收:
在一个客户端用
memory_store_reviewed写入一条不含敏感信息的测试记忆,检查disposition=ACCEPT且written=true。在另一个客户端用
memory_search查同一范围和关键词,确认返回同一个 ID。如果只想预览写入结果,用
memory_review_write;它不会写数据库。测试记忆可通过memory_forget软删除,历史仍会保留。
示例写入参数(工具名 memory_store_reviewed):
{
"memory": {
"title": "示例:技术文档语言偏好",
"content": "用户希望技术文档优先使用中文。此条仅用于演示。",
"scope": "global",
"type": "preference",
"source": {
"kind": "conversation",
"client": "codex",
"trigger": "explicit",
"evidence": "replace-with-real-user-confirmation"
}
}
}实际使用时请替换示例内容和来源,不要把这条示例当作真实用户偏好。source.trigger 区分用户明确要求的 explicit 与模型判断的 autonomous;自主写入还需要证据或引用。新事实每条尽量只表达一件事,纠错与事实变化分别使用修订和替代关系。
数据与边界
记录存于本机 SQLite,支持按范围、类型和有效期过滤;范围不是访问控制。
memory_forget是软删除,历史和备份中可能仍有原文;它不是安全擦除。memory_assess只能提示哪些要点找到词面候选,不能替模型证明结论。本项目不默认使用 embedding、外部模型 API、云服务、自动会话摄取或自动合并。
项目仍处于 1.0 前的 alpha 阶段;客户端安装与 Hook 行为会随宿主版本变化。
导出完整备份时请使用 --include-forgotten,并将归档放在仓库外;不要把个人数据库或导出文件提交到 Git。导入、有效期、检索诊断和备份细节见工具与数据参考。
文档
想了解什么 | 去哪里 |
工具参数、四态写入、搜索诊断、归档 | |
为什么这样设计、哪些能力暂不做 | |
数据如何存储、检索和修订 | |
什么值得记、客户端何时读写 | |
评测指标能说明什么 | |
版本记录与后续提案 | |
贡献与安全边界 |
开发与验证
uv sync --locked
uv run --locked python -m pytest -q
uv run --locked ruff check src tests scripts测试和静态检查不需要个人数据库。三端安装后,可用 scripts/check_connections.py --installed --database <共用数据库的绝对路径> 验证实际启动配置;未安装三端时无需运行。固定检索夹具只验证后端候选行为,不代表真实会话回答准确率,详情见评测口径。
许可证
Available Tools
7 toolsmemory_contextARead-only
Get bounded reference memories for the current task, respecting scope and validity.
max_chars bounds the serialized memories array, not the small response wrapper. Whole records that do not fit are omitted; omitted_from_page reports how many, and returned_after_budget is how many survived. retrieval.returned is what retrieval found before the budget, so a record dropped for size is never reported as no hit.
view="full" (default) returns complete records. view="compact" keeps id, revision, title, content, scope, scope_id, type, validity, updated_at, confidence, importance and a deterministically extracted source summary; it never truncates the body and never invents missing provenance. source_summary keeps verification and epistemic_status unshortened, because a trailing caveat like "未逐项外部核实" must not be cut off. Use memory_history when full evidence is needed. Suggested startup read: view="compact", max_chars=6000, limit=8.
Inputs: selection (required), view, max_chars.
memory_forgetADestructive
Soft-delete one memory from retrieval. History and database content are retained.
This is NOT secure erasure. Read the current revision via history before forgetting.
Inputs: memory_id (required), expected_revision (required).
memory_historyARead-only
Read revision snapshots newest first, including forgotten memories; supports pagination.
Inputs: memory_id (required), limit, offset.
memory_searchARead-only
Search active memories with FTS5. Default global only; project/domain may include global.
query is plain text (all terms must match), not SQL/FTS syntax. as_of filters validity, not historical revisions. Forgotten records are always excluded. Paginate with offset.
query_variants (max 5, each max 100 chars) runs each keyword set as its own strict FTS query and merges the ranked lists by reciprocal rank fusion, score = sum(1/(60+rank)). This is lexical keyword fusion, NOT vector or semantic search: a variant only helps if its characters actually occur in the record. Each variant gets at most 100 candidates before fusion, so offsets past that pool return fewer or no rows. Every variant still passes the same scope, type, validity and forgotten filters. With variants present the original query is fused too; an empty query is skipped instead of browsing everything.
The response keeps the memories array and adds a retrieval object so an empty page can be read correctly. reason is "empty_scope" (no current record passes the scope, type, as_of and forgotten filters), "no_lexical_match" (records exist in scope but none match the keywords), "offset_beyond_pool" (the page starts past the available candidates), "relaxed_match" (search_mode="auto" widened the search; see below) or "matched". None of these means that the user never recorded anything: scope/type/as_of filters and lexical matching both narrow the result. scoped_active counts records before any keyword match; candidate_pool counts the candidates this strategy actually collected, so when candidate_limit_reached is true it is a floor, not the total; for the multi-query strategy per_query_matches holds the exact per-query counts instead.
search_mode defaults to "strict", which is the historical keyword behaviour and is unchanged. search_mode="auto" runs the same strict queries first and, only when the candidate pool is empty and no page has been skipped, makes one bounded relaxed pass: it splits the query and the variants into keyword fragments, measures the in-scope document frequency of every one of them, drops the fragments that match nothing and the ones too common to discriminate, then keeps the most discriminative dozen (lowest frequency first, original order for ties, dropped ones listed in fallback.dropped_by_cap_fragments), recalls candidates with OR over those fragments, discards candidates covering too few of them, and ranks the rest by coverage. Scope, type, validity and forgotten filters always apply, and a pagination overflow never triggers it. Records from that pass carry match_quality="relaxed" and retrieval.fallback reports the method, trigger, keywords used and dropped, the coverage requirement, how many candidates were recalled, rejected and survived, and whether the recall cap was hit; such results need their relevance checked and their confidence is never rewritten. candidate_pool and has_more_in_pool describe the pool that survived coverage filtering, so a rejected candidate is never implied on a later page; when fallback.candidate_limit_reached is true there may be uninspected candidates and the pool is a floor, not the number of matching records. A relaxed pass can still return nothing: an empty result stays a valid answer, and fallback.coverage_required == 1 marks the weakest single-keyword tier.
Inputs: selection (required).
memory_statusARead-only
Report database location, counts, the scope inventory, schema and capabilities.
scopes lists every existing (scope, scope_id) pair with scope, scope_id, total_count, active_count and newest_updated_at kept as separate fields. Check it when the task scope is unclear or changes, then choose the relevant scope: knowing that a scope exists is not a reason to read every project. active_count follows the same rule as retrieval (not forgotten, valid at as_of), while total_count and newest_updated_at include forgotten and expired records.
Inputs: no named parameters.
memory_storeA
Store a durable memory with provenance. Return id and revision.
Explicit user requests must be handled; autonomous writes require confirmed, durable, future-useful information. Search first. Prefer source.trigger=explicit|autonomous. Never store secrets, speculation, raw logs, or short-lived conversational details. For a changed fact create a new memory with supersedes=old_id; its valid_from closes the old memory's validity atomically. Scope and scope_id must match the old memory. An exact active duplicate in the same scope/type is returned without another insert.
Inputs: memory (required).
memory_updateADestructive
Correct content/metadata with optimistic concurrency and a full audit snapshot.
Editable fields: title, content, type, confidence, importance, source, tags. Scope, validity and supersedes are immutable; use memory_store for changed facts.
Inputs: changes (required), memory_id (required), expected_revision (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct operation: search for query-based retrieval, context for bounded task-relevant retrieval, store for creation, update for modification, forget for soft deletion, history for revision snapshots, and status for database metadata. There is no functional overlap between any pair.
All tool names share the `memory_` prefix and follow a mostly verb-oriented pattern: search, store, update, forget, history, status. `memory_context` is the only noun-based name, but it clearly signals retrieving context and does not break the overall consistent naming convention.
Seven tools is well within the ideal scoped range for a personal memory server. Each tool covers a necessary capability without redundancy or bloat, and none feel superfluous.
The tool surface provides full CRUD coverage (store/create, context+search+history/read, update/update, forget/delete) plus lifecycle extras like history, status, and scoped context retrieval. The soft-delete design is deliberate and well documented, leaving no obvious dead ends.
Maintenance
Related MCP Connectors
Durable shared memory for AI agents: search, write and correct facts, with per-client policy.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Persistent memory for AI agents, for code, research and everyday life. Stale facts retire.
Shared memory for your AI agents. Every fact shows its source, and stale facts get replaced.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceProvides persistent local memory functionality for AI assistants, enabling them to store, retrieve, and search contextual information across conversations with SQLite-based full-text search. All data stays private on your machine while dramatically improving context retention and personalized assistance.3-
- AlicenseNot gradedqualityBmaintenanceLocal memory for AI agents in one SQLite file on your own machine. Facts carry a validity window and a confidence score, so an outdated one is superseded and downweighted rather than deleted, and retrieval fuses BM25, vector similarity and a knowledge graph.4Business Source 1.1
- AlicenseAqualityCmaintenanceProvides persistent local memory for any MCP-compatible AI agent, enabling agents to store, search, recall, forget, export, and manage preferences, rules, and facts with zero dependencies, no cloud, and no API keys.8MIT
- AlicenseAqualityCmaintenanceEnables coding agents to store, search, update, and delete durable facts, preferences, decisions, and plans in a shared local SQLite database, along with per-namespace profile get/set and stats. Uses offline lexical FTS5 search so multiple agents working on the same project can share one memory store.7MIT