Lemmalog MCP
A Datalog engine in Rust as an agent's working memory: facts with provenance, inference rules and an MCP server for Claude Code
- 341 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The server runs as a local process and writes a memory snapshot file to disk
- The install script builds the project from source and registers the server in the CLIs it finds
Install
- Works in
Manual install
cargo build --release --features mcp && claude mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcpRun it in the folder of the cloned repository. ./scripts/install.sh does the same in one command, and the skill is copied into ~/.claude/skills.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The server runs as a local process and writes a memory snapshot file to disk
- The install script builds the project from source and registers the server in the CLIs it finds
This is third-party code. Review the repository files before installing.
What it does
Lemmalog stores what an agent learned while working as facts of a deductive database and derives consequences with Datalog rules. The author starts from the idea that agent memory should be a verifiable model of knowledge, so vector search over similar texts is not the core here. Each fact stores confidence and a link to the episodes it came from, and the why query shows the proof tree of a derivation. The MCP server, built with the `--features mcp` flag, exposes the engine as twelve tools over stdio. Facts go in through the lemmalog_observe tool in a line format like `S --rel[conf]--> O`. When facts change the database recomputes derivations, keeps each fact's validity time and flags contradictions. Through what_if the agent asks hypothetical questions, and text search stays within a token budget. The repository also holds a lemmalog skill that teaches an agent to use the engine as memory for long tasks: investigations, debugging, audits and multi-agent searches. You can install it by copying the folder into ~/.claude/skills.
Who it is for. For people building agents for long investigations, debugging and audits who want their findings kept in a database with inference rules.
Good fit when
- An investigation or debugging session outlasts one context window and found facts must be kept
- Several agents search for different parts of an answer and put results into a shared base
- An agent's conclusions must be confirmed: each fact should lead to a source episode
- Knowledge changes over time and you need to tell a current fact from a stale one
- You want to test a «what if» hypothesis without changing the main base
Not a fit when
- You need ordinary vector memory over documents: the engine stores triples and rules, and document search is not its job
- You cannot build the project from source: the repository has no prebuilt package
- The task is short and fits in one conversation
Example request
Use lemmalog as working memory: record verified facts about the cause of the failure and show where each one came from before concludingMCP
- Transport
- stdio
- Authentication
- not required
Environment variables
LEMMALOG_MCP_PATH- Path to the memory snapshot file for persistence between sessions
Limitations
The server is built from source with `cargo build --release --features mcp`, so Rust is required. Two copies of the engine, the MCP server and the command line, keep data in separate processes: do not write from both at the same time.
Some of the design is still planned, such as leapfrog triejoins and DBSP streaming deltas. Kimi CLI subagents need an mcp__lemmalog__* entry in the tools list of their profile, otherwise the server is unavailable to them.
How to disable. Run `./scripts/install.sh --uninstall`: it removes the server registrations and the skill. You can delete the memory snapshot file by hand.
FAQ
How do I connect Lemmalog to Claude Code?
Build the server with `cargo build --release --features mcp`, then run `claude mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcp`. Or run `./scripts/install.sh` once: it builds, registers and installs the skill.
How does Lemmalog memory differ from vector memory?
It is a deductive database: facts are asserted on intake, and rules derive closures, temporal projections and contradiction candidates.
How do I keep memory between sessions?
Set the LEMMALOG_MCP_PATH variable to a snapshot file path when registering the server. Both `claude mcp add` and `kimi mcp add` accept the `--env` key.
What should subagents that cannot reach MCP do?
Use the `lemmalog-cli` command line program on the same snapshot file. Do not write from several processes at once; it is safer to name a single writer.
How does an agent record a fact?
The model reads the conversation and passes statements to lemmalog_observe as protocol lines, and Lemmalog derives closures and checks contradictions itself. The skill tells the agent to call why before concluding and look at the proof.
Discussion
No questions or reviews yet.
Related
MCP serversA long-term memory MCP server for agents: one Rust binary that runs offline and never calls a language model
Long-term agent memory in local Markdown files with a link graph, semantic search and MCP access
Local persistent memory for coding agents: hooks record every session, and Claude Code, Codex or Cursor recall past decisions through 54 MCP tools
Knowledge-graph memory for agents: Claude Code and Codex plugins, an MCP server and a Python library
Local memory for agents: stores conversations and project files verbatim and retrieves them with semantic search over MCP
Persistent agent memory in a folder of linked markdown notes, so Claude Code remembers a project across sessions
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Lemmalog (this entry) | no | not required | 341 | |
| MCP Knowledge Graph | no | not required | 886 | stores entities and relations in a local graph with no inference rules |
| Graphiti MCP | no | API key | 32,326 | long-term memory as a time-aware knowledge graph on Zep |
| Basic Memory | no | not required | 4,403 | memory in local .md files with links |
README in short
The author argues for agent memory as a deductive database and puts the finished features in a table. A separate status log keeps what is done apart from what is planned.