The Universal Cross-Model & Cross-Agent Episodic Memory Store.
A local-first, project-scoped SQLite memory engine that allows developers to freely switch between models and environments (Google Antigravity, Claude Code, Cursor MCP, Windsurf) on the SAME project without losing architectural decisions, user constraints, or project state.
"Why pay for 200,000 tokens of forgotten noise on every turn? The models are disposable utilities; your project's decisions are not."
As context windows scale to 1M+ tokens, developers face attention dilution: reasoning degrades, cost multiplies with every conversational turn, and clearing context causes total amnesia.
engrim replaces attention dilution with 4,000 characters of curated episodic working memory:
/clear) and watch context reload intact.model2vec) in a zero-latency hybrid reciprocal-rank fusion engine.Tested across 105 continuous sessions on a 50,000-line algorithmic trading system. Zero regressions across 186 unit tests, zero context amnesia across model switches.
In production testing on an active algorithmic trading codebase running real capital:
graph TD
subgraph Agents ["Supported Agent Environments"]
AGY["Google Antigravity
(PreInvocation & Stop Hooks)"]
CLAUDE["Claude Code
(SessionStart & Stop Hooks)"]
CURSOR["Cursor / Windsurf
(Model Context Protocol stdio)"]
end
subgraph CoreEngine \["engrim Core Engine (v1.3.0)"\]
ADAPTERS\["Adapters & Hooks<br/>(agy, claude, mcp)"\]
PROVENANCE\["Agent Provenance Engine<br/>(origin\_agent tracking)"\]
ROUTER\["Hybrid Retrieval & Minder<br/>(bm25 lexical + vector cosine)"\]
end
subgraph Storage \["Local-First SQLite Store (~/.engrim/memory.db)"\]
MEMORIES\[("Curated Memories<br/>(decisions, facts, feedback)")\]
FTS5\["FTS5 Full-Text Search<br/>(porter stemmer, triggers)"\]
VEC\["Vector Embeddings<br/>(model2vec static embeddings)"\]
LOG\["Flight Recorder Log<br/>(turns + action lines)"\]
end
AGY <-->|"hook / CLI"| ADAPTERS
CLAUDE <-->|"hook / CLI"| ADAPTERS
CURSOR <-->|"JSON-RPC (stdio)"| ADAPTERS
ADAPTERS --> PROVENANCE
PROVENANCE --> ROUTER
ROUTER --> MEMORIES
MEMORIES --- FTS5
MEMORIES --- VEC
ADAPTERS --> LOG
Loading
pip install engrim
Run engrim setup without arguments. It automatically detects installed environments on your machine and configures them all:
engrim setup
~/.gemini exists $\rightarrow$ wires Antigravity lifecycle hooks, skill, and MCP server.~/.claude exists $\rightarrow$ wires Claude Code SessionStart, Stop, status line, and CLAUDE.md.~/.cursor exists $\rightarrow$ generates and merges Cursor MCP configuration.engrim setup --agy
~/.gemini/config/hooks.json to execute engrim hook --agent agy --event boot on PreInvocation and engrim hook --agent agy --event stop on Stop.~/.gemini/config/skills/engrim/SKILL.md.~/.gemini/antigravity-cli/mcp_config.json and ~/.gemini/config/mcp_config.json.engrim setup --claude
SessionStart, SessionEnd, Stop, and UserPromptSubmit hooks in ~/.claude/settings.json.~/.claude/CLAUDE.md.engrim setup --cursor
engrim to ~/.cursor/mcp.json running engrim serve --mcp.Add engrim to your ~/.codeium/windsurf/mcp_config.json:
{ "mcpServers": { "engrim": { "command": "engrim", "args": ["serve", "--mcp"] } } }
engrim setup --all
(Use --dry-run with any setup command to inspect changes without modifying disk).
When multiple agents collaborate on a single codebase, provenance matters. engrim records the origin of every memory entry with the origin_agent field:
Allowed values: antigravity, claude-code, cursor, cli, or user.
Automatically populated based on the active hook, MCP client, or CLI session.
Subtly surfaced in engrim context and engrim list:
🧠 engrim · memory restored for this project — you don't have to re-explain · /workspace
18 of 54 curated records loaded (~3850 chars) · the rest one recall away
[DECISION]
Existing databases are non-destructively migrated on first access via ALTER TABLE memories ADD COLUMN origin_agent TEXT.
Launch the zero-dependency, JSON-RPC 2.0 stdio MCP server:
engrim serve --mcp
stdout is strictly reserved for JSON-RPC messages, redirecting all diagnostic logs to stderr.
| Tool | Signature | Purpose |
|---|---|---|
engrim_recall |
(query: str, project: str = "auto", k: int = 5, type: str = None) |
Hybrid (keyword + semantic) search over project memory. |
engrim_add |
(type: str, summary: str, detail: str = None, tags: list[str] = []) |
Write a durable memory record persisted across sessions. |
engrim_context |
(project: str = "auto", budget: int = 4000) |
Retrieve the session-boot memory pack within a character budget. |
engrim_review |
(project: str = "auto") |
Check uncaptured decisions from transcript logs before clearing. |
| Command | Usage | Description |
|---|---|---|
engrim add |
engrim add -t decision -s "..." [--origin-agent agy] |
Insert memory record (types: decision, fact, feedback, state, user, reference). |
engrim recall |
engrim recall -q "database" |
Ranked hybrid recall for the project (--log searches raw turns). |
engrim context |
engrim context [-b 4000] |
Priority-ordered, budget-capped session-boot pack. |
engrim hook |
engrim hook --agent agy --event boot |
Agent lifecycle hook runner for Antigravity and Claude Code. |
engrim setup |
`engrim setup [--agy | --claude |
engrim serve |
engrim serve --mcp |
Start stdio MCP server for agent integrations. |
engrim review |
engrim review |
"Safe to clear" coverage check: scans logs for uncurated decisions. |
engrim list |
engrim list [-k 20] |
List recent memories for the current project. |
engrim supersede |
engrim supersede --id 12 --status superseded |
Mark a record superseded without erasing history. |
engrim sync |
engrim sync [DIR] |
Mirror markdown memories into the store (idempotent seed-once). |
engrim add or invoke engrim_add via your agent.resume-pointer: Before ending a session or clearing, add a record tagged resume-pointer describing the immediate next task. The newest pointer is pinned under [▶ RESUME HERE] at the top of the next session's boot pack.engrim review: Check that all recent decisions are captured./clear): The session window is wiped clean; engrim automatically re-injects the active memory pack on the next prompt or invocation.~/.engrim/memory.db). No telemetry, no cloud sync, no tracking.model2vec for local static embeddings (~30ms load time, no GPU required, runs on CPU). Can run pure-lexical (ENGRIM_EMBED=off) for zero extra dependencies.0600).*.db is gitignored by default; your memories never accidentally commit to version control.MIT © 2026 Tim Gordon.