Skip to main content

Local-first MCP tools: workflow routing/spec + keyword memory (JSON) with optional toggles.

Project description

agent-supervisor-memory (MCP server)

本目录提供一个 单进程 的 Python MCP server(stdio),默认启用:

  • workflow_*: 生成最小化 spec(lite/spike/heavy)+ 路由建议(模型/effort)
  • memory_*: 个人记忆(JSON 存储,关键词+tags+key 命名空间检索;无向量数据库/无 embedding)

MCP server ID:agent-supervisor-memory(见 mcp-tools/agent-supervisor-memory/src/agent_supervisor_memory/server.py)。

Quickstart

cd mcp-tools/agent-supervisor-memory
poetry install
poetry run agent-supervisor-memory

默认存储文件:

  • Memory:优先使用“最近的祖先目录中已存在的 .codex/”下的 .codex/memory.json;若不存在,则用 <cwd>/.codex/memory.json
  • Policy:同理,默认 .codex/agent-policy.json

说明:Poetry 会统一管理虚拟环境与依赖,避免你本机 shell 的 python/pip alias 干扰。

如何引用(MCP client 注册)

不同 MCP client 的配置方式不同,但核心信息通常是:

  • command: uvx
  • args: ["agent-supervisor-memory", "...flags"]

工具名引用方式是 tool name,例如:memory_searchworkflow_route

参考配置片段(TOML 风格)

如果你的 client 支持类似下面这种配置(你贴的 exa 例子就是这种风格),可以这样写:

[mcp_servers.supervisor_memory]
command = "uvx"
args = ["agent-supervisor-memory"]

说明:

  • [mcp_servers.supervisor_memory] 里的 supervisor_memoryclient 侧别名,你可以随便取(只要不跟别的 server 重名)。
  • 是否“唯一”由你的 client 配置决定;PyPI 包名的唯一性是另一层(发布时)。

常用开关

[mcp_servers.supervisor_memory]
command = "uvx"
args = ["agent-supervisor-memory", "--global-memory", "--global-policy"]

关闭某些能力(默认都是启用):

[mcp_servers.supervisor_memory]
command = "uvx"
args = ["agent-supervisor-memory", "--no-memory", "--no-subagents", "--no-policy"]

高级覆盖(一般不需要)

为兼容少数 client 场景,仍保留路径覆盖参数(优先级最高;不建议作为默认配置):

agent-supervisor-memory --memory-path /abs/path/to/memory.json --policy-path /abs/path/to/agent-policy.json

每次 tool 调用也可传:

  • options.enable_memory: true|false
  • options.enable_subagents: true|false

模型与模式(跨模型路由)

本 server 不直接调用模型;它只提供“建议路由”,由你的 Supervisor/Client 负责真正使用什么模型去执行。

  • policy_get: 读取策略文件
  • workflow_route: 根据任务文本 + mode/effort/auto 给出建议的 supervisor_model/coder_model/effort

默认配置:

  • Supervisor:codex-5.2
  • Coder:codex-5.1-codex-max
  • saving:默认 effort=medium
  • efficient:默认 effort=medium

如何确认正在使用(VSCode/其他 client)

  • 调用 capabilities_get,查看返回里的 memory.mode / policy.modeproject|global|disabled)以及落盘 path
  • 写入/检索验证:memory_put 写入一条,然后 memory_search 搜索关键字。

VSCode:自动“主/子模型”分工(推荐)

如果你同时启用了:

  • mcp__supervisor_memory__*(本 server 的 tools)
  • mcp__codex__codex / mcp__codex__codex-reply(Codex MCP)

那么可以在一个 Supervisor 会话里自动启动 Coder 子会话,并显式指定 coder 使用 model=codex-5.1-codex-max(或按策略自动选择):

  1. 生成最小 spec(供 coder 执行):
  • 调用 mcp__supervisor_memory__workflow_ensure_spec(输入你的任务文本)
  1. 获取路由建议(选择 coder 模型与 effort):
  • 调用 mcp__supervisor_memory__workflow_routetask_text 传上一步的 spec)
  1. 启动 coder 子会话并执行:
  • 调用 mcp__codex__codex,并设置:
    • cwd: 项目根目录
    • model: 上一步返回的 coder_model
    • prompt: spec + 约束(例如:只做必要改动、不要跑 build gate、先做最小校验)
  1. 迭代直至完成:
  • mcp__codex__codex-replyconversationId 为上一步返回)继续

如果 mcp__codex__codex 超时/返回类型不兼容

部分环境下,Codex MCP tool 可能会遇到 tool-call 超时(例如 60s)或 “Unexpected response type”。 此时可以改用本 server 自带的 dispatch 工具:它会在本机启动 codex exec 作为后台任务,并通过轮询查询结果。

流程:

  1. 启动任务(立即返回 job_id):
  • 调用 codex_dispatch_startmodelworkflow_route 返回的 coder_modelcwd 为项目根目录;prompt 传 spec)
  1. 轮询结果:
  • 调用 codex_dispatch_status(job_id=...) 直到 meta.status 变为 completed|failed
  • 成功时 last_message 会包含 codex 的最终输出(同时 job_dir 下会保留 stdout.jsonl/stderr.log

Tools

  • capabilities_get
  • policy_get
  • memory_put
  • memory_search
  • memory_delete
  • memory_compact(生成 profile.json,把“杂乱记忆”压缩为分类摘要)
  • workflow_ensure_spec
  • workflow_route
  • subagents_echo(示例)
  • codex_dispatch_start(启动 codex exec 后台任务)
  • codex_dispatch_status(轮询任务状态/输出)

发布到 PyPI(维护者)

PyPI 不允许覆盖已发布的同版本号,所以每次发布前都需要 bump version。

cd mcp-tools/agent-supervisor-memory

# 1) bump version(示例:0.1.0 -> 0.1.1)
poetry version patch

# 2) build
poetry build

# 3) publish(推荐用 token)
poetry publish -u __token__ -p "$PYPI_TOKEN"

可选:发布到 TestPyPI(先验证安装/依赖/元数据):

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi -u __token__ -p "$TESTPYPI_TOKEN"

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

agent_supervisor_memory-0.1.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

agent_supervisor_memory-0.1.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_supervisor_memory-0.1.2.tar.gz.

File metadata

  • Download URL: agent_supervisor_memory-0.1.2.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Darwin/24.6.0

File hashes

Hashes for agent_supervisor_memory-0.1.2.tar.gz
Algorithm Hash digest
SHA256 79e5d1eb4fe9f8417bddb9de515b42faa9852a92288a079668e3c6e409a32342
MD5 6197212113e48177187ed7bd8ab623a6
BLAKE2b-256 f38cd2e1bc6156ffc5a3a1b08d43656ad290ce32a61a367fcbf944c93f3c9624

See more details on using hashes here.

File details

Details for the file agent_supervisor_memory-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_supervisor_memory-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a40221d859e82917191291f8b8e6eabc7cc21e04b8ec36716641937cb8deca50
MD5 5a51811c23b15ec625968b088cc8b904
BLAKE2b-256 38439ec50d9731084a273850a6e7b745cbcb509fbd295e275a186282fbe4de27

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