共享记忆AI代理协调系统

一个为多个AI代理提供共享持久记忆、通信层和协调系统的服务,适用于团队协作和任务管理场景。

  • by brendanlucas01
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 brendanlucas01/Agent-Mind-Bridge

使用说明

特工Mind Bridge

A. 模型上下文协议 为多个AI代理(Claude、Gemini、GPT或任何兼容MCP的模型)提供共享持久内存、通信层和协调系统的服务器。

代理可以在会话中读写相同的项目、线程、内存和技能。建立在 FastMCP 使用本地SQLite数据库。


它的作用

支柱 工具 说明
核心 17 项目、线程、条目、搜索——共享工作区
记忆 8 每个代理和项目的短期(会话状态)+长期(持久事实)
技能 11 个人代理程序+全球项目标准
协作 9 异步消息、状态、结构化切换、会话简报
Sprint董事会 13 敏捷任务跟踪、冲刺、看板、任务依赖、冲刺回顾
帮助 1 context_help --完整的工具索引和使用指南
总计 59

快速开始

# 1. Clone and install
git clone https://github.com/brendanlucas01/Agent-Mind-Bridge.git
cd Agent-Mind-Bridge
pip install -r requirements.txt

# 2. Configure (optional)
cp .env.example .env
# Edit .env to change ports or database path

# 3. Start everything
./start.sh

这将启动三项服务:

  • MCP服务器 — http://127.0.0.1:3333/mcp
  • REST API — http://127.0.0.1:8000
  • 仪表盘 — http://localhost:3000

要仅运行MCP服务器(无仪表板):

python server.py

看 安装.md 了解包括IDE集成在内的完整设置说明。


建筑

server.py          Entry point — starts FastMCP with streamable-http transport
app.py             FastMCP instance and lifespan (DB init)
db.py              All SQLite queries — no logic, pure data access
tools.py           All 59 MCP tool handlers — registered on the mcp instance
models.py          Pydantic input models and enums for all tools
api.py             FastAPI REST server — 12 read-only endpoints for the dashboard
dashboard/         Next.js web dashboard — sprint board, activity stream, handoffs
start.sh           Single command to launch MCP server + REST API + dashboard

数据库: 带WAL模式的SQLite。单个文件(shared_context.db).FTS5对条目、主题、技能和长期记忆进行全文搜索。

运输: 流式HTTP(非stdio)。多客户端使用时需要。


连接代理

克劳德代码(CLI)

claude mcp add --transport http shared-context http://127.0.0.1:3333/mcp

重新启动克劳德代码。跑 /mcp 验证服务器是否显示59个工具。

光标

配置文件: ~/.cursor/mcp.json

{
  "mcpServers": {
    "shared-context": {
      "url": "http://127.0.0.1:3333/mcp"
    }
  }
}

风浪/反重力

配置文件: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "shared-context": {
      "serverUrl": "http://127.0.0.1:3333/mcp"
    }
  }
}

注意:Windsurf和Antigravity共享相同的MCP配置格式。 serverUrl 是正确的钥匙吗-- url 不会工作。

Cline/ROO/Kilo代码

配置文件:可通过VS Code中的扩展MCP设置面板访问。

{
  "mcpServers": {
    "shared-context": {
      "type": "streamableHttp",
      "url": "http://127.0.0.1:3333/mcp",
      "disabled": false,
      "timeout": 60
    }
  }
}

看 安装.md 了解每个IDE的分步连接说明。


推荐的代理会话流

每个代理在每次会话中都应该遵循以下模式:

1. context_session_start    → full briefing in one call
2. context_presence_update  → set status to 'working'
3. ... do your work ...
4. context_memory_promote   → save important learnings
5. context_memory_clear_short → clean up session state
6. context_handoff_post     → brief the next agent
7. context_presence_update  → set status to 'idle'

多代理示例

Agent A (Claude Code) and Agent B (Gemini) collaborating:

1. Both agents call context_session_start to orient themselves
2. Agent A creates a project and thread, posts a proposal
3. Agent B reads the thread, posts feedback
4. Agent A posts a decision, pins it
5. Agent A posts a handoff and goes idle
6. Agent B acknowledges the handoff and continues the work

像人类团队一样思考

理解59个共享上下文工具的最简单方法是将人工智能代理视为在实体公司办公室工作的人类员工。以下是这些概念如何映射到现实世界:

  • 项目和线程:把这些想象成文件柜和活动桌面文件夹,或者Slack频道和电子邮件链。
  • 任务和精神:团队的看板板,每个人都在那里接任务并跟踪阻断者。
  • 短期记忆:你显示器上的一张便签。它准确地跟踪你在做什么 马上,任务完成后扔掉。
  • 长时程记忆:记录持久事实、项目偏好和长期知识的官方公司维基。
  • 技能:确保任务一致性的标准操作程序(SOP)或个人检查表。
  • 坐席状态:您的活动Slack状态和直接消息,用于轻拍同事的肩膀以解除阻止。
  • 交接:下班交接单留在同事的桌子上,所以下一班正好从你离开的地方接过来。

通过采用这种思维方式,复杂的多代理工作流变得与标准的办公室协作一样直观。


配置

所有配置均通过 .env (复制自 .env.example):

变量 默认值 描述
HOST 127.0.0.1 MCP服务器绑定主机
PORT 3333 MCP服务器端口
DB_PATH shared_context.db SQLite数据库路径
API_HOST 127.0.0.1 REST API绑定主机
API_PORT 8000 REST API端口
NEXT_PUBLIC_API_URL http://localhost:8000 仪表板→ REST API URL

许可证

GPLv3--参见 许可证 了解详情。