engrim

title
engrim
type
toolbox
summary
Local SQLite memory shared across coding agents: typed decision records, FTS5 plus static-embedding recall, per-agent provenance
tags
ai-agents, memory, python, mcp, watchlist
language
Python
license
MIT
created
2026-09-13
updated
2026-09-13

engrim is a local memory store meant to be shared by every coding agent working on the same project, so a decision made in a Claude Code session is there when the next session is in Codex, OpenCode, Cursor or Antigravity. It stores curated records rather than transcripts: a small typed database of decisions, facts, constraints and state that gets injected as a short pack at the start of each session. The README calls it "the universal cross-model episodic memory standard". There is no specification behind the word "standard"; it is one Python implementation.

How it works

Everything lives in one SQLite file, ~/.engrim/memory.db, created with 0600 permissions. Records have a type (decision, fact, state, feedback, user, reference), a summary, optional detail and tags, and are scoped by project. They are never deleted in normal use: engrim supersede marks one replaced and engrim retire marks a resume pointer done, so history stays.

Retrieval combines SQLite FTS5 (bm25) with model2vec static embeddings through reciprocal-rank fusion, which is ordinary hybrid-search kept small enough to run on CPU with about 30 ms model load; ENGRIM_EMBED=off gives lexical search only. At session start a priority-ordered boot pack, capped at 4,000 characters by default, goes into context, with the newest resume-pointer record pinned at the top. On every prompt a "minder" pulls the few records relevant to that message. A flight-recorder log keeps raw turns, and engrim review scans that log for decisions that were never saved as records, returning a heuristic safe_to_clear verdict (or null when there is no log).

Every record carries origin_agent, filled in from the hook, MCP client or CLI that wrote it, so you can see that a constraint came from a Codex session and its reversal from OpenCode.

pip install engrim
engrim setup --dry-run
engrim add -t decision -s "Switched primary database to PostgreSQL" --tag db
engrim recall -q "database"
engrim serve --mcp

The MCP server exposes engrim_recall, engrim_add, engrim_context and engrim_review, and keeps stdout strictly for JSON-RPC.

Setup touches global agent config

engrim setup with no arguments detects ~/.claude, ~/.gemini, ~/.cursor, ~/.codex and ~/.config/opencode and wires into all of them. For Claude Code that means SessionStart, SessionEnd, Stop and UserPromptSubmit hooks in ~/.claude/settings.json, a status line, and appended notes in ~/.claude/CLAUDE.md; for OpenCode a plugin, an MCP registration and AGENTS.md notes. Run it with --dry-run first. engrim uninstall --opencode reverses the OpenCode steps. The README notes an honest cost for OpenCode: the boot pack rides in the system prompt of every model call in a session, including title and subagent calls.

Claims to discount

The "105-session case study" is the author's own algorithmic-trading codebase: 153,000 tokens of work consolidated into a pack under 1,000 tokens, "zero regressions across 186 unit tests" and "zero context amnesia across model switches". There is no baseline and no comparison against the same work without engrim. The "99%+ cut in reloaded context cost" compares the pack with the total tokens of all prior work, but nobody reloads all prior work, so it is not the comparison that matters. The comparison section lists Pi among coding assistants and then describes it as a personal AI companion, which reads like two different products named Pi mixed together. The README's model names mix eras too ("Claude 3.7 Sonnet" next to "Gemini 3.8").

Against the memory cluster

The record-not-transcript design is on the right side of memorizing-session-transcripts, which found transcript search gave agents nothing once the durable decisions were written down elsewhere. The same page's other warning applies directly: agents write engrim records through engrim_add whenever they judge something a decision, with no review step, and theahura's "intent drift" is exactly unreviewed machine output read back as deliberate intent. Retirement here is manual, where agent-memory-decay prunes automatically.

Among the store-layer choices in agent-memory-components, engrim is the small-SQLite, cross-harness end. agentmemory is the server-and-many-hooks version of the same cross-agent idea, mempalace keeps conversations verbatim, stash consolidates episodes into higher-order records, mnemonik makes memory verifiable, and ctx is SQLite context management for Claude Code and Codex only. llm-wiki-as-agent-memory is the plain-markdown alternative, where a human can read and correct what was saved.

On watchlist: under three months old, single author, provenance and savings claims resting on one self-reported case study, and setup that edits every agent's global configuration.

MIT, 241★, 16 forks, created 2026-06-19, pushed to on the day of ingest. Repo: https://github.com/timgordontg/engrim