Lemmalog gives agents a Datalog memory, served over MCP
The Rust engine claims 150x fewer tokens on 500-turn chats, tracks why every fact is true, and drops into Claude Code or Kimi CLI as 12 MCP tools.

Copy markdown
Agent memory as a deductive database
Lemmalog (MIT, Rust) stores what an agent knows as Datalog facts and rules instead of raw chat history. Its MCP server exposes 12 tools — assert a fact, install rules, query, pull provenance — so Claude Code or Kimi CLI can treat it as a shared, persistent brain.
Constant context cost, not linear
The project reports roughly 2,500 tokens per question no matter how long the conversation gets, versus full-history retrieval that grows until it overflows — about 150x fewer tokens over a 500-turn chat, and 1/40th the tokens on the LongMemEval benchmark (F1 0.46).
It fixes maintenance, not just retrieval
The pitch: retrieval finds old facts but never tells you what's still true after an update. Lemmalog records why each fact holds and auto-invalidates dependents when a premise changes, with temporal valid_from/valid_to columns and 'why' proof trees. Incremental re-derivation runs about 50ms; idle turns cost microseconds.
What to build this weekend
Build with cargo's mcp feature, set LEMMALOG_MCP_PATH, and point your harness at it to give an agent memory that survives sessions and can explain itself. Caveat: it's early — solo dev, ~20 stars — and the author says the hard part is the extractor that turns messy chat into clean facts, not the engine.