
Factum
io.github.factum-project由 GitHub 账号 factum-project 发布v0.1.3更新于 Oct 24, 2026
Auditable memory for AI agents: provenance, cascade retraction, conflict refusal
概览
一个本地 MCP 服务器,为 AI 代理提供可审计的结构化事实记忆,强制记录来源,支持级联撤回与冲突拒答。
- 可以做什么
- 以带来源标注的知识节点写入和断言结构化事实,支持自动生成基于内容的 ID,并在另一代理断言同一事实时识别佐证。查询已存事实,事实冲突时返回歧义结果而非猜测。撤回某个来源后,通过反向依赖图自动使所有派生内容失效。在共享知识库上应用索引级权限过滤与冲突仲裁策略。
- 适用场景
- 适合合规敏感型代理、多代理共享知识库,以及需要回答“代理为何相信某件事”的场景。它存储经过核验的结构化事实而非对话上下文,若还需要语义召回,可与上下文记忆工具配合使用。
- 运行要求
- 以本地 stdio 进程运行,需用 Cargo 从 Rust crate 构建,并将构建出的服务器二进制注册到 Claude Code、Cursor 等 MCP 客户端。默认使用内存存储;启用 RocksDB 构建选项并指定数据库路径后可在重启后保留数据。未声明任何账号、API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Factum,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Factum — Auditable Memory for AI Agents
Status: v0.1.3 — Early stage, seeking early collaborators. Core write/query/retract pipeline works. Not production-ready. Architectural decisions are still open to change.
[CI] [License: MIT] [MCP Registry]
Interactive docs — animated syntax parsing, 7-tuple explorer, query pipeline, token efficiency chart, and MCP architecture diagram.
Every fact an agent writes carries mandatory provenance. When a source is retracted, everything derived from it is invalidated automatically — cascade retraction. When facts conflict, Factum returns Ambiguous instead of guessing.
A structured knowledge language (S-expression based), Rust implementation, stdio MCP server — works with Claude Code, Cursor, and any MCP client.
Status: v0.1.3, early stage. Core write/query/retract pipeline works; no semantic search or memory consolidation yet — Factum handles verified structured facts, not conversation context. Best suited for compliance-sensitive agents, multi-agent shared knowledge bases, and anywhere "why did the agent believe X" needs an answer. See the multi-agent usage guide for shared knowledge base patterns.
How is this different from Mem0 / Zep / Letta?
Unique to Factum: grammar-enforced provenance · cascade retraction · conflict refusal.
Not (yet) in Factum: embedding-based semantic retrieval · memory consolidation · HTTP transport.
Complementary: Mem0/Letta store and retrieve context; Factum stores auditable structured facts. They can run side by side via MCP.
What this means in practice
Academic context: The STALE benchmark (2025) shows that even the best LLM agents achieve only 55.2% accuracy at detecting when their own memories are outdated — confirming that memory staleness is an unsolved problem in agent systems.
Key Features (Implemented)
- Node 7-tuple: Every knowledge node carries id, predicate, validity, provenance, confidence, authority, and permissions — plus optional
:notefor human-readable context - Auto node IDs: Use
"auto"as the node ID infactum_insertorfactum_assertto auto-generate content-based IDs — no manual ID management - 5-level provenance: Verbatim / Summary / Extracted / Derived / Asserted — full audit chain
- Grammar-enforced model reference:
Extractednodes MUST carry model + version — the parser rejects them if missing (not just a documentation convention) - Cascade retraction: Derived nodes auto-invalidate when upstream sources are retracted (via
deps_revreverse dependency graph); configurable node limit prevents cascade explosion in large knowledge bases - Corroboration detection: When a second agent asserts the same fact,
factum_assertreturnscorroborated(not an error) — independent agreement is the most valuable multi-agent signal - Conflict arbitration: LatestWins / HighestAuthority / Unanimous / WeightedVote — pattern-aware grouping ensures value conflicts trigger arbitration; returns
Ambiguouswhen it cannot uniquely resolve - Index-level permissions: No post-query filtering — prevents aggregate leakage
- Lossless numerics: All numbers use
Dec(i128, u8)— zero floating-point error - MCP bridge: JSON-RPC 2.0 tools/resources; stdio transport verified with real MCP clients (Claude Code, Cursor)
What's Implemented vs. What's Not
Quick Start
Use as an MCP server (Claude Code / Cursor)
See Getting Started with Factum MCP for the full guide.
Factum-F Syntax Example
When n001 is retracted, n006 is automatically invalidated — the agent knows it can no longer trust the subsidiary relationship.
Three-Layer Architecture
A structured knowledge language underpins the memory layer — S-expression based for parse uniqueness, with Dec(i128, u8) for lossless numerics and mandatory model references for LLM self-auditing. Full design rationale in docs/design-rationale.md.
Token Efficiency — The LLM-Native Metric
TL;DR: Factum canonical form saves ~62% tokens vs verbose JSON with the same metadata. All numbers measured with real o200k_base (GPT-4o) tokenizer via tiktoken-rs.
Run
cargo test -p factum-bench test_token_efficiency_real_tokenizer -- --nocaptureto reproduce.
Key finding: The canonical S-expression form (238 tokens) is more token-efficient than the compact JSON form (290 tokens) — BPE tokenizers split JSON delimiters but merge S-expression parentheses. The form designed for correctness is also the most token-efficient.
Round-Trip Fidelity — What Exactly Is 100%?
-
Syntactic round-trip ✅ —
parse(serialize(parse(x))) == parse(x). 100% and verified by the test suite + fuzzing. This is the trust foundation. -
Semantic round-trip ❌ Not yet measured — requires factum-l (latent space projection, not implemented).
Morpheme Vocabulary — Current State
- Seed morphemes: 200+ across 9 kinds (Entity, Relation, Quantifier, Modal, Temporal, Status, Action, Attribute, Classification) — covering organizational, people, spatial, financial, product/project, version control, document/knowledge, agent memory, permission, and cause/effect domains
- Design target: 200–500 (to be loaded from
morphemes.tomlviabuild.rs) - Status: Sufficient for agent memory use cases.
morphemes.tomlcodegen is a future M2 item for external contributions.
Relationship to Other Formats
Project Structure
Test Results
Run cargo test to see the current count. Tests cover: types, lexer, parser, serialization, morphemes, depth-limit/DoS protection, conformance vectors, store, query, arbitration, permission, verifier, subscription, MCP protocol/tools/handler, and benchmarks.
CI badge at the top of this README reflects the latest build status.
Security
- Parser has a depth limit (128 levels) to prevent stack overflow DoS on adversarial input
- Lexer has a token count limit (1M tokens) to prevent OOM
- cargo-fuzz targets for parser, serialize round-trip, and lexer
- gitleaks runs in CI to scan for leaked secrets
See SECURITY.md for vulnerability disclosure.
License
MIT
Trademark
"Factum" and the Factum-F language specification are project names. This MIT license covers code only; the specification may be governed by a separate process in the future.
Contributing
Contributions require DCO sign-off (git commit -s). See CONTRIBUTING.md.
- MCP Registry name:
mcp-name: io.github.factum-project/factum
来源:README.md,提交 6217db4
工具
0版本历史
1- v0.1.3最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分