StackMap
Subscribe
Explore / engrim
timgordontg

engrim

Local SQLite episodic memory shared across Antigravity, Claude Code, Cursor, Windsurf and Codex: hooks/MCP capture decisions, FTS5+model2vec hybrid recall reloads ~1k tokens per session.

222 12 Python MITupdated yesterday
View on GitHubDispute this mapping →
Curator's take

Use it when you actually switch harnesses mid-project — Gemini in Antigravity in the morning, Claude Code in the afternoon — and want one memory both write to and read from, with `origin_agent` provenance on every entry. `engrim setup` auto-wires hooks, MCP and status lines for whatever it finds under ~/. The retrieval is cheap and offline (FTS5 + static model2vec embeddings, no API), and the deliberate 4k-char 'memory pack' cap keeps it from becoming a second context window. Don't pick it for cross-project or team memory (it is per-project, per-machine), or if you want raw transcript capture rather than curated decisions/facts/feedback. Small project (~200 stars, one maintainer) — expect rough edges.

Mapped by ShipWithAI editors · links verified

Continue your stack

What teams reach for next — and why each earns a place beside engrim. Ranked by curator confidence.

alternativealternativealternativealternativealternativeclaude-memMemMoltpro-workflowopencode-memmemsearchengrim
pairs wellalternativebuilt withpick a node for the why · open it from the panel
Weekly digest
README.md2 min read

engrim

CI PyPI Python License: MIT Local & private

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.


1. The Core Value Proposition

"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:

  • Switzerland of AI Memory: Decouples project intelligence from any single AI vendor or proprietary cloud silo. Switch from Gemini 3.8 in Antigravity to Claude 3.7 Sonnet in Claude Code to Codex CLI mid-project — your agents pick up right where the others left off.
  • Save Button for Autonomous Coding: Externalize decisions, constraints, and state as you work. The connected AI agents (Antigravity, Claude Code, Cursor, Codex, Codex CLI) can automatically write to memory via MCP tools when they make architectural decisions, or you can manually save them (engrim add). Clear your agent session freely (/clear) and watch context reload intact.
  • Smart, Hot Context Loading: Combines SQLite FTS5 (bm25 keyword search) with static vector embeddings (model2vec) in a zero-latency hybrid reciprocal-rank fusion engine.

2. Empirical Proof (The 105-Session Case Study)

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:

  • Over 153,000 tokens of work across days of architecture, parameter tuning, and debugging was consolidated into an active memory pack under 1,000 tokens (<1% of the context window).
  • That is a 99%+ cut in reloaded context cost on every session restart.
  • Seamlessly switched between Google Antigravity CLI, Claude Code, and Cursor MCP on identical repos with zero model drift or architectural regression.

3. Architecture

graph TD
    subgraph Agents ["Supported Agent Environments"]
        AGY["Google Antigravity<br/>(PreInvocation & Stop Hooks)"]
        CLAUDE["Claude Code<br/>(SessionStart & Stop Hooks)"]
        CURSOR["Cursor / Windsurf<br/>(Model Context Protocol stdio)"]
        CODEX["Codex CLI<br/>(Hooks & MCP)"]
    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)