接入你的智能体
从发布者处安装。不是 PlugMCP 端点。
远程 URL 还是本机命令? 两种安装方式的区别
The Universal Cross-Model & Cross-Agent Episodic Memory Standard.
A local-first, project-scoped SQLite memory engine that allows developers to freely switch between models and environments (Google Antigravity, Claude Code, Cursor, Codex CLI, GitHub Copilot CLI, OpenCode, and Windsurf) on the same codebase 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."
Engrim is the universal, cross-model episodic memory standard engineered specifically for autonomous AI coding agents and heavy software development.
It solves the "200,000-token context window trap" (where coding models suffer from severe attention dilution, compounding per-turn token costs, and the loss of prior architectural decisions whenever a chat session is cleared) by replacing raw transcript replay with 4,000 characters of high-precision, curated episodic working memory stored in a single, local-first SQLite file (~/.engrim/memory.db).
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, guidance & optional MCP)"]
OPENCODE["OpenCode<br/>(Plugin & MCP)"]
COPILOT["GitHub Copilot CLI<br/>(Command hooks & MCP)"]
end
subgraph CoreEngine ["engrim Core Engine (v1.4.11)"]
ADAPTERS["Adapters & Lifecycle Hooks<br/>(agy, claude, opencode, copilot, mcp)"]
DOCTOR["Health & Diagnostic Engine<br/>(engrim doctor --fix)"]
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
CODEX <-->|"command hook / MCP"| ADAPTERS
OPENCODE <-->|"plugin / MCP"| ADAPTERS
COPILOT <-->|"command hook / MCP"| ADAPTERS
ADAPTERS --> PROVENANCE
PROVENANCE --> ROUTER
ROUTER --> MEMORIES
MEMORIES --- FTS5
MEMORIES --- VEC
ADAPTERS --> LOG
engrim injects the top-priority memory pack (~4k chars) into the agent's context, leading with [▶ RESUME HERE].engrim_add) or lifecycle hooks automatically, tracking the origin_agent provenance.bm25) + vector (model2vec) search retrieves relevant records on demand in ~30ms without slowing down the agent./clear. The next session boots from memory.db with zero memory loss.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.~/.codex exists $\rightarrow$ wires Codex CLI native command hooks and managed global AGENTS.md guidance. MCP stays opt-in.~/.config/opencode exists $\rightarrow$ writes OpenCode plugin, registers MCP server, and adds AGENTS.md notes.~/.copilot exists $\rightarrow$ wires Copilot CLI hooks and the Engrim status line, registers the MCP server, and adds copilot-instructions.md notes.engrim doctor)Verify database integrity, semantic recall coverage, and all configured agent hooks across your system:
# Run comprehensive health diagnostic across all agent environments
engrim doctor
# Automatically repair broken hook paths or cross-OS migrations with self-healing PATH fallback
engrim doctor --fix
# Output diagnostic report as JSON (for CI pipelines or health monitoring)
engrim doctor --json
Real output:
================================================================================
🩺 ENGRIM DOCTOR: DIAGNOSTIC HEALTH CHECK
================================================================================
Platform : linux (x86_64) · Python 3.12.3
Engrim CLI : /home/user/.local/bin/engrim
Project : /workspace/my-project
[1] Database & Storage Engine
✓ Store Location : /home/user/.engrim/memory.db
✓ Integrity Check : ok
✓ Journal Mode : wal (WAL)
✓ Curated Memories : 956 active / 1057 total
(decision=413, fact=178, feedback=47, reference=20, state=283, user=15)
✓ Flight Log Turns : 48501 logged
[2] Semantic Recall Engine
✓ Model Available : model2vec:minishlab/potion-base-8M
✓ Embedded Records : 1032 / 956
[3] Agent Environments & Hooks
Google Antigravity (~/.gemini):
✓ PreInvocation hook: valid
✓ Stop hook: valid
✓ MCP server: /home/user/.local/bin/engrim (valid)
✓ Skill deployed: yes
Claude Code (~/.claude):
✓ SessionStart hook: valid
✓ SessionEnd hook: valid
✓ Stop hook: valid
✓ UserPromptSubmit hook: valid
Codex CLI (~/.codex):
✓ SessionStart hook: valid
✓ SessionEnd hook: valid
✓ Stop hook: valid
✓ UserPromptSubmit hook: valid
✓ Managed AGENTS.md guidance: present
• MCP registration: optional, not configured
GitHub Copilot CLI (~/.copilot):
✓ sessionStart hook: valid
✓ userPromptSubmitted hook: valid
✓ agentStop hook: valid
✓ MCP server: /home/user/.local/bin/engrim (valid)
✓ Status line: configured
================================================================================
Result: All systems healthy. Zero issues detected across all agent hosts.
================================================================================
<bin> || engrim ... || true) ensuring sessions never experience silent hook failures when directories move or dotfiles sync across machines.PRAGMA integrity_check), active records, and semantic model readiness (model2vec).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.For Windsurf, add engrim to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"engrim": {
"command": "engrim",
"args": ["serve", "--mcp"]
}
}
}
engrim setup --codex
SessionStart, SessionEnd, Stop, and UserPromptSubmit command hooks in $CODEX_HOME/hooks.json (~/.codex by default).$CODEX_HOME/AGENTS.md. Existing instructions and symbolic links remain unchanged. If the file already has an unmarked ## Project Memory (engrim) section, setup treats it as user-owned and does not add a duplicate. A non-empty AGENTS.override.md is not modified, but setup warns that it shadows the guidance.engrim CLI directly, so MCP is not required. Hooks must be reviewed and trusted with Codex's /hooks command before they run.To expose the engrim_* tools to Codex, enable the optional MCP server:
engrim setup --codex-mcp
# Equivalent: engrim setup --codex --codex-mcp
This uses Codex's supported codex mcp add command and preserves unrelated config.toml settings. Use /mcp to verify the server, then open a new Codex session so the hooks and guidance load.
engrim uninstall --codex removes only Engrim hooks, the managed guidance block, and the mcp_servers.engrim entry. It preserves all other Codex settings and instructions.
engrim setup --copilot
~/.copilot/hooks/engrim.json (respects $COPILOT_HOME), a file engrim owns outright, so your other hook files are never rewritten.
sessionStart → the memory pack is returned as additionalContext and injected into the new session before your first prompt.userPromptSubmitted → the prompt lands in the flight-recorder log. Copilot CLI discards the output of command hooks on this event, so this hook injects nothing.agentStop → assistant messages are read from the supplied events.jsonl transcript path and added to the flight-recorder log.mcpServers.engrim (engrim serve --mcp) in ~/.copilot/mcp-config.json, exposing the engrim_* tools. Records the agent writes are attributed to copilot automatically.engrim statusline in ~/.copilot/settings.json, providing live curated, logged, in-play, and clear-safety counts. An existing custom status line is preserved.~/.copilot/copilot-instructions.md.Hook entries use Copilot's exec + args form, which runs the binary directly with no shell in between, so a path containing spaces or backslashes needs no quoting. Hook configuration is read at startup: open a new session after setup.
Copilot can flush the final assistant event shortly after agentStop begins, so Engrim polls briefly and recovers any later tail during the next session start. The event-file schema is not a public Copilot compatibility contract. Engrim detects incompatible known records without putting transcript content in diagnostics, warns once through the hook, and reports the persistent issue through engrim doctor until a compatible pass succeeds.
engrim setup --opencode
OpenCode has no shell hooks, so engrim ships as a plugin plus an MCP server:
~/.config/opencode/plugins/engrim.js (respects $XDG_CONFIG_HOME). The plugin calls engrim hook --agent opencode at each lifecycle moment:
engrim_add-ed.mcp.engrim (engrim serve --mcp) in ~/.config/opencode/opencode.json, exposing engrim_* tools to the agent.~/.config/opencode/AGENTS.md.opencode.db stores raw transcripts (sessions, messages, parts) for OpenCode alone. Engrim provides the universal cross-session memory layer:
~/.engrim/memory.db.decision, fact, state) that survive /new, session deletion, and compaction.engrim_recall) and per-prompt minding with cross-agent provenance (origin_agent).gh-aw)See examples/gh-aw/ for engrim inside GitHub Agentic Workflows: memory across runs through artifacts and engrim merge, and a continue-as-clear restart instead of auto-compaction.
engrim setup --all
--all configures Codex hooks and guidance but does not opt in to the Codex MCP server. Add --codex-mcp explicitly when you want that tool interface.
(Use --dry-run with any setup command to preview changes without writing to disk).
Tested across 105 continuous sessions on a 50,000-line algorithmic trading system. Zero regressions across 186 unit tests, zero context loss across model switches.
In production testing on an active algorithmic trading codebase running real capital:
When multiple agents collaborate on a single codebase, provenance matters. engrim records the origin of every memory entry with the origin_agent field:
antigravity, claude-code, cursor, codex, opencode, copilot, cli, or user.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.
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.
engrim_review returns safe_to_clear: null (unknown) when the project has no transcript log. With logged turns, it evaluates whether uncaptured architectural decisions exist before a developer runs /clear.
engrim_add, or you can run engrim add.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. When that work is done, engrim retire marks the pointer done so finished tasks never lead later packs.engrim review: Check that all recent decisions are captured before clearing./clear): The session window is wiped clean. engrim automatically re-injects the active memory pack on the next prompt or invocation with zero context loss.Engrim maintains a strict, transparent architectural boundary between open-source single-developer productivity and enterprise infrastructure:
engrim sets itself apart with a lightweight, local-first SQLite architecture. It requires zero cloud infrastructure, no complex daemon setup, and operates entirely on CPU.engrim is a cross-tool episodic memory engine that tracks provenance across all your tools. With the OpenCode plugin, engrim serves as the durable memory layer rather than competing with it.engrim is engineered specifically for software engineering projects, preserving architectural decisions, invariant constraints, and technical state.~/.engrim/memory.db). No telemetry, no cloud sync, no tracking.model2vec for 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; memories are never accidentally committed to public version control.Engrim was created by Tim Gordon (@timgordontg).
Tim built Engrim to establish the definitive open-source standard for agent episodic memory, giving developers complete freedom from vendor lock-in.
For enterprise licensing, advisory, pilot deployments, or custom agent integrations, reach out at [email protected].
MIT © 2026 Tim Gordon.
The Universal Cross-Model Episodic Memory Standard. Local-first, project-scoped SQLite engine for Google Antigravity, Claude Code, Cursor, Codex CLI, GitHub Copilot CLI, and OpenCode. Zero cloud lock-
概览
The Universal Cross-Model Episodic Memory Standard. Local-first, project-scoped SQLite engine for Google Antigravity, Claude Code, Cursor, Codex CLI, GitHub Copilot CLI, and OpenCode. Zero cloud lock-in.
工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
此记录未列出必需的环境变量。
Engrim 通过 stdio 在本地运行。
上次检查时间:2026-10-27。 The Universal Cross-Model Episodic Memory Standard. Local-first, project-scoped SQLite engine for Google Antigravity, Claude Code, Cursor, Codex CLI, GitHub Copilot CLI, and OpenCode. Zero cloud lock-in.