关于 RE-call MCP Memory Server
RE-call 是面向 Agent 的记忆服务,可使用本地 SQLite 或自管的 PostgreSQL 与 pgvector。它为检索结果附加置信度、来源和有效性信息,标记已被取代的说法,并在证据未达到信任阈值时拒绝作答。
主要功能
- 01支持 SQLite Lite 和 PostgreSQL
- 02混合向量与关键词检索
- 03附带置信度、来源和有效性信息
- 04标记过时说法并在必要时拒答
- 05可选图推理与结构化事实
适用场景
- 01从项目笔记中检索可信信息
- 02区分当前事实与已被取代的说法
- 03通过 PostgreSQL 提供共享 Agent 记忆
MCP 相关
RE-call 提供用于搜索和管理记忆的 MCP 工具,可运行于 Lite 或 PostgreSQL。相同的可信检索流程也支持 CLI、Python 和进程内 SDK 使用。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
uvx recall-ragRECALL_SERVING_DSN密钥PostgreSQL serving DSN for the RE-call memory store.RECALL_TENANTTenant id served by this local stdio server.RECALL_TRUST_MODESet to development only for local uncalibrated corpora.RECALL_EMBEDDERThe embedder the corpus was BUILT with, for example voyage:voyage-4 or BAAI/bge-large-en-v1.5. It must match: several models emit 1024 dimensions, so a mismatch does not error, it returns a confidently ranked list that means nothing.RECALL_TABLEThe chunk table inside that database. `recall quickstart` indexes into quickstart_chunks so its sample corpus can never be retrieved beside real memory; `recall setup` uses chunks. The wrong value returns no hits and no error.RECALL_MCP_TOOLSOptional. Serve a subset of the tools: a preset (all, search, read) or explicit names. Every tool definition is re-sent every turn, so serving ones nobody calls costs input tokens on every turn. Unset serves them all.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
宁可弃答,也不猜测的记忆。
RE-call 是一种 Agent 记忆,可存储在本地 SQLite 文件或你自己的 PostgreSQL(搭配 pgvector)中。每条结果都附带判定、置信度和来源信息;遇到缺乏依据的问题时,它会拒绝回答,而不是返回最接近的匹配项。
项目介绍 · 面向 Agent · 工作原理 · 从 Lite 开始 · 安装与集成
什么是 RE-call
RE-call 是一种 Agent 记忆,可存储在本地 SQLite 文件或你自己的 PostgreSQL 数据库中。它会为源文档建立索引,并为每条结果保留有效性、沿袭关系、置信度和来源信息。
向量搜索会返回相近文本。RE-call 还会检查这些文本是否仍然有效、是否有依据,以及是否足够可信,能够回答查询。已被取代的主张会标记为 superseded;未通过校准信任门槛的结果会附上原因,并标记为 ABSTAIN。明确声明取代关系后,当前记忆会优先于过时但相似的记忆。
默认流程使用本地嵌入,以及密集向量与关键词混合检索。PostgreSQL 使用其全文搜索;Lite 使用 SQLite FTS5。记忆层无需调用大模型。其他检索、推理和结构化事实模块均为可选。
对于正在阅读本文的 Agent,面向 Agent 的 RE-call 介绍了交互循环,以及如何将持久化记忆作为可信的过往信息,而不是未经核实的草稿区。
工作原理
在 PostgreSQL 上,RE-call 会构建不可变的校准代,并针对该固定版本提供查询服务。Lite 会将校准绑定到其单文件语料库。所有搜索,包括推理路径和事实路径,都会经过可信搜索和信任关卡。
该图可在项目网站上交互:点击任意方框即可查看其所描述的源代码行。
recall_search 调用的分步视图
展示了一次搜索如何经过拒绝、弃答和回答路径。两者均由 docs/diagrams 中的源文件生成。
图表的文本版本,每个方框均链接到对应文件
实线箭头表示默认路径。虚线箭头表示可选功能或仅用于推理的路径:重排器、图扩展和回答提供方。每个方框都链接到实现它的文件。
flowchart LR
subgraph group_entry["Entry points"]
node_cli["recall CLI<br/>commands"]
node_mcp["MCP server<br/>tool handlers"]
node_sdk["Agent SDK<br/>in process"]
end
subgraph group_build["Generation build"]
node_manifest["Source manifest<br/>immutable input"]
node_generations["Generation manager<br/>build, validate, promote"]
node_parser["Parse and chunk<br/>documents to chunks"]
node_embedder["Embedder<br/>local or hosted API"]
node_graph_build["Semantic graph<br/>entities, relations"]
node_calibration["Calibration<br/>certified threshold"]
end
subgraph group_serve["Trusted retrieval"]
node_trusted_search["Trusted search<br/>query orchestrator"]
node_gen_store["Generation store<br/>pinned generation"]
node_retriever["Hybrid retriever<br/>dense, full text, RRF"]
node_reranker["Reranker<br/>opt in"]
node_trust_gate{{"Trust gate<br/>verdict or ABSTAIN"}}
end
subgraph group_reason["Reasoning"]
node_reasoner["Reasoning query<br/>evidence bundle, plan"]
node_graph_expansion["Graph expansion<br/>one hop, before trust"]
node_answer["Answer provider<br/>opt in LLM"]
end
subgraph group_facts["Provenance and facts"]
node_provenance["Provenance controller<br/>fact review"]
node_ledger["Fact ledger<br/>append only"]
end
node_caller(("Agent or user<br/>caller"))
node_postgres[("PostgreSQL + pgvector<br/>generations, chunks, graph")]
node_caller -->|"runs"| node_cli
node_caller -->|"tool calls"| node_mcp
node_caller -->|"imports"| node_sdk
node_sdk -->|"reuses handlers"| node_mcp
node_cli -->|"generation build"| node_generations
node_mcp -->|"ingest uploads"| node_generations
node_generations -->|"reads sources"| node_manifest
node_generations -->|"parses, chunks"| node_parser
node_generations -->|"embeds chunks"| node_embedder
node_generations -->|"builds graph"| node_graph_build
node_generations -->|"requires certified"| node_calibration
node_generations -->|"writes generation"| node_postgres
node_graph_build -->|"writes graph"| node_postgres
node_cli -->|"calibrate, publish"| node_calibration
node_calibration -->|"stores threshold"| node_postgres
node_cli -->|"search"| node_trusted_search
node_mcp -->|"search, evidence"| node_trusted_search
node_trusted_search -->|"pins generation"| node_gen_store
node_gen_store -->|"reads active"| node_postgres
node_trusted_search -->|"retrieves"| node_retriever
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"dense, full text"| node_gen_store
node_retriever -.->|"reorders"| node_reranker
node_trusted_search -->|"evaluates"| node_trust_gate
node_mcp -->|"reasoning query"| node_reasoner
node_reasoner -->|"retrieves"| node_trusted_search
node_trusted_search -.->|"expands pre trust"| node_graph_expansion
node_graph_expansion -.->|"same generation graph"| node_postgres
node_reasoner -.->|"cited answer"| node_answer
node_mcp -->|"apply fact"| node_provenance
node_provenance -->|"fresh search"| node_trusted_search
node_provenance -->|"appends"| node_ledger
node_ledger -->|"stores"| node_postgres
click node_cli "https://github.com/GiulioDER/RE-call/blob/master/recall/cli.py"
click node_mcp "https://github.com/GiulioDER/RE-call/tree/master/recall_mcp"
click node_sdk "https://github.com/GiulioDER/RE-call/blob/master/recall_agent/memory.py"
click node_manifest "https://github.com/GiulioDER/RE-call/blob/master/recall/manifest.py"
click node_generations "https://github.com/GiulioDER/RE-call/blob/master/recall/generations.py"
click node_parser "https://github.com/GiulioDER/RE-call/blob/master/recall/document.py"
click node_embedder "https://github.com/GiulioDER/RE-call/blob/master/recall/embeddings.py"
click node_graph_build "https://github.com/GiulioDER/RE-call/blob/master/recall/semantic_graph/_build.py"
click node_calibration "https://github.com/GiulioDER/RE-call/blob/master/recall/calibration_v2.py"
click node_trusted_search "https://github.com/GiulioDER/RE-call/blob/master/recall/trust.py"
click node_gen_store "https://github.com/GiulioDER/RE-call/blob/master/recall/generation_store.py"
click node_retriever "https://github.com/GiulioDER/RE-call/blob/master/recall/retriever.py"
click node_reranker "https://github.com/GiulioDER/RE-call/blob/master/recall/rerank.py"
click node_trust_gate "https://github.com/GiulioDER/RE-call/blob/master/recall/trust.py"
click node_reasoner "https://github.com/GiulioDER/RE-call/blob/master/recall/reasoning.py"
click node_graph_expansion "https://github.com/GiulioDER/RE-call/blob/master/recall_mcp/graph_expansion.py"
click node_answer "https://github.com/GiulioDER/RE-call/blob/master/recall/answer_provider.py"
click node_provenance "https://github.com/GiulioDER/RE-call/blob/master/recall/provenance_controller.py"
click node_ledger "https://github.com/GiulioDER/RE-call/blob/master/recall/fact_ledger.py"
click node_postgres "https://github.com/GiulioDER/RE-call/tree/master/recall/migrations"
classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_mcp,node_sdk,node_caller toneBlue
class node_manifest,node_generations,node_parser,node_embedder,node_graph_build,node_calibration,node_postgres toneAmber
class node_trusted_search,node_gen_store,node_retriever,node_reranker,node_trust_gate toneMint
class node_reasoner,node_graph_expansion,node_answer toneRose
class node_provenance,node_ledger toneIndigo
普通的 recall search 会采用直接路径。显式推理接受 graph_expansion:默认值 auto 会对每个非空查询解析为有界的一跳扩展;off 仅保留直接检索;one-hop 则强制使用图路径。CLI 使用 --graph-expansion auto|off|one-hop;MCP 工具使用 graph_expansion="auto"|"off"|"one_hop"。图邻居绑定到代,直接候选项仍排在前面,扩展候选项必须通过相同的信任边界,才能用于支持带引用的回答。
可选功能会接入系统的不同环节:
| 可选功能 | 接入位置 | 提供的功能 |
|---|---|---|
| 托管嵌入器 | 构建和查询 | 通过远程模型调用生成嵌入。查询文本和语料文本可能会离开当前环境。 |
| 学习型稀疏检索,SPLADE | 混合检索 | 在密集向量和 Postgres 全文检索之外,增加基于学习的词项加权检索路径。 |
| 重排器 | 候选项融合后 | 使用交叉编码器对融合后的候选项重新排序。 |
| Evidence Graph version one | 显式推理检索 | 为推理检索增加有界、绑定到代的结构邻居。控制选项请参见上文的 graph_expansion;图候选项须通过信任关卡,带引用的回答才能使用。 |
| 结构化事实应用 | 证据卡片 | 允许经审核的事实通过溯源控制器进入仅追加账本。 |
快速入门
如果要在你的机器上为一个项目保存记忆,请从 RE-call Lite 开始。它会将记忆存储在
.recall/memory.db 中,自动刷新已更改的备忘录,无需 Docker 或数据库服务。
先安装源码构建版本: Lite 位于代码仓库中;已发布的 0.14.0 PyPI wheel 早于 Lite。
请按照 Lite 安装指南创建环境并安装源码,然后在你自己的项目中,针对已有的笔记文件夹运行以下命令:
recall setup --lite --memory ./notes
设置过程会为笔记建立索引、尝试自动校准,并为此项目注册 Claude Code。 检查校准和注册结果,使用输出的 doctor 命令,然后重启客户端。严格信任机制仍保持启用;无法通过认证的语料库将拒绝提供可信答案。 对于其他 MCP 客户端,请使用手动配置 Lite。
| 选择 | 最适用场景 | 维护工作 |
|---|---|---|
| Lite | 在一台机器上使用本地 SQLite 文件处理一个项目 | 自动刷新备忘录并进行校准;备份笔记和存储文件。 |
| PostgreSQL | 共享服务、不可变代次、多租户或身份验证 | 管理数据库、架构迁移、代次、校准和备份。 |
试用 PostgreSQL 演示
前置条件:Python 3.11 或更高版本、Docker,以及能够运行带 pgvector 的 PostgreSQL 的 Docker 安装。
pip install "recall-rag[fastembed]"
recall quickstart
演示会启动一个临时数据库,为软件包中包含的小型语料库建立索引,并运行三次搜索。演示包含一个普通答案、一条作为已被取代内容返回的过时声明,以及一个被拒绝回答的问题。演示使用开发信任,不会修改任何个人文件。
完成后移除演示数据库:
recall quickstart --remove
已经有带 pgvector 的 PostgreSQL?请改用 recall quickstart --existing-dsn <dsn>。演示与实际安装刻意分开,且未针对你的数据进行校准。
安装与集成
本地运行,无需数据库服务或 Docker
请使用 Lite 源码安装,然后在要为其笔记建立索引的项目中运行:
recall setup --lite --memory ./notes
设置过程会创建 .recall/memory.db、尝试自动校准,并为此项目注册 Claude Code。请使用输出的 doctor 和只读仪表板命令,并将 .recall/ 添加到 .gitignore。对于 CLI 或手动配置客户端,请添加 --no-register。
MCP 服务会自动刷新已更改的备忘录。若要显式检查或刷新:
recall lite refresh --store .recall/memory.db --memory ./notes --check
recall lite refresh --store .recall/memory.db --memory ./notes
使用与设置时相同的备忘录根目录和嵌入器。CLI 不会读取 MCP 客户端的环境变量;在运行 CLI 搜索或 doctor 前,请应用设置过程输出的配置。严格信任机制仍保持启用,成功建立索引本身并不保证通过认证。
Lite 指南介绍其他客户端、源码更新、备份与恢复、刷新预算和排队写入。请将文件保存在本地磁盘上。Lite 使用精确余弦搜索和 SQLite 关键词检索;结果可能与 PostgreSQL 不同。代次、多租户服务和身份验证需要 PostgreSQL。有关信任和检索限制,请参阅 API。
使用 PostgreSQL
对于你自己的语料库,请提供带 pgvector 的 PostgreSQL,并在安装 recall-rag[fastembed] 后运行引导式设置向导:
recall setup
向导会应用架构、询问嵌入器和检索选项、为语料库建立索引、提供校准选项,并注册所选的 Agent 集成。当向导询问是否要校准时,请使用引用待安装语料库的带标签查询文件。针对捆绑演示进行校准仅供参考,不能作为你的数据已通过认证的依据。该架构采用有序的 SQL 迁移路径,并会就地迁移租户功能推出前的表。
有关 Docker、现有数据库、无交互配置、手动校准和故障排查,请参阅 docs/INSTALLATION.md 和 docs/WIZARD.md。
选择集成方式
| 使用场景 | 安装 | 后续步骤 |
|---|---|---|
| Lite CLI 或 MCP | 从源代码安装 | 运行 recall setup --lite --memory ./notes;CLI 或手动配置客户端时使用 --no-register。 |
| PostgreSQL CLI 和 Python | pip install "recall-rag[fastembed]" | 运行 recall setup,然后使用 recall search 或 Python API。 |
| PostgreSQL MCP 客户端 | pip install "recall-rag[fastembed,mcp]" | 运行 setup 并参阅 MCP 指南。各宿主的具体步骤见下文。 |
| Claude Agent SDK | pip install "recall-rag[agent,fastembed]" | 使用 USING_WITH_AGENT_SDK.md 中的进程内集成。 |
| LangChain 或 LlamaIndex | 安装对应的 extra | 使用 API.md 中介绍的适配器。 |
| Windows 桌面 UI | pip install "recall-rag[desktop]" | 运行 recall-install;当前版本不提供独立的 Windows 二进制文件。参阅向导指南。 |
Claude Code
在 Claude Code 中安装 Python 包后,再安装插件:
/plugin marketplace add GiulioDER/RE-call
/plugin install recall@re-call
该插件提供 MCP 服务、记忆搜索技能和生命周期钩子。Lite setup 已注册项目服务;插件是可选的。如果添加插件,请将其 Database DSN 配置为 setup 打印的 SQLite DSN,并避免为同一份记忆启用重复的服务。插件的服务不会自行刷新备忘;请运行 recall lite refresh,或保留服务 setup 注册的配置。
对于 PostgreSQL,请在 Claude 应使用的项目和数据库上运行 recall setup。
详情见 plugin/README.md。
Codex
对于 Lite,请使用手动配置 MCP:recall setup --lite 只会注册 Claude Code。对于 PostgreSQL,请在项目中运行 recall setup。检测到 Codex 时,setup 会将 Codex MCP 服务、插件包、记忆和会话技能以及钩子安装到用户配置中。之后重启 Codex。Codex 和 Claude Code 集成共用相同的备忘格式和信任层。参阅
docs/CODEX_RECALL_INTEGRATION.md。
Claude Agent SDK
SDK 集成会在进程内运行相同的工具,不会启动 MCP 服务:
from recall_agent import RecallAgentMemory
with RecallAgentMemory.from_env() as memory:
options = memory.options()
完整示例和写入工具的边界见 docs/USING_WITH_AGENT_SDK.md。
LangChain 和 LlamaIndex
两个适配器都使用相同的可信检索路径。如果信任机制选择不予判断,默认不返回文档;返回的文档会保留 verdict、confidence、cosine 和 supersession 元数据。 支持的类和方法见 docs/API.md。
如果安装无法正常工作
recall doctor
对于 Lite,请先应用 setup 打印的环境配置,以便 doctor 检查 SQLite 存储。 对于 PostgreSQL,doctor 会检查解释器、控制台脚本、嵌入器、Docker、数据库、pgvector、架构、配置的表和租户、校准以及 Agent 注册。它不会更改任何内容,并会为每个问题打印修复命令。
产品功能
| 领域 | 提供内容 |
|---|---|
| 检索和记忆 | 稠密向量与 Postgres 全文检索相结合,通过混合 RRF、有效性、校准置信度、来源、信任判定、不可变代次、增量索引、修剪和来源擦除实现检索。 |
| 结构化事实 | 可引用的证据卡片、来源控制器、仅追加的事实账本、当前事实投影,以及可选的物化发件箱。 |
| 质量 | 真实的 pgvector 集成测试、类型检查、lint、依赖项审计,以及在 CI 中检查已发布证据的声明门禁。 |
RE-call 不是托管记忆服务、仪表板或自动事实提取器。它不会根据 Agent 的推断改写语料库元数据。推理为可选功能,受引用约束,并考虑审核流程。部署边界见 docs/PRODUCTION.md。
接下来阅读
| 需求 | 文档 |
|---|---|
| 了解 Agent 为何需要持久、可信的记忆 | docs/FOR_AGENTS.md |
| 查看完整文档导航 | docs/README.md |
| 安装和维护 Lite | docs/LITE.md |
| 安装和配置 PostgreSQL | docs/INSTALLATION.md、docs/WIZARD.md |
| Python、CLI 和 MCP 参考 | docs/API.md |
| 信任、架构和来源信息 | docs/WRITEUP.md、docs/PROVENANCE_CONTROLLER.md |
| 安全和运维 | docs/AUTH.md、docs/PRODUCTION.md、docs/OPERATING_MODES.md |
| 测量结果和局限 | docs/EVIDENCE.md、results/FINDINGS.md |
已发布的数据与已提交的制品相关联,声明门控会在 CI 中对其进行检查。基准测试的解读和局限请参阅 docs/EVIDENCE.md,而非本概览。
引用
如果你在论文、帖子、演讲或自己的 README 中介绍 RE-call,请引用本项目并注明 Giulio D'Erme。请使用 CITATION.cff 作为规范的引用来源。
许可证
RE-call 根据 GNU Affero General Public License v3.0(AGPL-3.0)开源。 你可以根据 AGPL 的条款使用、研究、修改和分享本项目,也可用于商业用途:如果你分发 RE-call 或基于它创作的作品,或者允许用户通过网络与修改后的版本交互,就必须以相同许可证提供相应的源代码。如果这些条件不适用,例如用于闭源产品或专有托管服务,可向版权所有者申请商业许可证。有关两种许可方式的界限及早期版本的条款,请参阅 COMMERCIAL_LICENSE.md;重新分发软件时,请保留 NOTICE。 贡献需遵守 Contributor License Agreement。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。