lemmalog
A Datalog engine for LLM agent memory: stratified rules, provenance-tracked facts, incremental derivation, and an MCP server that lets your harness use it as a
What is lemmalog?
A Datalog engine for LLM agent memory: stratified rules, provenance-tracked facts, incremental derivation, and an MCP server that lets your harness use it as a shared brain.
Overview of lemmalog
What it is
Lemmalog is a Datalog engine for LLM agent memory. It includes a Rust crate, an MCP server, a REPL, an agent skill, and a design document. The thesis is that an agent's memory should be a deductive database — the agent builds a verifiable model of what it knows and mechanically reasons over how that knowledge changes, rather than relying on vector stores.
Key features
- Runtime-parsed, stratified Datalog interpreter with negation-as-absence and negative-cycle rejection.
- Bi-temporal facts via
valid_from/valid_to/asserted_atcolumns andnow(). - Semiring annotations: confidence (product t-norm) × provenance (set union) with merge on re-derivation.
why()proof trees with cycle protection.- Magic-sets demand evaluation (
ask_deep) for point queries without full fixpoint. - Hybrid retrieval (
context_for_query): BM25 + entity/graph boosting, budget-aware. - MCP server (
--features mcp) providing tools for Claude Code / Kimi CLI.
Use cases
LLM agent memory, investigations, debugging, audits, multi-agent searches, and any long-running work. The engine can serve as a shared brain via the MCP server, usable from Claude Code or Kimi CLI.
Getting started
Build the MCP server:shcargo build --release --features mcpRegister the server (stdio JSON-RPC, 12 tools):shclaude mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcpOr use the one-command installer:sh./scripts/install.shMemory persists at $LEMMALOG_SNAPSHOT (default ~/.lemmalog/memory.snap).Headless CLI usage:shLEMMALOG_MCP_PATH=/tmp/lemmalog.snapshot lemmalog-cli observe --facts 'S --rel--> O'
License and pricing
MIT license, open source.
Based on the project's public README and repository metadata.