经 AI Skill Hub 精选评估,engram MCP工具 获评「强烈推荐」。已获得 3.5k 颗 GitHub Star,这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.5 分,适合有一定技术背景的用户使用。
为AI编码代理提供持久化内存管理的开源MCP工具。采用Go语言实现,提供SQL存储后端,支持多Agent通用。使得AI助手能够跨会话保留上下文和历史信息,显著提升编码效率和连贯性。适合构建长期记忆的AI编程助手开发者。
engram MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
为AI编码代理提供持久化内存管理的开源MCP工具。采用Go语言实现,提供SQL存储后端,支持多Agent通用。使得AI助手能够跨会话保留上下文和历史信息,显著提升编码效率和连贯性。适合构建长期记忆的AI编程助手开发者。
engram MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/Gentleman-Programming/engram
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"engram-mcp--": {
"command": "npx",
"args": ["-y", "engram"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 engram MCP工具 执行以下任务... Claude: [自动调用 engram MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"engram_mcp__": {
"command": "npx",
"args": ["-y", "engram"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <img width="1024" alt="Engram — One Brain. Local or Cloud." src="assets/branding/engram-banner.png" /> </p>
<p align="center"> <strong>Persistent memory for AI coding agents</strong><br> <em>One brain. Local or cloud. Agent-agnostic, single binary, zero dependencies.</em> </p>
<p align="center"> <a href="docs/INSTALLATION.md">Installation</a> • <a href="docs/engram-cloud/README.md">Engram Cloud</a> • <a href="docs/AGENT-SETUP.md">Agent Setup</a> • <a href="docs/CODEBASE-GUIDE.md">Codebase Guide</a> • <a href="docs/ARCHITECTURE.md">Architecture</a> • <a href="docs/PLUGINS.md">Plugins</a> • <a href="docs/TEAM-USAGE.md">Team Usage</a> • <a href="CONTRIBUTING.md">Contributing</a> • <a href="DOCS.md">Full Docs</a> </p>
---
engram /ˈen.ɡræm/ — neuroscience: the physical trace of a memory in the brain.
Your AI coding agent forgets everything when the session ends. Engram gives it a brain.
A Go binary with SQLite + FTS5 full-text search, exposed via CLI, HTTP API, MCP server, and an interactive TUI. Works with any agent that supports MCP — Claude Code, OpenCode, Gemini CLI, Codex, VS Code (Copilot), Antigravity, Cursor, Windsurf, or anything else.
Agent (Claude Code / OpenCode / Gemini CLI / Codex / VS Code / Antigravity / ...)
↓ MCP stdio
Engram (single Go binary)
↓
SQLite + FTS5 (~/.engram/engram.db)
brew install gentleman-programming/tap/engram
Windows, Linux, and other install methods → docs/INSTALLATION.md
| Agent | One-liner |
|---|---|
| Claude Code | claude plugin marketplace add Gentleman-Programming/engram && claude plugin install engram |
| Pi | engram setup pi |
| OpenCode | engram setup opencode |
| Gemini CLI | engram setup gemini-cli |
| Codex | engram setup codex |
| Antigravity CLI | engram setup antigravity-cli |
| Windsurf | engram setup windsurf |
| Qwen Code | engram setup qwen |
| Kiro | engram setup kiro |
| Cursor | engram setup cursor |
| VS Code (Copilot) | engram setup vscode-copilot |
| Kilo Code | engram setup kilocode |
| Any other MCP client | See [docs/AGENT-SETUP.md](docs/AGENT-SETUP.md) |
Full per-agent config, Memory Protocol, and compaction survival → docs/AGENT-SETUP.md
What engram setup does — it writes MCP config and plugin files for the chosen agent. After setup, restart your agent and it is ready. No server to start manually.
Do I need to runengram serveorengram mcpmyself? For most agents (Claude Code, Gemini CLI, Codex, VS Code, Cursor, Windsurf) — no. Your agent launchesengram mcpautomatically as a short-lived stdio subprocess whenever it starts a session. You never run it manually.engram serveis only needed when a plugin uses the HTTP API for session tracking: the OpenCode plugin and the Pi extension both talk toengram servein the background.engram setup opencodeandengram setup pinote this; the plugins auto-start the server when possible. If your environment blocks background processes, start it manually in a separate terminal:You do not need> engram serve # runs on port 7437 by default; keep it running >engram serveat all for stdio-only agents (Claude Code, Gemini CLI, Codex, VS Code, Cursor, Windsurf).
No Node.js, no Python, no Docker. One binary, one SQLite file.
```bash git clone https://github.com/Gentleman-Programming/engram.git engram-beta-repo cd engram-beta-repo && git checkout feat/memory-conflict-surfacing-cloud-sync docker compose -f docker-compose.beta.yml up -d go build -o ./engram-beta ./cmd/engram
1️⃣ Phase 1 — Conflict detection on save (sanity)
./engram-beta save \
"Use Clean Architecture" \
"Layers: entities, use cases, adapters." \
--type architecture --project beta-test
./engram-beta save \
"Use Hexagonal Architecture" \
"Ports and adapters separate domain from infra." \
--type architecture --project beta-test
✅ Second save returns candidates[] with the first memory's id.
2️⃣ Phase 2 — Cloud sync of relations cross-machine
```bash ./engram-beta cloud enroll beta-test ./engram-beta sync --cloud --project beta-test ./engram-beta cloud status
export ENGRAM_DATA_DIR=/tmp/engram-beta-data export ENGRAM_CLOUD_SERVER=http://127.0.0.1:28080 export ENGRAM_CLOUD_TOKEN=beta-token-CHANGE-ME-please-32chars mkdir -p "$ENGRAM_DATA_DIR" ```
| Variable | Description | Default |
|---|---|---|
ENGRAM_DATA_DIR | Override data directory | ~/.engram |
ENGRAM_PORT | Override HTTP server port | 7437 |
ENGRAM_URL | Point the **Pi plugin** at an existing engram serve instance instead of auto-starting one. Not an MCP endpoint — used by the HTTP event-capture path only. (The OpenCode plugin honors ENGRAM_PORT/ENGRAM_BIN, not ENGRAM_URL.) | (unset, defaults to http://127.0.0.1:<ENGRAM_PORT>) |
ENGRAM_HTTP_TOKEN | Optional Bearer auth for local HTTP server. When set, destructive and export routes require Authorization: Bearer <token>. Unset = open (zero-config default). | (unset) |
ENGRAM_TIMEZONE | Timezone for timestamp display in TUI and cloud dashboard (e.g. America/New_York). Falls back to system local when unset or invalid. | system local |
ENGRAM_CLOUD_AUTOSYNC | Set to 1 to enable background autosync (also requires ENGRAM_CLOUD_TOKEN + ENGRAM_CLOUD_SERVER). | (unset) |
ENGRAM_CLOUD_ALLOWED_PROJECTS | Comma-separated project allowlist for engram cloud serve. Use * to allow all projects. | (unset) |
Full environment variable reference → DOCS.md#environment-variables
| Command | Description |
|---|---|
engram setup [agent] | Install agent integration |
engram serve [port] | Start HTTP API (default: 7437) |
engram mcp [--tools=PROFILE] [--project NAME] | Start MCP server (stdio transport) |
engram tui | Launch terminal UI |
engram search <query> | Search memories |
engram save <title> <msg> | Save a memory |
engram delete <obs_id> | Delete an observation (soft by default; --hard removes permanently) |
engram delete session <id> | Delete a session by ID (must have no observations) |
engram delete prompt <id> | Delete a prompt by ID (permanent) |
engram delete project <name> [--hard] | Cascade-delete a project: soft-deletes observations by default (--hard removes permanently and also removes sessions) |
engram timeline <obs_id> | Chronological context |
engram context [project] | Recent session context |
engram stats | Memory statistics |
engram export [file] | Export to JSON |
engram import <file> | Import from JSON |
engram sync | Git sync export/import |
engram conflicts <sub> | Inspect and manage memory conflict relations |
engram doctor | Run read-only operational diagnostics |
engram cloud <subcommand> | Opt-in cloud config/status/enrollment + cloud runtime (serve) |
engram projects list\|consolidate\|prune | Manage project names |
engram obsidian-export | Export to Obsidian vault (beta) |
engram version | Show version |
Full CLI with all flags → docs/ARCHITECTURE.md#cli-reference
Engram has a first-class Pi package: gentle-engram.
engram setup pi
It gives Pi persistent project memory, compaction recovery, and shared memory with other MCP agents through the same local-or-cloud Engram brain. The package is part of the Gentleman Programming agentic-coding ecosystem alongside Gentle-AI, SDD, skills, and Engram Cloud.
Cloud is optional. Local SQLite stays authoritative; cloud is replication/shared access only.
Recommended first path (local smoke):
docker compose -f docker-compose.cloud.yml up -d
engram cloud config --server http://127.0.0.1:18080
engram cloud enroll smoke-project
engram sync --cloud --project smoke-project
Cloud mode is always project-scoped (--project is required; engram sync --cloud --all is intentionally blocked). ENGRAM_CLOUD_ALLOWED_PROJECTS is required for engram cloud serve in both token-auth and insecure modes. Set it to * to allow all projects (useful for dev/internal deploys) — this bypasses per-project name enforcement while still requiring a non-empty project on each request. Known repairable cloud sync/upsert/canonicalization failures keep the original error visible and recommend the explicit doctor/repair flow below; Engram never auto-applies repair from sync or autosync. For blocked cloud sync, transport_failed, or legacy session directory repair, see Engram Cloud Troubleshooting. If cloud sync stays blocked after doctor/repair, download the rescue helper and run the recommended exported-row repair:
tools/repair-missing-session-directory.sh --apply --interactive --fix-exported <project>
engram sync --cloud --project <project>
--fix-exported repairs local exported sessions[].directory and observations[] required fields that can still break the final push after doctor reports ready. For sequential legacy sync_mutations blockers, use tools/repair-missing-session-directory.sh --apply --interactive --all <project>.
After upgrading engram while an MCP client is already running:
engram setup claude-code
Then restart Claude Code so it reloads the Engram MCP subprocess and refreshed hook/config files. Updating the engram binary on disk does not replace an already-running stdio MCP process.
Upgrade flow for existing local databases (diagnose → repair → bootstrap → status):
engram cloud upgrade doctor --project smoke-project # read-only readiness check
engram cloud upgrade repair --project smoke-project --dry-run
engram cloud upgrade repair --project smoke-project --apply
engram cloud upgrade bootstrap --project smoke-project # resumable enroll + push + verify
engram cloud upgrade status --project smoke-project # stage/class/reason
See DOCS.md — Cloud upgrade flow for the full state machine.
For authenticated mode, upgrade flow, dashboard behavior, reason codes, and full runtime/env details:
When do I need to manually add config to my agent's prompt or settings?
engram setup covers the MCP wiring automatically. Manual config — adding a Memory Protocol snippet to your CLAUDE.md, GEMINI.md, .cursorrules, etc. — is only needed if your agent keeps forgetting to use Engram after long sessions or context compaction. That manual step is called the "nuclear option" in the detailed docs because system prompts survive everything, including compaction. It is a reliability boost for heavy users, not a required first step. See Agent Setup → Surviving Compaction for the snippets.
Can Docker agents (or remote agents) connect to Engram's MCP?
Engram's MCP transport is stdio only — there is no HTTP or network MCP endpoint. engram mcp speaks the MCP protocol over stdin/stdout; it cannot be reached over a TCP port.
If you have agents running in Docker that need to write to Engram on the host, the available paths are:
engram serve): note that engram serve currently binds to 127.0.0.1 only, so it is not reachable from inside a container out of the box — a container cannot reach the host's loopback, and there is no bind-address flag yet. ENGRAM_URL lets the Pi plugin target an engram serve reachable on a routable host/port (e.g. ENGRAM_URL=http://host.docker.internal:7437 pi), but that only works once the server listens on a non-loopback interface, which is not supported today. The HTTP API is not the MCP protocol; Pi uses it for session capture and Pi-native mem_* tools. For Docker right now, prefer the stdio path below.engram binary into the container and let the agent launch engram mcp locally via stdio, pointing ENGRAM_DATA_DIR at a volume shared with the host.Full environment variable reference → DOCS.md#environment-variables
→ Report feedback: issues with beta-phase-2-3-4 label
Engram 为 AI coding agents 提供持久化记忆能力。它作为一个“单一大脑”,既可以运行在本地,也可以部署在云端。Engram 具有 Agent-agnostic(与智能体无关)的特性,采用单二进制文件设计,实现零依赖运行,旨在为开发者构建一个跨平台、跨环境的知识存储中心。
您可以通过 Homebrew 进行快速安装:`brew install gentleman-programming/tap/engram`。对于 Windows 和 Linux 用户,请参考官方文档获取更多安装方式。此外,您也可以通过克隆 GitHub 仓库并使用 Docker Compose 启动 beta 版本进行开发测试,或通过 `go build` 手动构建二进制文件。
Engram 支持通过命令行快速记录项目上下文。例如,在进行架构设计时,您可以使用 `save` 命令记录特定的架构规范(如 Clean Architecture)。当后续尝试保存冲突的记忆时,Engram 会通过 `candidates[]` 返回冲突检测结果,确保 AI 智能体在处理项目逻辑时保持记忆的一致性与准确性。
为了确保开发环境的隔离性,您可以通过设置环境变量来避免修改默认的 `~/.engram` 或生产云端数据。通过配置 `ENGRAM_DATA_DIR` 指定数据目录,并利用 `ENGRAM_CLOUD_SERVER` 和 `ENGRAM_CLOUD_TOKEN` 来连接自定义的云端服务器,实现完全受控的测试环境。
Engram 提供丰富的 CLI 工具与接口支持。通过 `engram setup [agent]` 可以快速集成各类 AI 智能体;使用 `engram serve [port]` 可启动 HTTP API 服务;此外,Engram 还支持启动 MCP 服务器模式(`engram mcp`),通过工具集(tools)为智能体提供扩展能力。
Engram 拥有针对 Pi 智能体的原生支持包 `gentle-engram`。通过 `engram setup pi` 命令,可以为 Pi 提供持久化的项目记忆、压缩恢复功能,并能通过统一的本地或云端 Engram 大脑,实现与其他 MCP 智能体的记忆共享。对于云端集成,Engram 采用可选的同步机制,本地 SQLite 始终作为权威数据源,云端则用于数据复制与共享访问。
关于 Engram 的详细使用指南、Beta 测试说明以及常见问题排查,请参阅官方文档 `docs/BETA_TESTING.md`。如果您在测试过程中遇到问题,可以通过 GitHub Issues 并标记 `beta-phase-2-3-4` 标签来提交反馈。
优秀的MCP工具实现,解决AI Agent长期记忆痛点。Go语言保证高性能,SQL存储提供灵活查询能力。社区活跃度高,是构建智能编码助手的核心基础设施。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:engram MCP工具 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | engram |
| 原始描述 | 开源MCP工具:Persistent memory system for AI coding agents. Agent-agnostic Go binary with SQL。⭐3.5k · Go |
| Topics | 持久化记忆编码代理MCP协议Go开发SQL存储 |
| GitHub | https://github.com/Gentleman-Programming/engram |
| License | MIT |
| 语言 | Go |
收录时间:2026-05-16 · 更新时间:2026-05-19 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端