Skip to main content

让你的 AI 真正记住你 — 基于 MCP 协议的跨应用持久化记忆系统

Project description

Adaptive Agent MCP

让你的 AI 真正"记住"你

"我已经告诉 Claude 我喜欢 TypeScript 100遍了,为什么它还在给我写 JavaScript?"

"上周 Cursor 帮我实现的组件架构,今天怎么又从头问我?"

这就是 Adaptive Agent MCP 要解决的问题。

一个基于 MCP 协议的跨应用持久化记忆系统。无论你用 Claude Code、Cursor、Antigravity 还是其他任何支持 MCP 的工具——你的偏好、项目上下文、知识积累,都将永久记住、随时调用、跨平台共享

一次教会,终生受用。不再重复,不再遗忘。

License: MIT Python 3.10+ MCP


它是如何工作的?

在 Claude Code 中: "记住,我喜欢使用 TypeScript"
在 Antigravity 中: "我的编程偏好是什么?"
AI: "你喜欢使用 TypeScript"

在任何支持 MCP 的应用中都可快速接入,真正实现 AI 记忆的跨平台无缝流转


记忆不会混乱吗?——Scope 作用域机制

"如果所有项目共享记忆,那项目 A 的偏好会不会污染项目 B?"

不会。 我们设计了 Scope(作用域) 机制来精确控制记忆的边界:

作用域类型 适用场景 示例
global 通用偏好,所有项目都适用 "我喜欢 TypeScript"
project:xxx 项目专属规范,只在该项目生效 "这个项目用 vanilla CSS"

实际使用示例

你: "在这个项目中,我们使用 vanilla CSS 而不是 Tailwind"
AI: 收到!我已将这个偏好保存到 project:landing-page 作用域

你: (切换到另一个项目) "我的 CSS 偏好是什么?"
AI: 你通常喜欢 Tailwind CSS(全局偏好)

查询时的智能过滤

  • 项目 A 中查询 → 返回 全局知识 + 项目A专属知识
  • 项目 B 中查询 → 返回 全局知识 + 项目B专属知识(项目A的不会出现)

结论: 既享受跨平台共享全局偏好的便利,又保证项目级配置的隔离。


快速开始

快速安装

VS Code / Cherry studio / Antigravity / Claude Code / 等任何支持 MCP 的 AI 应用

配置 mcp.json:

{
  "mcpServers": {
    "adaptive-agent-mcp": {
      "command": "uvx",
      "args": ["adaptive-agent-mcp"]
    }
  }
}
Claude Code
claude mcp add adaptive-memory \
  --type stdio \
  --command uvx \
  --args "adaptive-agent-mcp"

不指定 --storage-path 时,使用默认路径 ~/.adaptive-agent/memory,所有应用共享同一份记忆。


项目结构

.
├── docs/                        # 完整文档
├── adaptive_agent_mcp/          # 主项目目录
│   ├── server.py                # MCP 服务器入口
│   ├── src/                     # 源代码
│   │   ├── config.py            # 配置管理
│   │   ├── storage.py           # 存储层
│   │   ├── indexer.py           # 索引系统
│   │   ├── search_engine.py     # 搜索引擎
│   │   └── tools/               # MCP 工具
│   └── README.md                # 项目详细文档
├── smoke_test.py                # 烟雾测试
└── verify_full.py               # 完整功能测试

特性

特性 说明
跨应用记忆互通 多个 AI 应用共享同一份记忆
Scope 作用域隔离 全局偏好 vs 项目专属配置,互不干扰
三层记忆架构 知识图谱 + 每日笔记 + 隐性知识
高效检索 基于 JSON 索引的 O(1) 查询,支持 ripgrep 全文搜索
时间权威 MCP 是唯一时间来源,防止 Agent 时间幻觉
知识演化 支持事实版本管理和 supersede 机制
自动初始化 首次运行自动创建目录结构

建议安装:ripgrep

全文搜索功能依赖 ripgrep,如需使用 search_memory_content 工具请安装:

安装方法

Windows (推荐):

winget install BurntSushi.ripgrep.MSVC

macOS:

brew install ripgrep

Linux:

# Ubuntu/Debian
sudo apt install ripgrep

# Arch
sudo pacman -S ripgrep

手动配置环境变量 (如自动检测失败):

# Windows: 将 rg.exe 所在目录添加到 PATH
# 或设置环境变量
ADAPTIVE_AGENT_RIPGREP_PATH=C:\path\to\rg.exe

MCP 工具

工具 功能
initialize_session 会话初始化,每次对话必须首先调用
query_memory_headers 索引扫描,快速查找记忆位置
read_memory_content 读取指定文件的完整内容
search_memory_content 基于 ripgrep 的全文搜索
append_daily_log 写入每日笔记或知识图谱
query_knowledge 查询知识库中的已保存知识
get_period_context 聚合周/月日志用于总结
archive_period 保存周期总结

文档


开发安装
git clone https://github.com/justforever17/adaptive-agent-mcp.git
cd adaptive-agent-mcp

# 安装依赖
pip install -e .

# 可选:安装 ripgrep 以启用全文搜索
# Windows: choco install ripgrep
# macOS: brew install ripgrep
项目级记忆隔离 (可选)

如果希望每个项目使用独立的记忆,可以指定 --storage-path:

{
  "mcpServers": {
    "adaptive-agent-mcp": {
      "command": "uvx",
      "args": [
        "adaptive-agent-mcp",
        "--storage-path",
        "${workspaceFolder}/.agent_memory"
      ]
    }
  }
}

贡献

欢迎提交 Issue 和 Pull Request。


许可证

MIT License - 详见 LICENSE


致谢


💖 赞助 (Sponsorship)

维护开源项目不易,如果您觉得 adaptive-agent-mcp 对您有帮助,欢迎请作者喝杯咖啡!

平台 链接 支付方式
爱发电 (Afdian) Afdian 微信, 支付宝

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adaptive_agent_mcp-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adaptive_agent_mcp-0.1.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_agent_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: adaptive_agent_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for adaptive_agent_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 176b57bc4c50a3d9c12f04849df9797e3c8f21fa80b5e5dc84f3750a66685611
MD5 45a877e43f6cc74de04e1092fcf43c2c
BLAKE2b-256 f5bdfba9ef48fa6293a9a5e80df55017fabc89936c316af2e29274c3b2c10f7c

See more details on using hashes here.

File details

Details for the file adaptive_agent_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptive_agent_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5ec918641f94b49061e06b784931d5180cc13e5e57bcfd4bca2cff094e62ae0
MD5 c1f131eef39b6c086dcd230b02c6f1aa
BLAKE2b-256 b8f8dfd1a8d91b46181e5ae773a35faaf18ef9015c5c233bc87630dc684c1a0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page