能力标签
AI编码助手持久化记忆系统
🛠
AI工具

AI编码助手持久化记忆系统

基于 TypeScript · 开源 AI 工具,GitHub 社区精选
英文名:agentmemory
⭐ 13.6k Stars 🍴 1.1k Forks 💻 TypeScript 📄 Apache-2.0 🏷 AI 8.2分
8.2AI 综合评分
智能体记忆AI工作流编码助手Claude持久化存储
✦ AI Skill Hub 推荐

AI Skill Hub 强烈推荐:AI编码助手持久化记忆系统 是一款优质的AI工具。在 GitHub 上收获超过 13.6k 颗 Star,AI 综合评分 8.2 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。

📚 深度解析

AI编码助手持久化记忆系统 是一款基于 TypeScript 的开源工具,在 GitHub 上收获 14k+ Star,是智能体记忆、AI工作流、编码助手、Claude领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
AI编码助手持久化记忆系统 依赖 TypeScript 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 TypeScript 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 AI编码助手持久化记忆系统 的版本更新,及时通知重要功能变化。

📋 工具概览

为AI编码智能体提供持久化内存解决方案,基于真实世界基准测试优化。支持Claude等大模型,帮助开发者构建具有记忆能力的自动化工作流,提升复杂编码任务的完成度和一致性。

AI编码助手持久化记忆系统 是一款基于 TypeScript 开发的开源工具,专注于 智能体记忆、AI工作流、编码助手 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 13.6k
开发语言
TypeScript
支持平台
Windows / macOS / Linux
维护状态
活跃维护,更新频繁
开源协议
Apache-2.0
AI 综合评分
8.2 分
工具类型
AI工具
Forks
1.1k

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

为AI编码智能体提供持久化内存解决方案,基于真实世界基准测试优化。支持Claude等大模型,帮助开发者构建具有记忆能力的自动化工作流,提升复杂编码任务的完成度和一致性。

AI编码助手持久化记忆系统 是一款基于 TypeScript 开发的开源工具,专注于 智能体记忆、AI工作流、编码助手 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:npm 全局安装
npm install -g agentmemory

# 方式二:npx 直接运行(无需安装)
npx agentmemory --help

# 方式三:项目依赖安装
npm install agentmemory

# 方式四:从源码运行
git clone https://github.com/rohitg00/agentmemory
cd agentmemory
npm install
npm start
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
agentmemory --help

# 基本用法
agentmemory [options] <input>

# Node.js 代码中使用
const agentmemory = require('agentmemory');

const result = await agentmemory.run(options);
console.log(result);
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# agentmemory 配置说明
# 查看配置选项
agentmemory --config-example > config.yml

# 常见配置项
# output_dir: ./output
# log_level: info
# workers: 4

# 环境变量(覆盖配置文件)
export AGENTMEMORY_CONFIG="/path/to/config.yml"
📑 README 深度解析 真实文档 完整度 62/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="assets/banner.png" alt="agentmemory: persistent memory for AI coding agents" width="720" /> </p>

<p align="center"> <strong> Your coding agent remembers everything. No more re-explaining. Built on <a href="https://github.com/iii-hq/iii">iii engine</a> </strong><br/> Persistent memory for Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, Hermes, OpenClaw, pi, OpenCode, and any MCP client. </p>

<p align="center"> <a href="README.md">English</a> | <a href="READMEs/README.zh-CN.md">简体中文</a> | <a href="READMEs/README.zh-TW.md">繁體中文</a> | <a href="READMEs/README.ja-JP.md">日本語</a> | <a href="READMEs/README.ko-KR.md">한국어</a> | <a href="READMEs/README.es-ES.md">Español</a> | <a href="READMEs/README.tr-TR.md">Türkçe</a> | <a href="READMEs/README.ru-RU.md">Русский</a> | <a href="READMEs/README.hi-IN.md">हिन्दी</a> | <a href="READMEs/README.pt-BR.md">Português</a> | <a href="READMEs/README.fr-FR.md">Français</a> | <a href="READMEs/README.de-DE.md">Deutsch</a> </p>

<p align="center"> <a href="https://trendshift.io/repositories/25123" target="_blank"><img src="https://trendshift.io/api/badge/repositories/25123" alt="rohitg00/agentmemory | Trendshift" width="250" height="55"/></a> </p>

<p align="center"> <a href="https://gist.github.com/rohitg00/2067ab416f7bbe447c1977edaaa681e2"><img src="https://img.shields.io/badge/Viral%20GitHub%20Gist-1.6k%20stars%20%2F%20230%20forks-FF6B35?style=for-the-badge&logo=github&logoColor=white&labelColor=1a1a1a" alt="Design doc: 1.6k stars / 230 forks on the gist" /></a> </p>

<p align="center"> <em>The gist extends Karpathy's LLM Wiki pattern with confidence scoring, lifecycle, knowledge graphs, and hybrid search: agentmemory is the implementation.</em> </p>

<p align="center"> <a href="https://www.npmjs.com/package/@agentmemory/agentmemory"><img src="https://img.shields.io/npm/v/@agentmemory/agentmemory?color=CB3837&label=npm&style=for-the-badge&logo=npm" alt="npm version" /></a> <a href="https://github.com/rohitg00/agentmemory/actions"><img src="https://img.shields.io/github/actions/workflow/status/rohitg00/agentmemory/ci.yml?label=tests&style=for-the-badge&logo=github" alt="CI" /></a> <a href="https://github.com/rohitg00/agentmemory/blob/main/LICENSE"><img src="https://img.shields.io/github/license/rohitg00/agentmemory?color=blue&style=for-the-badge" alt="License" /></a> <a href="https://github.com/rohitg00/agentmemory/stargazers"><img src="https://img.shields.io/github/stars/rohitg00/agentmemory?style=for-the-badge&color=yellow&logo=github" alt="Stars" /></a> </p>

<p align="center"> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-recall.svg"><img src="assets/tags/stat-recall.svg" alt="95.2% retrieval R@5" height="38" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tokens.svg"><img src="assets/tags/stat-tokens.svg" alt="92% fewer tokens" height="38" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="54 MCP tools" height="38" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-hooks.svg"><img src="assets/tags/stat-hooks.svg" alt="12 auto hooks" height="38" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-deps.svg"><img src="assets/tags/stat-deps.svg" alt="0 external DBs" height="38" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="1,674+ tests passing" height="38" /></picture> </p>

<p align="center"> <img src="assets/demo.gif" alt="agentmemory demo" width="720" /> </p>

<p align="center"> <a href="#install">Install</a> &bull; <a href="#quick-start">Quick Start</a> &bull; <a href="#benchmarks">Benchmarks</a> &bull; <a href="#vs-competitors">vs Competitors</a> &bull; <a href="#works-with-every-agent">Agents</a> &bull; <a href="#how-it-works">How It Works</a> &bull; <a href="#mcp-server">MCP</a> &bull; <a href="#real-time-viewer">Viewer</a> &bull; <a href="#powered-by-iii">Powered by iii</a> &bull; <a href="#configuration">Config</a> &bull; <a href="#api">API</a> </p>

---

Key Capabilities

CapabilityDescription
**Automatic capture**Every tool use recorded via hooks, no manual effort
**Semantic search**BM25 + vector + knowledge graph with RRF fusion
**Memory evolution**Versioning, supersession, relationship graphs
**Recall hygiene**Superseded memory versions leave the search indexes; the version chain in KV keeps full history
**Near-duplicate hints**Saves report an advisory similarTo match when new content closely resembles an existing memory
**Per-agent scoping**agentId threads through save and recall across REST, MCP, and the search index, in shared or isolated mode
**Write-time provenance**Every observation and memory carries an immutable origin channel (user, agent, tool, import, or shared) stamped at capture, save, and import
**Auto-forgetting**TTL expiry, contradiction detection, importance eviction
**Privacy first**API keys, secrets, <private> tags stripped before storage
**Self-healing**Circuit breaker, provider fallback chain, health monitoring
**Claude bridge**Bi-directional sync with MEMORY.md
**Knowledge graph**Entity extraction + BFS traversal
**Team memory**Namespaced shared + private across team members
**Citation provenance**Trace any memory back to source observations
**Git snapshots**Version, rollback, and diff memory state

---

Install

Requirements:

  • Node.js 20 or newer with npm and npx (node -v, npm -v, and npx -v).
  • macOS/Linux automatic iii-engine installation also needs curl, a POSIX sh, and tar. Minimal images such as node:20-slim may not include them.
  • Native Windows requires the pinned iii-engine v0.11.2 iii.exe to be installed manually. WSL2 or Docker Desktop are the other supported paths.

Canonical fresh-install command:

npx -y @agentmemory/agentmemory@latest

The first run is an interactive setup: pick the agents to wire (Claude Code, Cursor, Codex, Gemini CLI, OpenCode, ...), pick an LLM provider or stay keyless, and it seeds the config, starts the memory server and its pinned iii engine, and offers to install globally so the bare agentmemory command works everywhere afterward. -y accepts npx's package prompt and @latest avoids a stale cached release. A provider makes LLM features available, but LLM-written observation compression starts only when AGENTMEMORY_AUTO_COMPRESS=true is also set.

Keyless mode disables vector embeddings. memory_recall (the mem::search path) uses BM25, while memory_smart_search can also fuse structural graph matches when graph data already exists. For free on-device semantic recall, set EMBEDDING_PROVIDER=local in ~/.agentmemory/.env and restart. The first embedding request downloads Xenova/all-MiniLM-L6-v2; inference runs locally after that initial model download.

The local runtime uses four ports: 3111 for REST/MCP HTTP, 3112 for iii streams, 3113 for the viewer, and 49134 for the iii worker WebSocket. Persistent iii state lives in ~/Library/Application Support/agentmemory on macOS, $XDG_DATA_HOME/agentmemory or ~/.local/share/agentmemory on Linux, and %APPDATA%\agentmemory on Windows. Use --data-dir <path> or AGENTMEMORY_DATA_DIR to override it, and reuse the same value on every restart. For backward compatibility, an existing ./data/state_store.db or ./data/iii-config.yaml takes precedence over the platform default for instance 0; an explicit flag or environment override still wins.

Then prove recall works and give your agent its skills:

npx -y @agentmemory/agentmemory@latest demo  # seed sample sessions + exercise recall
npx skills add rohitg00/agentmemory -y   # 17 native skills so your agent knows when to reach for memory

The keyword searches should hit in default keyless mode through BM25. The demo's database performance optimization query is intentionally semantic and can return zero until an embedding provider is configured.

Prefer to let a coding agent do the whole thing? Hand it one instruction:

Retrieve and follow the instructions at: https://raw.githubusercontent.com/rohitg00/agentmemory/main/INSTALL_FOR_AGENTS.md

Wire more agents any time with agentmemory connect <agent> — 20 adapters listed at Works with every agent. Full command reference at Quick Start.

<details> <summary><strong>Windows</strong></summary>

The fast path is WSL2. Native Windows engine setup requires the pinned v0.11.2 ZIP to be downloaded and iii.exe extracted manually; the CLI does not auto-extract it. Docker Desktop is also supported. See the Windows notes for the step-by-step.

</details>

<details> <summary><strong>Global install / EACCES</strong></summary>

npm install -g @agentmemory/agentmemory@latest

The npx command above remains the canonical fresh-install path and avoids global-prefix permission issues.

</details>

<details> <summary><strong>npx serves an old version</strong></summary>

npx caches per version. Force the latest with npx -y @agentmemory/agentmemory@latest, or clear the cache once with rm -rf ~/.npm/_npx (macOS/Linux; on Windows delete %LOCALAPPDATA%\npm-cache\_npx).

</details>

<details> <summary><strong>Already running your own iii engine</strong></summary>

agentmemory pins iii-engine v0.11.2 and won't attach to a different version (the worker can't speak another engine's protocol). Stop the other engine, then run npx -y @agentmemory/agentmemory@latest. It installs and runs the pinned v0.11.2 in ~/.agentmemory/bin, leaving your own iii untouched.

</details>

---

Works with every agent

agentmemory works with any agent that supports hooks, MCP, or REST API. All agents share the same memory server.

Claude Code
Claude Code
native plugin + 12 hooks + MCP
Codex CLI
Codex CLI
native plugin + 6 hooks + MCP
GitHub Copilot CLI
GitHub Copilot CLI
MCP + plugin hooks/skills
OpenClaw
OpenClaw
native plugin + MCP
Hermes
Hermes
native plugin + MCP
pi
pi
native plugin + MCP
OpenHuman
OpenHuman
native Memory trait backend
Cursor
Cursor
native plugin + MCP
Gemini CLI
Gemini CLI
MCP server
OpenCode
OpenCode
22 hooks + MCP + plugin
Cline
Cline
MCP server
Goose
Goose
MCP server
Kilo Code
Kilo Code
MCP server
Aider
Aider
REST API
Claude Desktop
Claude Desktop
MCP server
Devin
Devin
6 hooks + MCP
Roo Code
Roo Code
MCP server
Warp
Warp
connect + MCP + skills

<p align="center"> <sub>Works with <strong>any</strong> agent that speaks MCP or HTTP. One server, memories shared across all of them.</sub> </p>

---

You explain the same architecture every session. You re-discover the same bugs. You re-teach the same preferences. Built-in memory (CLAUDE.md, .cursorrules) caps out at 200 lines and goes stale. agentmemory fixes this. It silently captures what your agent does, compresses it into searchable memory, and injects the right context when the next session starts. One command. Works across agents.

What changes: Session 1 you set up JWT auth. Session 2 you ask for rate limiting. The agent already knows your auth uses jose middleware in src/middleware/auth.ts, your tests cover token validation, and you chose jose over jsonwebtoken for Edge compatibility, with no re-explaining and no copy-pasting.

npx -y @agentmemory/agentmemory@latest

By default, agentmemory stores iii-engine state outside the repository you start it from: ~/Library/Application Support/agentmemory on macOS, $XDG_DATA_HOME/agentmemory or ~/.local/share/agentmemory on Linux, and %APPDATA%\agentmemory on Windows. An existing legacy ./data/state_store.db or ./data/iii-config.yaml is reused for instance 0 before that platform default. To choose a location explicitly, pass --data-dir <path> or set AGENTMEMORY_DATA_DIR; either explicit setting takes precedence over legacy discovery:

npx -y @agentmemory/agentmemory@latest --data-dir ~/.agentmemory-projects/main
AGENTMEMORY_DATA_DIR=~/.agentmemory-projects/main npx -y @agentmemory/agentmemory@latest

Native and Docker launches use this same resolved host directory; Docker bind-mounts it at /data. --instance 1 appends instance-1 to the resolved directory and selects the separate default port quartet 3211/3212/3213/49234.

Latest release notes: CHANGELOG.md.

---

Benchmarks

Validate a fresh install and restart persistence

With the server running, validate REST, health, the viewer, and the iii-backed runtime status:

curl -fsS http://localhost:3111/agentmemory/livez
curl -fsS http://localhost:3111/agentmemory/health
curl -fsS -o /dev/null http://localhost:3113/
npx -y @agentmemory/agentmemory@latest status

The startup ready panel accounts for all four ports: REST/MCP HTTP on 3111, iii streams on 3112, the viewer on 3113, and the iii worker WebSocket on 49134. status confirms agentmemory health and the active provider/embedding mode. Save a probe and confirm it is searchable:

curl -fsS -X POST http://localhost:3111/agentmemory/remember \
  -H 'Content-Type: application/json' \
  -d '{"content":"agentmemory restart persistence probe","concepts":["install-check"]}'

curl -fsS -X POST http://localhost:3111/agentmemory/smart-search \
  -H 'Content-Type: application/json' \
  -d '{"query":"restart persistence probe","limit":5}'

Then run npx -y @agentmemory/agentmemory@latest stop, start the canonical command again in Terminal 1, wait for /agentmemory/livez, and repeat the search. The probe must still be returned. If you selected a custom --data-dir, pass the same directory on the restart.

2. register the agentmemory marketplace and install the plugin

codex plugin marketplace add rohitg00/agentmemory codex plugin add agentmemory@agentmemory


The Codex plugin ships from the same `plugin/` directory as the Claude Code plugin. It registers:

- `@agentmemory/mcp` as an MCP server (proxies all 54 tools when `AGENTMEMORY_URL` points at a running agentmemory server; falls back to 7 tools locally when no server is reachable)
- 6 lifecycle hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `Stop`
- 9 invocable skills: `/recall`, `/remember`, `/session-history`, `/forget`, `/recap`, `/handoff`, `/lesson`, `/commit-context`, `/commit-history`, plus 8 reference skills the agent loads on demand (memory discipline, MCP tools, REST API, config, agents, hooks, architecture, and the skill-authoring guide)

Codex's hook engine injects `CLAUDE_PLUGIN_ROOT` into hook subprocesses (per [`codex-rs/hooks/src/engine/discovery.rs`](https://github.com/openai/codex/blob/main/codex-rs/hooks/src/engine/discovery.rs)), so the same hook scripts work across both hosts without duplication. Subagent / SessionEnd / Notification / TaskCompleted / PostToolUseFailure events are Claude-Code-only and are not registered for Codex.

#### Codex Desktop: plugin hooks currently silent (workaround available)

`CodexHooks` and `PluginHooks` are both stable + default-enabled in [`codex-rs/features/src/lib.rs`](https://github.com/openai/codex/blob/main/codex-rs/features/src/lib.rs), but Codex Desktop builds currently do not dispatch plugin-local `hooks.json` ([openai/codex#16430](https://github.com/openai/codex/issues/16430)). MCP tools still work; only the lifecycle observations are missing.

Until upstream lands the fix, mirror the same hook commands into the global `~/.codex/hooks.json`:
bash agentmemory connect codex --with-hooks ```

This adds an idempotent block to ~/.codex/hooks.json referencing absolute paths to the bundled scripts (no ${CLAUDE_PLUGIN_ROOT} expansion needed at user-scope). Re-run the same command after upgrading agentmemory to refresh paths. User entries in the same file are preserved; only previous agentmemory entries are replaced.

1. Install Docker Desktop for Windows

2. Start Docker Desktop and make sure the engine is running

3. Select Docker explicitly and run agentmemory:

$env:AGENTMEMORY_USE_DOCKER = "1" npx -y @agentmemory/agentmemory@latest


**Option C: standalone MCP only (no engine).** If you only need the MCP tools for your agent and don't need the REST API, viewer, or cron jobs, skip the engine entirely:
powershell npx -y @agentmemory/agentmemory@latest mcp

Terminal 2: seed sample data and see recall in action

npx -y @agentmemory/agentmemory@latest demo ```

demo seeds 3 realistic sessions (JWT auth, N+1 query fix, rate limiting) and runs searches against them. Keyless installs disable vectors, so the mem::search keyword queries should hit through BM25 while database performance optimization can return zero. smart-search may additionally return structural graph matches when graph data exists. To make the semantic query find the N+1 fix through vectors, set EMBEDDING_PROVIDER=local, restart, and allow the first model download to finish.

Open http://localhost:3113 to watch the memory build live.

Codex CLI (Codex plugin platform)

```bash

Full hooks/skills plugin from the GitHub subdir

copilot plugin install rohitg00/agentmemory:plugin


`agentmemory connect copilot-cli` merges `mcpServers.agentmemory` into `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set) and preserves existing servers. On native Windows this is the only automated `connect` adapter; configure every other native Windows agent manually. WSL `connect` is supported only when the target agent is installed in that same WSL environment. Copilot picks up the MCP server on next launch or after `/mcp`. Install the plugin as well when you want the full hook/skill experience.

<details>
<summary><b>OpenClaw (paste this prompt)</b></summary>
text Install agentmemory for OpenClaw. Run npx -y @agentmemory/agentmemory@latest in a separate terminal to start the memory server on localhost:3111. Then add this to my OpenClaw MCP config so agentmemory is available with all 54 memory tools:

{ "mcpServers": { "agentmemory": { "command": "npx", "args": ["-y", "@agentmemory/mcp"], "env": { "AGENTMEMORY_URL": "http://localhost:3111" } } } }

Restart OpenClaw. Verify with curl http://localhost:3111/agentmemory/health. Open http://localhost:3113 for the real-time viewer. For deeper memory-slot integration, copy integrations/openclaw to ~/.openclaw/extensions/agentmemory and enable plugins.slots.memory = "agentmemory" in ~/.openclaw/openclaw.json.


Full guide: [`integrations/openclaw/`](integrations/openclaw/)

</details>

<details>
<summary><b>Hermes Agent (paste this prompt)</b></summary>
text Install agentmemory for Hermes. Run npx -y @agentmemory/agentmemory@latest in a separate terminal to start the memory server on localhost:3111. Then add this to ~/.hermes/config.yaml so Hermes can use agentmemory as an MCP server with all 54 memory tools:

mcp_servers: agentmemory: command: npx args: ["-y", "@agentmemory/mcp"]

memory: provider: agentmemory

Verify with curl http://localhost:3111/agentmemory/health. Open http://localhost:3113 for the real-time viewer. For deeper 6-hook memory provider integration (pre-LLM context injection, turn capture, MEMORY.md mirroring, system prompt block), copy integrations/hermes from the agentmemory repo to ~/.hermes/plugins/agentmemory. ```

Full guide: integrations/hermes/

</details>

or via the shim package:

npx -y @agentmemory/mcp


**Diagnostics for Windows:** if `npx -y @agentmemory/agentmemory@latest` fails, re-run it with `--verbose` to see the actual engine stderr. Common failure modes:

| Symptom | Fix |
|---|---|
| `The engine process started but the REST API never responded.` | Confirm all four derived ports are free, verify the pinned `iii.exe` stayed alive, then re-run with `--verbose` and inspect the captured engine stderr |
| `Could not start iii-engine` | Neither `iii.exe` nor Docker is installed. See Option A or B above |
| Port conflict | `netstat -ano \| findstr :3111` to see what's bound, then kill it or use `--port <N>` |
| Docker fallback skipped even though Docker is installed | Make sure Docker Desktop is actually running (system tray icon) |

> Note: the iii **engine** is a prebuilt binary, not a cargo crate, so don't try to `cargo install` it. (The iii **SDKs** are published on crates.io, npm, and PyPI, but agentmemory doesn't need them.) Supported engine install methods are all pinned to v0.11.2: the prebuilt binary above, agentmemory's macOS/Linux auto-install path (`curl`, POSIX `sh`, and `tar` required), and the Docker image `iiidev/iii:0.11.2`. A bare upstream `install.sh | sh` installs the latest engine, which agentmemory does not support. Use `npx -y @agentmemory/agentmemory@latest`; on macOS/Linux it fetches the pinned engine into `~/.agentmemory/bin`.

---

<h2 id="deploy">Deploy</h2>

One-click templates for managed hosts. Each one ships a self-contained
Dockerfile that pulls `@agentmemory/agentmemory` from npm and copies
the iii engine binary in from the official `iiidev/iii` Docker Hub
image; no pre-built agentmemory image required. Persistent storage
mounts at `/data`; the first-boot entrypoint overwrites the
npm-bundled iii config (which binds `127.0.0.1`) with a deploy-tuned
one that binds `0.0.0.0` and uses absolute `/data` paths, generates
the HMAC secret, then drops privileges from `root` to `node` via
`gosu` before exec'ing the agentmemory CLI.

<p>
  <a href="https://fly.io/launch?repo=https://github.com/rohitg00/agentmemory&path=deploy/fly"><img src="https://img.shields.io/badge/Deploy%20to-fly.io-8b5cf6?style=for-the-badge&logo=fly.io&logoColor=white" alt="Deploy to fly.io" /></a>
  <a href="https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Frohitg00%2Fagentmemory&rootDirectory=deploy%2Frailway"><img src="https://img.shields.io/badge/Deploy%20to-Railway-0B0D0E?style=for-the-badge&logo=railway&logoColor=white" alt="Deploy to Railway" /></a>
</p>

Render's one-click deploy button requires `render.yaml` at the repository root, which we deliberately keep clean. Use the Render Blueprint flow documented in [`deploy/render/`](./deploy/render/README.md) to point at the in-repo blueprint manually.

Full setup details (HMAC capture, viewer SSH tunnel, rotation, backup,
cost floors) live in [`deploy/`](./deploy/README.md):

- [`deploy/fly`](./deploy/fly/README.md): single machine with
  `auto_stop_machines = "stop"`; cheapest idle.
- [`deploy/railway`](./deploy/railway/README.md): Hobby plan flat fee,
  volume in the dashboard.
- [`deploy/render`](./deploy/render/README.md): Blueprint flow,
  automatic disk snapshots on paid plans.
- [`deploy/coolify`](./deploy/coolify/README.md): self-hosted on your
  own VPS via [Coolify](https://coolify.io/self-hosted); same Docker
  Compose stack, you own the host and the data.

Only port `3111` is published. The viewer on `3113` stays bound to
loopback inside the container; every template's README documents the
SSH-tunnel pattern for reaching it.

---

<h2 id="why-agentmemory"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-why.svg"><img src="assets/tags/section-why.svg" alt="Why agentmemory" height="32" /></picture></h2>

Every coding agent forgets everything when the session ends, and each new session starts with you re-explaining your stack. agentmemory runs in the background and removes that step.
text Session 1: "Add auth to the API" Agent writes code, runs tests, fixes bugs agentmemory silently captures every tool use Session ends -> observations compressed into structured memory

Session 2: "Now add rate limiting" Agent already knows: - Auth uses JWT middleware in src/middleware/auth.ts - Tests in test/auth.test.ts cover token validation - You chose jose over jsonwebtoken for Edge compatibility Zero re-explaining. Starts working immediately. ```

Memory Pipeline

PostToolUse hook fires
  -> SHA-256 dedup (5min window)
  -> Privacy filter (strip secrets, API keys)
  -> Store raw observation
  -> Synthetic compression by default
     (LLM-written compression only with a provider + AGENTMEMORY_AUTO_COMPRESS=true)
  -> Vector embedding when an embedding provider is active
  -> Index in BM25, plus vectors when enabled

Stop / SessionEnd hook fires
  -> Summarize session
  -> Knowledge graph extraction (if GRAPH_EXTRACTION_ENABLED=true)
  -> Slot reflection (if SLOT_REFLECT_ENABLED=true)

SessionStart hook fires
  -> Load project profile (top concepts, files, patterns)
  -> Hybrid search (BM25 + vector + graph)
  -> Token budget (default: 2000 tokens)
  -> Inject into conversation

vs built-in agent memory

Every AI coding agent ships with built-in memory: Claude Code has MEMORY.md, Cursor has notepads, Cline has memory bank. These work like sticky notes. agentmemory is the searchable database behind the sticky notes.

Built-in (CLAUDE.md)agentmemory
Scale200-line capUnlimited
SearchLoads everything into contextBM25 + vector + graph (top-K only)
Token cost22K+ at 240 observations~1,900 tokens (92% less)
Cross-agentPer-agent filesMCP + REST (any agent)
CoordinationNoneLeases, signals, actions, routines
ObservabilityRead files manuallyReal-time viewer on :3113

---

How It Works

🇨🇳 中文文档镜像 AI 翻译 2026-05-23
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

agentmemory 是一个持久性记忆系统,用于 AI 编码代理。它基于 iii 引擎,提供了一个持久性记忆系统,用于 Claude Code、Cursor、Gemini CLI、Codex CLI、Hermes、OpenClaw、pi、OpenCode 等编码代理。

⚡ 功能介绍

agentmemory 的关键功能包括自动捕获、语义搜索、记忆演进、自动遗忘和隐私优先。它使用 BM25 + 向量 + 知识图谱融合语义搜索,支持版本控制、超级替代、关系图谱等功能。

📋 环境依赖

agentmemory 需要 OPENAI_EMBEDDING_DIMENSIONS=1536 环境变量,用于设置嵌入维度。

🛠 安装步骤(Docker/pip/源码)

安装 agentmemory 可以使用 npm install -g @agentmemory/agentmemory 或 npx @agentmemory/agentmemory。也可以使用 Docker 或 pip 安装。

⚙️ 配置说明(含 MCP / env)

agentmemory 的配置文件位于 ~/.agentmemory/.env 中。可以在这个文件中设置 Anthropic Base URL、Anthropic API Key 等环境变量。

🔌 API 说明

agentmemory 提供了 Codex CLI API,用于与 Codex CLI 进行交互。可以使用 ANTHROPIC_API_KEY 和 GEMINI_API_KEY 等环境变量来配置 API。

🔄 工作流/模块

agentmemory 的工作流包括 PostToolUse 钩子、SHA-256 去重、隐私过滤器、存储原始观察、LLM 压缩、结构化事实和概念、向量嵌入等。

🎯 aiskill88 AI 点评 A 级 2026-05-20

工程化程度高,解决AI agent的核心痛点——记忆能力。13.6k星证明社区认可度强,TypeScript实现保证代码质量,持续维护值得信赖。

📚 实用指南(长尾问题)
适合谁
  • 使用 Cursor 编辑器、希望提升 AI 编程效率的开发者
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
  • Cursor rules 控制在 80 行内,否则模型上下文成本会显著上升
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型
部署方案
  • Docker:agentmemory 提供官方镜像,docker compose up 一键启动
  • CLI:直接 npm install -g / pip install,命令行调用
  • 本地部署:CPU 8GB 起,GPU 推荐 16GB+ 显存
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台

⚡ 核心功能

  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
👥 适合谁
  • 使用 Cursor 编辑器、希望提升 AI 编程效率的开发者
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +GitHub 13.6k Star,社区高度认可
  • +Apache-2.0 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。

❓ 常见问题 FAQ

主要支持Claude及其他主流LLM,可扩展集成其他模型。
💡 AI Skill Hub 点评

总体来看,AI编码助手持久化记忆系统 是一款质量优秀的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。

📚 深入学习 AI编码助手持久化记忆系统
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 agentmemory
原始描述 开源AI工作流:#1 Persistent memory for AI coding agents based on real-world benchmarks。⭐13.6k · TypeScript
Topics 智能体记忆AI工作流编码助手Claude持久化存储
GitHub https://github.com/rohitg00/agentmemory
License Apache-2.0
语言 TypeScript
🔗 原始来源
🐙 GitHub 仓库  https://github.com/rohitg00/agentmemory 🌐 官方网站  https://agent-memory.dev

收录时间:2026-05-19 · 更新时间:2026-05-30 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。