Skip to main content
Glama

agent-memory

面向编码代理的本地 Markdown 记忆——任何提供商、任何工具皆可用。

没有共享布局时,每个厂商都拥有一座坟墓——会话存档永远无法成为持久身份,除非你重新教导每一个新代理。完整理由(对比 RAG、对比保险库、对比厂商记忆)见 abi/WHY.md。参考实现路线图:ROADMAP.md。

你的记忆存放在你拥有的文件夹中:~/.agents/memory(身份 + 项目地图)和 <repo>/.agents/memory(按项目的工作内容)。你的 Agent——或任何读取 markdown 和可选 MCP 的主机——使用相同的布局。

Markdown 是事实来源。本仓库中的 Python MCP 是参考实现,而非专有后端。

ABI(稳定契约)

随 abi/ 发布——带版本号、有文档、与实现无关:

文档

内容

abi/README.md

概述 + 一致性

abi/WHY.md

为什么存在(对比 RAG、保险库、厂商坟墓)

ROADMAP.md

参考实现路线图(非 ABI)

abi/LAYOUT.md

文件夹分类法

abi/KINDS.md

事实存放位置

abi/MCP.md

工具契约

abi/INJECTION.md

AGENTS / CLAUDE 绑定

abi/PLATFORM.md

Windows、符号链接、每台机器的路径

abi/INSTALL.md

同步、注入、scan.json、--help-json

abi/INGEST.md

编目 / 提取 / 提炼流水线

安装会将 abi/LAYOUT.md 复制到 ~/.agents/memory/LAYOUT.md。注入和 CLI 标志:abi/INSTALL.md。机器可读:python -m agent_memory --help-json。

Related MCP server: RepoRecall

参考实现(本仓库)

Python 代码位于 src/agent_memory/(从克隆目录执行 pip install -e .)。

组件

作用

agent_memory.mcp_server

MCP:搜索 / 添加 / 注册 / 清单 / 同步 / 摄取

agent_memory.store

布局引擎、分类法、注入

python -m agent_memory sync

规范 ~/.agents/AGENTS.md、绑定的 CLAUDE.md、主机注入

python -m agent_memory inventory

磁盘 vs PROJECTS.md(跳过 .agents、.cursor)

python -m agent_memory ingest

聊天编目 + 提取流水线

skills/memory-sync/

代理安装技能

模板仅存在于 git 中:examples/*.example.*。实际存储:~/.agents/memory。如果 markdown 泄漏到本克隆中,请运行 python -m agent_memory consolidate。

编码代理: 安装请遵循 AGENTS.md。

布局(摘要)

路径

内容

~/.agents/memory/USER.md

始终在线的身份

~/.agents/memory/PROJECTS.md

slug / 路径 / 角色 / 技术栈 / 状态

~/.agents/memory/concepts/ …

跨领域的类型化记忆(首次写入时创建)

~/.agents/memory/projects/<slug>/

指向真实目录树的链接(非副本)

<repo>/.agents/memory/

仅在使用时才有文件——暂存收件箱,写入时转为类型化路径

~/.agents/AGENTS.md

简短注入;CLAUDE.md 绑定到它

搜索联合用户 + 所有已注册的项目目录树。聊天正文保留在产品文件夹中;chats-index.md 仅包含标题和路径。

安装

pip 和 MCP 使用相同的解释器:

python -m pip install -e .
python -m agent_memory sync --init
python -m agent_memory inventory

填写 ~/.agents/memory/USER.md 和 scan.json(首次运行时从 examples/*.example.* 生成)。MCP 合并后重新加载你的 Agent。

Windows 符号链接存根和硬链接回退方案见 abi/PLATFORM.md。

脚本

python -m agent_memory inventory
python -m agent_memory inventory --json
python -m agent_memory inventory --register SLUG "/path/to/repo" "role" "stack"
python -m agent_memory sync
python -m agent_memory --help-json
python -m agent_memory sync --help-json
python -m agent_memory inventory --help-json
python -m agent_memory ingest catalog

安装后,PATH 上的 agent-memory 与 python -m agent_memory 相同。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides portable memory for AI agents using plain Markdown files. Enables storing, recalling, and managing memories via MCP tools like recall, remember, forget, list, and get.
    3 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides persistent, local-first memory for coding agents with Markdown as the source of truth, exposed via CLI, loopback API, MCP, and Codex hooks for context retrieval and durable writes.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A local markdown memory and cross-agent context engine for AI coding assistants. It provides an MCP server with tools to search, add, retrieve, and distill persistent memory across tools like Claude Code, Cursor, and Zed.
    165 PyPI
    5
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides persistent, shared memory for AI agents via MCP, enabling retrieval of relevant memories instead of loading entire context. Allows agents across projects, machines, and tools to share a single auditable, markdown-native brain.
    3
    AGPL 3.0