⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

lemmalog

@jordyzomer⭐ 328 stars

>-

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐⭐ 328 on GitHubGitHub ↗

Popular

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

Lemmalog

A Datalog engine for LLM agent memory. This repo contains the engine (Rust crate, MCP server, REPL, agent skill) plus the design document (datalog-context-engine-design.md, with an honest status log of what shipped).

The thesis: 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 "remembering better" than a vector store. Base facts are asserted at the ingestion boundary (LLM extraction); rules derive closures, temporal projections, contradiction candidates, and relevance diffusion; every fact carries provenance back to its source episodes; and each conversation turn updates derived views incrementally instead of re-deriving them (or worse, re-reasoning them in-context).

What's implemented

Design elementStatus
Runtime-parsed, stratified Datalog (interpreter, not proc-macro)✅
Negation-as-absence with negative-cycle rejection✅
Seminaive fixpoint with per-epoch delta maintenance✅
Bi-temporal facts via valid_from/valid_to/asserted_at columns + now()✅
Semiring annotations: confidence (product t-norm) × provenance (set union)✅
Annotation merge on re-derivation (max conf, union prov, deduped supports)✅
why() proof trees with cycle protection✅
Additive arithmetic in comparisons (D = Dm + 1) with linear solving✅
Scoped negative deltas: retraction recomputes only transitive dependents✅
ask() — read-only datalog query surface for agents✅
Magic-sets demand evaluation (ask_deep): point queries without full fixpoint✅
Per-position secondary indexes; row-id lookups; WAM-style trail backtracking✅
Epoch change-log: changes_from/since + "new in memory" context section✅
Hybrid retrieval (context_for_query): BM25 + entity/graph boosting, budget-aware✅
Extraction boundary: Extractor trait, memoized MockExtractor + LlmExtractor✅
Deterministic update policy: ADD / UPDATE / NOOP / escalate✅
Positional ContextAssembler (distilled top, verbatim provenance bottom, budget)✅
AgentMemory facade: observe → policy → maintain → ask/ask_deep/context/why✅
Persistence: snapshot save/load (episodes + EDB facts + rules; derived rebuilt)✅
Semantic side index: Embedder trait, HashEmbedder, seed_mentions + near diffusion✅
DRed-lite scoped recompute: supersession rebuilds only what actually changed✅
Synthetic eval harness (scenario::run_eval): accuracy/token/latency vs. ground truth✅
Aggregation: count/min/max/sum head args with group-by fold + value-change propagation✅
Entity resolution: star-shaped aliasing, directional canonical views, conflict escalation✅
MCP server (--features mcp): the engine as tools for Claude Code / Kimi CLI✅
Rule registry: versioned batches, agent install/uninstall, backfill on change✅
Hypotheticals: what_if lookahead with byte-identical store restore✅
Streaming change feed: Added/Retracted/Cleared events for projections✅
Indexed read paths: query/ask select buckets (point lookups ~100µs at 4M facts)✅
Differential testing: 450 random programs vs a naive fixpoint oracle + parser fuzzing✅
REPL: cargo run --bin lemmalog (rule / + / ? / ?? / why / run / dump / batches)✅
Leapfrog triejoins (worst-case-optimal joins), DBSP streaming deltas🚧 future phases

Entity resolution (canonicalization)

The LLM proposes star-shaped alias(Local, Canonical) edges; Datalog derives the closure; canonical views project facts read-side only (src/canonical.rs):

alias(Acme_Corp, Acme).                       % LLM-proposed, confidence-tagged
same_as(X, Y) :- alias(X, Y).                 % symmetric-transitive closure
same_as(X, Z) :- same_as(X, Y), same_as(Y, Z).
maps_to(X, X) :- entity(X), !aliased(X).      % directional projection:
maps_to(L, C) :- alias(L, C).                 %  exactly one canonical spelling
current_canon(S, R, O) :- current(S, R, O), maps_to(S, S2), maps_to(O, O2).

Safety properties (all tested): topology violations — a local with two canonicals, or a name both local and canonical — derive alias_conflict facts instead of merging identities; confidence propagates through the closure (weak two-hop merges are visibly low-confidence); retracting an alias edge collapses the closure and every downstream view in the same epoch. A similarity-gated LLM reconciliation pass (canonical::reconcile::reconcile_entities) offers only embedding-similar name pairs to the model.

Building this surfaced and fixed two long-lived engine bugs: the scoped recompute never processed same-stratum dependents (latent stale-fact bug), fixed by SCC-condensation stratification plus a recompute fixpoint; and the invalidation pass ran before lower strata were materialized on first run, fixed by moving invalidation after evaluation. Both caught by the differential harness.

The lemmalog skill

skills/lemmalog/SKILL.md in this crate is a generic agent skill that makes the engine the task's working memory for any long-running work — investigations, debugging, audits, multi-agent searches — not just one hardcoded workflow. It encodes the discipline the live experiments converged on (assert-as-you-verify with anchors and confidence, rules as experiments, query before re-reasoning, why before trusting, hypothesis lifecycles, decide-from-queries, report-from-the-engine), the minimal interop schema (located, describes, hypothesis/status, decision), the grammar gotchas, and the anti-patterns. Install per CLI:

# Claude Code (user scope)
mkdir -p ~/.claude/skills && cp -r skills/lemmalog ~/.claude/skills/

# Kimi CLI: copy the same folder into its skills directory
# (e.g. ~/.kimi/skills/lemmalog/ — see its skills docs)

Task prompts then stay domain-specific and reference the skill in one line.

MCP server: use from Claude Code or Kimi CLI

cargo build --release --features mcp

Register the server (stdio JSON-RPC, 12 tools):

# Claude Code (project or user scope)
claude mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcp

# Kimi CLI
kimi mcp add lemmalog -- $(pwd)/target/release/lemmalog-mcp

Or the one-command installer (builds, registers the MCP server with every supported CLI it finds, installs the skill):

./scripts/install.sh               # install
./scripts/install.sh --uninstall   # remove registrations + skill

Memory persists at $LEMMALOG_SNAPSHOT (default ~/.lemmalog/memory.snap).

Persistence across sessions: set the environment when registering (both CLIs support --env KEY=VALUE on add):

claude mcp add lemmalog --env LEMMALOG_MCP_PATH=/tmp/lemmalog.snapshot -- \
  $(pwd)/target/release/lemmalog-mcp

Sub-agents that can't reach MCP (Kimi CLI sub-agents need mcp__lemmalog__* in their agent profile's tools list — the bare mcp__lemmalog form matches nothing) and scripts/cron can use the headless CLI on the same snapshot:

LEMMALOG_MCP_PATH=/tmp/lemmalog.snapshot lemmalog-cli observe --facts 'S --rel--> O'
LEMMALOG_MCP_PATH=/tmp/lemmalog.snapshot lemmalog-cli query --goal 'current("s", R, O)'

Mutations are visible to the MCP server on its next load and vice versa; the two hold separate in-process copies, so don't write from both simultaneously (have the parent read while a sub-agent writes, or route every writer through the CLI).

The intended division of labor: the host model (Claude/Kimi) reads the conversation and asserts triples via lemmalog_observe (line protocol S --rel[conf]--> O); Lemmalog derives closures, temporal views, canonicalizations and aggregations deterministically. Typical session:

lemmalog_observe      {"facts": "Alice --works_at--> Acme\nAlice --manager--> Bob", "ts": 

// HOW IT'S BUILT

KEY FILES

skills/lemmalog/SKILL.mdREADME.md

// REPO STATS

328 stars