Loci
Includes the current Git branch in generated project handoff cards, tying shared memory and handoff context to the relevant repository branch.
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., "@Loci remind me what we decided about the auth setup last session"
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.
Loci(忆宫)
English | 简体中文
零依赖 · 中文检索 · 标准 MCP · 单文件网页面板 · 数据只在本机
为什么做这个项目
早上在 A 里把项目背景、技术选型、踩过的坑讲清楚了;中午想试试 B 家新出的模型,切过去 —— 它一个字都不知道,得重新讲一遍;晚上为了省额度换回 C,又得再讲一遍。
你是哪种用户 | 卡在哪 |
多 Agent / 多 harness 用户 | 决策原因、隐性约定、踩过的坑都留在上一个产品里,一换就失忆 |
模型对比测试者 | 想跑同一个任务在不同 harness / 模型下的表现,但上下文搬不过去,只能反复粘贴同一段背景 |
白嫖党(靠各家免费额度过日子) | 哪家有额度用哪家,一天切换三四次 —— 每次都要重建上下文,最耗耐心 |
Loci 把记忆从 harness 里剥出来,收进一个本地 SQLite 文件,用标准 MCP 给所有 Agent 共用:
换 Agent 不失忆 —— 新会话调一次
memory_context,定过的方案、踩过的坑、说过的偏好,开局就知道;15 个产品可以一键接入存结论,不堆聊天记录 —— 原文进会话库(你自己回看),决策 / 坑 / 偏好进记忆库
不花钱、不联网 —— 检索是本地 bigram + TF-IDF 算的:不调模型、不花 token、不发请求
中文真的能用 —— 中文提问、中文回答,靠本地分词命中,不是靠模型猜
零依赖,能读完 —— 单文件 Python + 一个 SQLite,无第三方包,不会被投毒也不会偷偷升级;约 4000 行
写进去的东西不会悄悄变 —— 每次写入都返回回执(写了什么 / 归到哪 / 出自哪段会话 / 怎么撤);碰到重复如实说「没有重复写入」
Related MCP server: mnemon-mcp
六个页面
会话 —— 每个 Agent 跟你说过什么
按 Agent 列出全部对话(标题、摘要、来源、时间),点进去是独立详情页:原话逐轮,以及从这段对话里抽出来的记忆。 右栏是「记忆来源」和「等你处理」(待质检 / 待采集 / 已排除)。本机已有的对话,扫一下就能收进来。
采集 —— 把散落的历史收进来
扫描本机各 Agent 的历史日志与 skills 目录,列出待入库条目,勾选后入库。 入库前做去重(含"同一天日志越写越长"那种前缀重合)和路径白名单校验;扫描根目录可增删。
交接卡 —— 把一个项目交给下一个 Agent
选一个项目,生成一张 markdown 交接卡:已确认的决策 / 偏好约定 / 踩过的坑 / 事实,连同所属 Git 分支一起标出。 复制走,粘给任何 Agent。
库 —— 记忆本体,以及它的运维
搜索、浏览全部记忆;七查质检(重复 / 疑似同义 / 可能矛盾 / 长期未更新 / 过短 / 过粗粒度 / 元数据缺失)+ 0-100 健康分; 备份、导出记忆包、恢复、销毁(销毁前强制确认,只动库、不动源文件)。
Agent —— 谁装了、谁接上了
列出本机装了哪些 Agent、哪些已接入 Loci、各自的数据目录能不能读。 已装的点「一键接入」写入 MCP 配置(写前备份、只合并不覆盖),可移除、可验证握手。
技能 · MCP —— 跨 Agent 复用
本机技能清单与分布(哪个技能被几个 Agent 装着),可跨 Agent 复制; MCP 配置查看与复制,省得每个产品手动填一遍。
快速开始
环境:Python 3.9+,无第三方依赖。
git clone https://github.com/kennytoliver/loci-local.git
cd loci-local
python panel.py --open想双击启动:自己建个快捷方式,指向 python panel.py --open 就行。
面板起来后 → Agent 页 → 对已装的 Agent 点「一键接入」。
不想开面板,命令行装:
python install_agents.py --list # 看本机装了什么
python install_agents.py --all # 全部接入(写前自动备份)
python install_agents.py --verify # 真实 MCP 握手验证手动接入任何 MCP 客户端:
{"command": "python", "args": ["-X", "utf8", "/path/to/loci.py"]}Windows 优先。macOS / Linux 能跑,回收站删除等少数功能降级。
页面怎么用、卡住了怎么办 —— 见 USAGE.md。
数据在你手里
一个 SQLite 文件,无账号、无 API Key、无遥测、无云端副本。面板只监听 127.0.0.1,Agent 走 stdio、不经过端口。
grep -nE "^\s*(import|from) " loci.py # 全是标准库,没有第三方
grep -nE "urlopen|requests\.|socket\." loci.py # 引擎不联网
wc -l loci.py # 约 4000 行,读得完同机任何能读到这个文件的进程都能拿到全部记忆 —— 请用文件权限保护它。 外部独立审查的四轮记录见 AUDIT-LOG.md。
文件
| 引擎 + MCP 服务 + CLI |
| 单文件网页面板 |
| 命令行接入器 |
| 数据库(首次运行自动创建,已在 .gitignore 中排除) |
贡献
欢迎 Issue 和 PR。唯一硬性要求:不引入第三方依赖 —— 零依赖是这个项目的立身之本。详见 CONTRIBUTING.md。
致谢
感谢 MemForge(MIT)先证明了「本地优先 + 单文件记忆库」这条路走得通。
License
MIT © Loci contributors.
Available Tools
11 toolsmemory_contextA
获取常驻上下文包(建议每次对话开始时调用):常驻记忆 + 近期重点记忆,一次拿齐跨 Agent 共享的上下文。输出顺序固定(常驻在前、近期在后),便于模型商前缀缓存命中、省 token
Inputs: limit, branch, project.
memory_deleteB
删除一条记忆(软删除)
Inputs: id (required).
memory_handoffB
生成项目交接卡(markdown),切换到另一个 Agent 时注入上下文用
Inputs: project (required).
memory_listC
列出最近的记忆
Inputs: type, limit, project.
memory_pinA
把一条记忆设为常驻(始终随 memory_context 返回)或取消常驻
Inputs: id (required), pinned.
memory_saveA
保存一条记忆到本地共享记忆库(跨 Agent 可见)。返回写回回执:写了哪条 / 归到哪 / 出自哪 / 怎么撤 —— 请把回执转述给用户,没有任何东西会静默进入长期记忆
Inputs: content (required), tags, turn, type, +6 more.
memory_searchB
语义检索本地记忆库(中文 bigram + 英文混合检索)
Inputs: query (required), type, limit, project.
memory_statsB
记忆库统计信息(总数/按类型/按项目/按来源Agent)
Inputs: no named parameters.
panel_openA
打开 Loci 网页面板(看记忆 / 会话原文 / 交接卡 / 库)。只在用户明确想看面板时才调用(例如用户说「打开 Loci 面板」「我想看看我的记忆」);平时不要主动调、也不要每轮对话都调 —— 默认情况下面板不会自己弹出来
Inputs: no named parameters.
session_recallB
检索历史对话原文(会话层),返回当时的原话片段——用于在新 Agent 里复现旧对话上下文
Inputs: query (required), limit, project.
session_saveB
归档一次对话原文(会话层)。把当前对话保存进本地库,其他 Agent 之后可检索复现
Inputs: transcript (required), agent, title, project, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a distinct layer+action scope: memory_* tools target the memory store, session_* tools target archived conversation text, and panel_open is a UI action. The only mild overlaps are memory_list vs memory_context (recent vs resident context) and memory_handoff vs memory_context, but the descriptions clarify their different outputs and use cases.
Nearly all tools follow a predictable domain_action pattern (memory_save, memory_search, session_save, session_recall). Minor deviation: verbs mix actions (save/list/search) with nouns (stats/context/handoff), though it stays readable and consistent in style.
11 tools is well-scoped for a cross-agent memory system, covering listing, saving, searching, deleting, stats, pinning, context retrieval, session archive/recall, handoff, and panel access. Each tool earns its place with no obvious redundancy.
Strong lifecycle coverage across both memory and session layers, including soft delete and pin/unpin toggle. The notable gap is a memory_update/edit operation — editing requires delete-then-save — and there is no direct get-by-id retrieval, but core workflows are covered.
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Governed personal world model and memory for your AI agent. Pair once, connect over MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA local-first MCP memory server providing persistent, searchable memory for AI agents, powered by SQLite.1 npm1Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA local-first MCP server providing persistent, layered memory (episodic, semantic, procedural, resource) for AI agents, with search, versioning, and session management via a single SQLite file.78 npm3MIT
- AlicenseAqualityDmaintenanceProvides persistent, searchable memory for AI agents across any MCP-compatible client, storing project context, user preferences, and session learnings locally in SQLite with tools to save, retrieve, search, and manage them.129 npmMIT
- FlicenseNot gradedqualityCmaintenanceProvides persistent, cross-session memory for MCP-compatible AI tools, letting them store and share a unified local memory with Chinese-aware semantic search, typo correction, associative perception chains, and graph-based recall.208 npm4-