The Universal Cross-Model & Cross-Agent Episodic Memory Store.
A local-first, project-scoped SQLite representation motor that allows developers to freely move betwixt models and environments (Google Antigravity, Claude Code, Cursor MCP, Windsurf) connected the SAME task without losing architectural decisions, personification constraints, aliases task state.
1. The Core Value Proposition
"Why salary for 200,000 tokens of forgotten sound connected each turn? The models are disposable utilities; your project's decisions are not."
As discourse windows standard to 1M+ tokens, developers look attention dilution: reasoning degrades, costs multiplies pinch each conversational turn, and clearing discourse causes full amnesia.
engrim replaces attraction dilution pinch 4,000 characters of curated episodic moving memory:
- Switzerland of AI Memory: Decouples task intelligence from immoderate azygous AI vendor aliases proprietary unreality silo. Switch from Gemini 3.8 successful Antigravity to Claude 3.7 Sonnet successful Claude Code to GPT-4o successful Cursor mid-project — your agents prime up correct wherever the others near off.
- Save Button for Autonomous Coding: Externalize decisions, constraints, and authorities arsenic you work. Clear your supplier convention freely (/clear) and watch discourse reload intact.
- Smart, Hot Context Loading: Combines SQLite FTS5 (bm25 keyword search) pinch fixed vector embeddings (model2vec) successful a zero-latency hybrid reciprocal-rank fusion engine.
2. Empirical Proof (The 105-Session Case Study)
Tested crossed 105 continuous sessions connected a 50,000-line algorithmic trading system. Zero regressions crossed 186 portion tests, zero discourse amnesia crossed exemplary switches.
In accumulation testing connected an progressive algorithmic trading codebase moving existent capital:
- Over 153,000 tokens of work crossed days of architecture, parameter tuning, and debugging was consolidated into an progressive representation battalion nether 1,000 tokens (<1% of the discourse window).
- That is simply a 99%+ trim successful reloaded discourse cost connected each convention restart.
- Seamlessly switched betwixt Google Antigravity CLI, Claude Code, and Cursor MCP connected identical repos pinch zero exemplary drift aliases architectural regression.
4. Multi-Agent Quickstart
Auto-Detection (Recommended)
Run engrim setup without arguments. It automatically detects installed environments connected your instrumentality and configures them all:
- If ~/.gemini exists $\rightarrow$ wires Antigravity lifecycle hooks, skill, and MCP server.
- If ~/.claude exists $\rightarrow$ wires Claude Code SessionStart, Stop, position line, and CLAUDE.md.
- If ~/.cursor exists $\rightarrow$ generates and merges Cursor MCP configuration.
- Configures ~/.gemini/config/hooks.json to execute engrim hook --agent agy --event footwear connected PreInvocation and engrim hook --agent agy --event extremity connected Stop.
- Deploys the canonical Antigravity accomplishment to ~/.gemini/config/skills/engrim/SKILL.md.
- Registers the MCP server successful ~/.gemini/antigravity-cli/mcp_config.json and ~/.gemini/config/mcp_config.json.
- Wires SessionStart, SessionEnd, Stop, and UserPromptSubmit hooks successful ~/.claude/settings.json.
- Configures unrecorded ambient position statement successful Claude Code's position bar.
- Appends representation usage notes to ~/.claude/CLAUDE.md.
- Adds engrim to ~/.cursor/mcp.json moving engrim service --mcp.
Add engrim to your ~/.codeium/windsurf/mcp_config.json:
- Configures each supported situation successful 1 command.
(Use --dry-run pinch immoderate setup bid to inspect changes without modifying disk).
5. Agent Provenance Tracking
When aggregate agents collaborate connected a azygous codebase, provenance matters. engrim records the root of each representation introduction pinch the origin_agent field:
- Allowed values: antigravity, claude-code, cursor, cli, aliases user.
- Automatically populated based connected the progressive hook, MCP client, aliases CLI session.
- Subtly surfaced successful engrim discourse and engrim list:
Existing databases are non-destructively migrated connected first entree via ALTER TABLE memories ADD COLUMN origin_agent TEXT.
6. Hardened Model Context Protocol (MCP) Server
Launch the zero-dependency, JSON-RPC 2.0 stdio MCP server:
stdout is strictly reserved for JSON-RPC messages, redirecting each diagnostic logs to stderr.
| engrim_recall | (query: str, project: str = "auto", k: int = 5, type: str = None) | Hybrid (keyword + semantic) hunt complete task memory. |
| engrim_add | (type: str, summary: str, detail: str = None, tags: list[str] = []) | Write a durable representation grounds persisted crossed sessions. |
| engrim_context | (project: str = "auto", budget: int = 4000) | Retrieve the session-boot representation battalion wrong a characteristic budget. |
| engrim_review | (project: str = "auto") | Check uncaptured decisions from transcript logs earlier clearing. |
| engrim add | engrim adhd -t determination -s "..." [--origin-agent agy] | Insert representation grounds (types: decision, fact, feedback, state, user, reference). |
| engrim recall | engrim callback -q "database" | Ranked hybrid callback for the task (--log searches earthy turns). |
| engrim context | engrim discourse [-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|--cursor|--all] | Universal multi-agent situation configuration. |
| engrim serve | engrim service --mcp | Start stdio MCP server for supplier integrations. |
| engrim review | engrim review | "Safe to clear" sum check: scans logs for uncurated decisions. |
| engrim list | engrim database [-k 20] | List caller memories for the existent project. |
| engrim supersede | engrim supersede --id 12 --status superseded | Mark a grounds superseded without erasing history. |
| engrim sync | engrim sync [DIR] | Mirror markdown memories into the shop (idempotent seed-once). |
8. Continue-As-Clear Workflow
- Capture arsenic you work: Whenever a awesome determination aliases architectural norm is made, tally engrim adhd aliases invoke engrim_add via your agent.
- Use resume-pointer: Before ending a convention aliases clearing, adhd a grounds tagged resume-pointer describing the contiguous adjacent task. The newest pointer is pinned nether [▶ RESUME HERE] astatine the apical of the adjacent session's footwear pack.
- Verify pinch engrim review: Check that each caller decisions are captured.
- Clear freely (/clear): The convention model is wiped clean; engrim automatically re-injects the progressive representation battalion connected the adjacent punctual aliases invocation.
- 100% Local & Offline: All representation records and logs reside successful a section SQLite record (~/.engrim/memory.db). No telemetry, nary unreality sync, nary tracking.
- Model Storage: Uses model2vec for section fixed embeddings (~30ms load time, nary GPU required, runs connected CPU). Can tally pure-lexical (ENGRIM_EMBED=off) for zero other dependencies.
- POSIX File Permissions: Databases are created pinch restricted owner-only permissions (0600).
- Git Protection: *.db is gitignored by default; your memories ne'er accidentally perpetrate to type control.
MIT © 2026 Tim Gordon.
English (US) ·
Indonesian (ID) ·