
Factum
io.github.factum-projectPublished by GitHub account factum-projectv0.1.3Updated Oct 24, 2026
Auditable memory for AI agents: provenance, cascade retraction, conflict refusal
Overview
A local MCP server giving AI agents an auditable structured-fact memory with mandatory provenance, cascade retraction and conflict refusal.
- What you can do
- Write and assert structured facts as provenance-tagged knowledge nodes, with automatic content-based IDs and corroboration detection when another agent asserts the same fact. Query stored facts and receive an ambiguous result instead of a guess when facts conflict. Retract a source and have everything derived from it invalidated automatically through the reverse dependency graph. Apply index-level permission filtering and conflict arbitration policies across a shared knowledge base.
- When to use it
- Suited to compliance-sensitive agents, multi-agent shared knowledge bases, and cases where you need to answer why an agent believed something. It stores verified structured facts rather than conversation context, so pair it with a context-memory tool if you also need semantic recall.
- Requirements
- Runs as a local stdio process built from the Rust crate with Cargo; register the built server binary with an MCP client such as Claude Code or Cursor. In-memory storage is the default; a RocksDB build flag and a database path option enable persistence across restarts. No accounts, API keys or environment variables are declared.
Installation
In SourceWeft
- Open Factum in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit 6217db4
Tools
0Version history
1- v0.1.3LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts