메뉴
HN
Hacker News • 19일 전

Engrim – AI CLI용 로컬 우선 범용 SQLite 메모리 엔진

IMP
6/10
핵심 요약

Engrim은 프로젝트 단위로 SQLite에 에피소드 메모리를 저장해 개발자가 Google Antigravity, Claude Code, Cursor, Windsurf 등 서로 다른 AI 모델·환경 간에 자유롭게 전환하더라도 아키텍처 결정사항, 사용자 제약조건, 프로젝트 상태를 잃지 않게 해주는 오픈소스 도구입니다. 105세션 실증 테스트에서 15만 토큰 이상의 작업 내용을 1,000토큰 미만의 메모리로 압축해 세션 재시작 시 컨텍스트 비용을 99% 이상 절감했습니다.

번역된 본문

engrim — 범용 교차 모델·교차 에이전트 에피소드 메모리 저장소. 로컬 우선(local-first), 프로젝트 범위 기반 SQLite 메모리 엔진으로, 개발자가 동일한 프로젝트에서 모델과 환경(Google Antigravity, Claude Code, Cursor MCP, Windsurf)을 자유롭게 전환하더라도 아키텍처 결정사항, 사용자 제약조건, 프로젝트 상태를 잃지 않도록 해줍니다.

  1. 핵심 가치 제안 "매 턴마다 잊혀질 20만 토큰의 노이즈에 왜 비용을 지불하는가? 모델은 소모성 유틸리티지만, 프로젝트의 결정사항은 그렇지 않습니다." 컨텍스트 윈도우가 100만 토큰 이상으로 커지면서 개발자들은 '어텐션 희석(attention dilution)' 문제에 직면합니다. 추론 품질이 저하되고, 대화 턴마다 비용이 배가되며, 컨텍스트를 초기화하면 완전한 망각이 발생합니다. engrim은 이를 약 4,000자의 엄선된 에피소드 작업 메모리로 대체합니다.
  • AI 메모리의 스위스: 프로젝트 인텔리전스를 특정 AI 벤더나 독점 클라우드와 분리합니다. 프로젝트 진행 중 Antigravity의 Gemini 3.8에서 Claude Code의 Claude 3.7 Sonnet, Cursor의 GPT-4o로 전환해도 에이전트가 이전 작업 지점에서 정확히 이어받습니다.
  • 자율 코딩을 위한 저장 버튼: 작업 중 결정사항, 제약조건, 상태를 외부화합니다. 에이전트 세션을 자유롭게 초기화(/clear)해도 컨텍스트가 온전히 다시 로드됩니다.
  • 스마트한 핫 컨텍스트 로딩: SQLite FTS5(BM25 키워드 검색)와 정적 벡터 임베딩(model2vec)을 결합한 무지연 하이브리드 상호 랭크 융합 엔진을 사용합니다.
  1. 실증 사례 (105세션 case study) 5만 줄 규모의 알고리즘 트레이딩 시스템에서 105개의 연속 세션에 걸쳐 테스트했습니다. 186개 단위 테스트에서 회귀 없음, 모델 전환 시 컨텍스트 망각 없음을 확인했습니다.

실제 자본이 운용 중인 알고리즘 트레이딩 코드베이스에서 프로덕션 테스트 결과:

  • 수일간의 아키텍처 설계, 파라미터 튜닝, 디버깅에 걸친 153,000토큰 이상의 작업 내용이 1,000토큰 미만(컨텍스트 윈도우의 1% 미만)의 활성 메모리 팩으로 통합되었습니다. 세션 재시작 시 리로드되는 컨텍스트 비용을 99% 이상 절감한 것입니다.
  • 동일한 저장소에서 Google Antigravity CLI, Claude Code, Cursor MCP 사이를 원활하게 전환하며 모델 드리프트나 아키텍처 회귀가 전혀 발생하지 않았습니다.
  1. 아키텍처 지원 에이전트 환경(Google Antigravity PreInvocation & Stop 훅, Claude Code SessionStart & Stop 훅, Cursor/Windsurf MCP stdio)이 어댑터·훅 계층과 연결되고, 에이전트 출처 추적(origin_agent)을 거쳐 하이브리드 검색기(bm25 어휘 검색 + 벡터 코사인 유사도)가 로컬 SQLite 저장소(~/.engrim/memory.db)의 큐레이션된 메모리(결정사항, 사실, 피드백), FTS5 전문 검색(포터 스테머, 트리거), 벡터 임베딩(model2vec 정적 임베딩), 플라이트 레코더 로그(턴 + 액션 라인)와 상호작용합니다.

  2. 멀티 에이전트 퀵스타트 설치: pip install engrim 자동 감지(권장): 인자 없이 engrim setup을 실행하면 머신에 설치된 환경을 자동으로 감지해 모두 구성합니다.

  • ~/.gemini가 있으면 Antigravity 라이프사이클 훅, 스킬, MCP 서버를 연결합니다.
  • ~/.claude가 있으면 Claude Code SessionStart, Stop, 상태 라인, CLAUDE.md를 구성합니다.
  • ~/.cursor가 있으면 Cursor MCP 설정을 생성·병합합니다.

명시적 플랫폼 설정(Google Antigravity 예시): engrim setup --agy ~/.gemini/config/hooks.json을 구성해 PreInvocation에서 engrim hook --agent agy --event boot를, Stop에서 engrim hook --agent agy --event stop를 실행하도록 하고, 표준 Antigravity 스킬을 ~/.gemini/config/skills/engrim/SKILL.md에 배포하며, ~/.gemini/antigr...에 MCP 서버를 등록합니다.

원문 보기
원문 보기 (영어)
engrim 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 GPT-4o in Cursor 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. 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)"] 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 4. Multi-Agent Quickstart Installation pip install engrim Auto-Detection (Recommended) Run engrim setup without arguments. It automatically detects installed environments on your machine and configures them all: engrim setup If ~/.gemini exists $\rightarrow$ wires Antigravity lifecycle hooks, skill, and MCP server. If ~/.claude exists $\rightarrow$ wires Claude Code SessionStart, Stop, status line, and CLAUDE.md. If ~/.cursor exists $\rightarrow$ generates and merges Cursor MCP configuration. Explicit Platform Setup Google Antigravity engrim setup --agy Configures ~/.gemini/config/hooks.json to execute engrim hook --agent agy --event boot on PreInvocation and engrim hook --agent agy --event stop on Stop . Deploys the canonical Antigravity skill to ~/.gemini/config/skills/engrim/SKILL.md . Registers the MCP server in ~/.gemini/antigravity-cli/mcp_config.json and ~/.gemini/config/mcp_config.json . Claude Code engrim setup --claude Wires SessionStart , SessionEnd , Stop , and UserPromptSubmit hooks in ~/.claude/settings.json . Configures live ambient status line in Claude Code's status bar. Appends memory usage notes to ~/.claude/CLAUDE.md . Cursor engrim setup --cursor Adds engrim to ~/.cursor/mcp.json running engrim serve --mcp . Windsurf Add engrim to your ~/.codeium/windsurf/mcp_config.json : { "mcpServers" : { "engrim" : { "command" : " engrim " , "args" : [ " serve " , " --mcp " ] } } } All Platforms engrim setup --all Configures every supported environment in one command. (Use --dry-run with any setup command to inspect changes without modifying disk). 5. Agent Provenance Tracking 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] - #961 [DECISION] (via Antigravity): Inverted stop loss matrix for high volatility (risk, execution) - #942 [DECISION] (via Claude Code): Switched primary database from MongoDB to PostgreSQL (db, schema) - #910 [DECISION] (via Cursor): Standardized on Pydantic v2 schemas across API boundaries (api, types) Existing databases are non-destructively migrated on first access 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: engrim serve --mcp # or: engrim mcp stdout is strictly reserved for JSON-RPC messages, redirecting all diagnostic logs to stderr . Core MCP Tools Exposed: 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. 7. CLI Reference 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|--cursor|--all] Universal multi-agent environment configuration. 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). 8. Continue-As-Clear Workflow Capture as you work : Whenever a major decision or architectural rule is made, run engrim add or invoke engrim_add via your agent. Use 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. Verify with engrim review : Check that a