Show HN: Engrim – A universal, local-first SQLite memory engine for AI CLIs
AI developers often face 'attention dilution' and vendor lock-in when managing context across various large language models. Engrim introduces a local-first SQLite memory engine that serves as a universal, cross-model episodic memory standard, preserving architectural decisions and project state regardless of the AI agent or environment. This solution promises to reduce context costs and prevent 'amnesia' by intelligently curating and loading essential project intelligence, fostering a truly vendor-agnostic development workflow.
The Lowdown
Engrim is presented as a novel local-first, project-scoped SQLite memory engine specifically designed for AI Command Line Interfaces (CLIs). It aims to combat the prevalent issues of "attention dilution" in large context windows and vendor lock-in, ensuring that architectural decisions and project state persist across different AI models and environments. By decoupling critical project intelligence from disposable AI utilities, engrim seeks to make AI development more robust, cost-effective, and flexible.
- Addressing AI Context Limitations: Engrim tackles the problem of attention dilution where large context windows lead to degraded reasoning, increased costs, and complete amnesia when context is cleared.
- Curated Episodic Memory: Instead of relying on vast, often forgotten, context, engrim provides 4,000 characters of highly curated episodic working memory.
- Vendor Agnosticism: It acts as a "Switzerland of AI Memory," allowing developers to seamlessly switch between models like Google Antigravity, Claude Code, and Cursor without losing project intelligence.
- Persistent Project State: Functions as a "Save Button for Autonomous Coding," externalizing decisions, constraints, and state, so agents can reload context intact after session clears.
- Hybrid Context Loading: Combines SQLite FTS5 (BM25 keyword search) with static vector embeddings (
model2vec) for efficient, zero-latency retrieval. - Empirical Validation: Tested over 105 sessions on a 50,000-line algorithmic trading system, it reduced reloaded context costs by over 99% (from 153,000+ tokens to under 1,000) with zero regressions or context amnesia.
- Modular Architecture: Features adapters for various agent environments, an agent provenance engine, and a hybrid retrieval system, all built around a local SQLite database for memories, FTS5, and vector embeddings.
- Ease of Integration: Offers an auto-detection setup and explicit configuration options for Google Antigravity, Claude Code, Cursor, and Windsurf, simplifying its adoption.
- Agent Provenance: Tracks the
origin_agentfor each memory record, providing clarity on which agent made specific decisions in a multi-agent workflow. - Hardened MCP Server: Includes a zero-dependency, JSON-RPC 2.0 stdio Model Context Protocol (MCP) server for robust agent integrations, exposing tools like
recall,add,context, andreview. - CLI Functionality: Provides a comprehensive command-line interface for managing all aspects of memory, from adding new records and recalling past information to setting up environments and reviewing uncaptured decisions.
- "Continue-As-Clear" Workflow: Promotes a cycle of capturing decisions, setting
resume-pointertasks, verifying captures, and then clearing sessions, with engrim automatically re-injecting necessary context. - Robust Security & Privacy: Operates 100% locally with all data stored in a private SQLite file, utilizes local
model2vecfor embeddings, enforces POSIX file permissions, and integrates with Git to prevent memory files from being committed.
In essence, engrim positions itself as a foundational component for AI development, offering a durable, local, and vendor-agnostic solution to the problem of managing and preserving project context across the rapidly evolving landscape of large language models and AI agents.