Agent Memory (Project Cortex)
赋予 AI Agent 长期记忆与自我进化能力
一个基于 Go 实现的轻量级、高性能知识库中间件。支持 LLM 触发入库、智能语义更新与 MCP 协议。
Agenten stärken
Installation vom Herausgeber. Kein PlugMCP-Endpunkt.
Host a copy with our keys and logs.
Noch kein paketiertes Release in der Registry. Folgen Sie der README des Repositorys.
Remote-URL oder ein Befehl auf Ihrem Rechner? Worin sich die beiden Installationen unterscheiden
Auf PlugMCP ausführen
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
StartenVom Herausgeber
赋予 AI Agent 长期记忆与自我进化能力
一个基于 Go 实现的轻量级、高性能知识库中间件。支持 LLM 触发入库、智能语义更新与 MCP 协议。
High-performance, pure Go memory middleware for AI Agents (Claude/Cursor). Features active file watching, auto-distillation via LLM, and 'Single Source of Truth' versioning. Native MCP support.
mem.ingest_memorygraph LR
User["LLM / Client"] --> Ingester["Ingest Pipeline"]
subgraph CoreLogic ["Core Logic"]
Ingester --> Summarize["Summarize"]
Summarize --> Tag["Extract Tags"]
Tag --> Chunk["Chunk"]
Chunk --> Embed["Vectorize"]
Embed --> Arbiter["LLM Arbitrate"]
end
Arbiter --> DB[("PostgreSQL + pgvector")]
User["Claude / Cursor"] -- MCP Protocol --> Server["MCP Server"]
Server --> DB
# 启动 PostgreSQL (带 pgvector 扩展)
docker-compose up -d
cp .env.example .env
vim .env
DASHSCOPE_API_KEY=sk-xxxxxxxxxxxx
DATABASE_URL=postgresql://cortex:cortex_password_secure@localhost:5440/cortex_knowledge
AGENT_MEM_HTTP_TOKEN=your-strong-token
AGENT_MEM_OWNER_ID=personal
# 编译
cd mcp-go && go build -o ../agent-mem ./cmd/agent-mem-mcp && cd ..
# HTTP 模式
./agent-mem --transport http --host 127.0.0.1 --port 8787
# STDIO 模式(MCP 客户端)
./agent-mem --transport stdio
# 重置数据库(首次或升级时)
./agent-mem --reset-db --reset-only
一键安装到 PATH(默认 /usr/local/bin):
./bin/agent-mem-install
安装后可直接使用:
agent-mem # 启动 MCP 服务(前台)
agent-mem-reset-db # 清空并重建数据库
agent-mem-status # 查看端口状态
agent-mem-stop # 停止服务
POST /ingest/memory - 写入记忆GET /memories/search - 语义检索GET /memories - 获取全文GET /memories/timeline - 时间线GET /projects - 项目列表/sse - SSE 传输(MCP)/mcp - Streamable HTTP(MCP)新内容入库
│
▼
┌──────────────────┐
│ 向量相似度筛选 │ ── 找出语义相似的已有知识
└────────┬─────────┘
│ similarity > 0.85
▼
┌──────────────────┐
│ LLM 智能仲裁 │ ── 比较新旧摘要,判断关系
└────────┬─────────┘
│
┌────┼────┬────┐
▼ ▼ ▼ ▼
REPLACE KEEP SKIP
(替换) _BOTH (跳过)
(保留)
系统启动时会自动执行迁移脚本:
avg_embedding 字段summary、tags 字段(如缺失)注意:旧数据(无 avg_embedding)不会参与冲突检测,建议:
--reset-db --reset-only 重建数据库(推荐,数据量小时)./agent-mem --reset-db --reset-only
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"agent-mem": {
"command": "/absolute/path/to/agent-mem",
"args": ["--transport", "stdio"]
}
}
}
如果设置了 AGENT_MEM_HTTP_TOKEN,HTTP/SSE/MCP 请求必须携带令牌:
Authorization: Bearer <token>X-Agent-Mem-Token: <token>/sse?token=<token>、/mcp?token=<token>、/memories/search?token=<token>~/.codex/config.toml)[mcp_servers.agent-mem]
url = "http://127.0.0.1:8787/sse"
~/.gemini/config.yaml)mcpServers:
agent-mem:
url: http://127.0.0.1:8787/sse
如启用 token,把 url 改为:http://127.0.0.1:8787/sse?token=<token>。
http://127.0.0.1:8787/sse详见 docs/LLM_PROMPTS.md,包含:
config/settings.yaml:
versioning:
semantic_similarity_threshold: 0.85 # 触发仲裁的相似度阈值
embedding:
provider: qwen
model: text-embedding-v4
dimension: 1536
chunking:
chunk_size: 500
overlap: 50
# 运行单元测试
cd mcp-go/cmd/agent-mem-mcp && go test -v
# 运行 E2E 测试
python scripts/e2e_test_go.py
# 集成测试(需要数据库和 API Key)
AGENT_MEM_INTEGRATION=1 go test -v
MIT
High-performance, pure Go memory middleware for AI Agents (Claude/Cursor). Features active file watching, auto-distillation via LLM, and 'Single Source of Truth' versioning. Native MCP support.
Tools
Noch keine Tool-Liste. Remote-Server erhalten eine nach dem ersten Health-Check.
FAQ
Kopieren Sie auf dieser Seite die stdio-Konfiguration für Cursor, Claude Desktop, Claude Code oder VS Code. Sie nutzt die Installation des Herausgebers, keinen PlugMCP-Proxy.
In diesem Eintrag ist keine erforderliche Umgebungsvariable aufgeführt.
Agent Mem läuft lokal über stdio.
Zuletzt geprüft: 2026-10-28. High-performance, pure Go memory middleware for AI Agents (Claude/Cursor). Features active file watching, auto-distillation via LLM, and 'Single Source of Truth' versioning. Native MCP support.