AgentBrain Handoffs

io.github.willykeenan由 GitHub 账号 willykeenan 发布v0.1.0更新于 Oct 25, 2026

Exact, durable handoffs between AI coding agents: one turn in the right session, never twice.

发布方自己的服务:BrainDog

已验证STDIO仅桌面效率与工作流开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让编码代理向其他已注册的代理会话发送并接收持久、恰好一次的任务交接。

可以做什么
向已注册代理发送交接消息和带标题的工作契约,可设截止时间与幂等键,并读取发给当前代理身份的收件箱。接受工作、返回结果或阻塞原因,并以接受、修改或阻塞关闭工作。查看投递状态,释放卡住的投递以腾出接收方。配合可选的 ContextLib 插件,可将项目决策、事实和经验以 Markdown 记录、检索、取代和导出。
适用场景
适用于多个 AI 编码代理组成团队协作、需要消息准确送达正确会话且只送一次、在对方忙碌时等待、并在限定次数内重试而不丢失或重复的场景。MCP 服务器只写入收件箱,实际投递由单独的引擎进程完成。
运行要求
需要本地 Python 3.9+ 包(仅用标准库)提供 handoffs 命令,或使用已发布的 Docker 镜像。每个会话以 --agent 固定代理身份启动自己的服务器,所有进程须通过 --db 或 HANDOFFS_DB 共用同一数据库。投递引擎(handoffs serve 或 handoffs run)须运行在代理所在机器上。Codex 与 Claude Code 适配器为实验性。
安装前请注意
该服务器会写入共享的交接数据库,并可能在其他代理会话中触发新的回合,因此应谨慎注册代理并设置允许或阻止的连接。实时页面的发送接口需要存放在数据库旁的令牌文件。公开演示标志会在所有网络接口上暴露页面,但仅限模拟代理。实验性适配器行为可能不稳定。

安装

在 SourceWeft 中

  1. 打开 控制台中的 AgentBrain Handoffs,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

AgentBrain Handoffs

Exact, durable handoffs between AI coding agents. Each handoff is one new turn in the recipient's existing session.

[The live status page during handoffs demo: four agents handing work to each other, with in-flight, needs-attention and delivery-time panels]

Real screenshot of the demo; the data in it is invented sample data.

pip install .handoffs demo

Open the URL it prints (http://127.0.0.1:8765/). Four simulated agents hand work to each other. Ctrl+C stops and deletes the demo data.

Why this exists

A team of coding agents already has sessions, inboxes and tools. What it lacks is delivery: a message that reaches the right session, waits if that agent is busy, is sent once, and is retried within a bound when the provider drops it.

Without that, handoffs get lost, delivered twice, or pasted into a session that is already in the middle of a turn. AgentBrain Handoffs is the delivery layer. It is a local Python package (Python 3.9+, standard library only) with a command handoffs, a live page, and an MCP server.

60-second quickstart

From a clone of this repository:

bash
python3 -m venv .venv.venv/bin/pip install ..venv/bin/handoffs demo

Or, once the package is on PyPI:

bash
pipx run agentbrain-handoffs demo

You should see:

AgentBrain Handoffs demo  Open http://127.0.0.1:8765/  Four simulated agents (Planner, Engineer, Reviewer, Writer) hand work to each other.  Nothing real is contacted. The demo data is temporary and deleted when you stop (Ctrl+C).

The page updates every few seconds. Handoffs move through Accepted → Working → Finished. Work is returned and closed on its own. --speed 4 makes the simulated turns finish faster.

To keep the demo on another port: handoffs demo --port 9876.

A longer walkthrough, including your own agents, is in docs/QUICKSTART.md.

Concepts

A handoff is a message addressed to one registered agent. The delivery engine turns it into exactly one new turn for that agent, at the session it had when the handoff was enrolled.

A work contract is a handoff with a title. The recipient returns a result (or a blocker); the sender closes it as accepted, revision, or blocked. A due time is optional; if it passes, the sender gets one non-waking reminder.

Delivery states, in plain words:

StateMeaning
WAITINGQueued. Next engine pass will try to send it. A provider outage stays here too: the detail explains the hold and no attempt is used.
BUSYThe recipient is in the middle of a turn. This waits.
HELDBlocked on purpose: the connection is blocked or delivery is paused. No attempt used.
UNAVAILABLEThe agent or its session is gone. Nothing is redirected.
OWNER_REJECTEDThe session refused the write. One retry is allowed.
SENDINGThe write is in flight.
UNCERTAINThe write may have landed; the reply was lost, or an accepted turn could not be observed for 10 minutes. Observed, never resent.
ACCEPTEDThe recipient's session took the turn.
RUNNINGThe turn is in progress.
RETURNEDThe turn finished.
FAILEDThe turn failed or was interrupted, or the session refused it twice (then it was never delivered).
ACKNOWLEDGEDThe recipient read the message; no separate turn is needed.
CANCELLEDProven absent after enough history scans, or released by a person with handoffs release. Not resent.
DUPLICATEIdentical to a handoff still in progress.

Guarantees

  1. Exact recipient. A handoff is delivered only to the agent it was addressed to, at the endpoint it had when enrolled.
  2. One write per attempt. The attempt is reserved before sending. A lost reply goes to UNCERTAIN and is reconciled by observation. A refused write is retried once; a second refusal ends the delivery as FAILED, so it never holds the recipient.
  3. Never interrupt. A busy recipient keeps its turn. A second handoff to the same agent waits as BUSY.
  4. Bounded resend. An errored turn is resent up to twice; an interrupted turn once, after ten minutes, and only while the work is still open. Each resend has a new request id.
  5. Honest release. An UNCERTAIN delivery that three complete history scans over an hour prove was never received is CANCELLED. An accepted turn nobody can observe for 10 minutes becomes UNCERTAIN, so the same rule applies. When you know how a stuck delivery ended, handoffs release ID cancels it; nothing is resent either way.
  6. Outages hold. A provider status-page guard can hold delivery without spending an attempt.
  7. Deadlines. Work past its due time alerts the sender once, as a non-waking notification.

Adapters

ProviderStatusWhat it talks to
demoStableSimulated agents. Used by handoffs demo.
commandStableAn argv (no shell) or an HTTP POST.
codexExperimentalcodex app-server JSON-RPC over stdio.
claude-codeExperimentalClaude Code headless (claude -p --resume).

See docs/ADAPTERS.md for settings, examples and the experimental caveats.

MCP

Each agent session launches its own MCP server. The identity is fixed at start, so a tool call cannot act as another agent.

Claude Code

bash
claude mcp add handoffs -- handoffs mcp --agent me

Replace me with the agent id you registered (handoffs agent add me --provider claude-code ...).

Codex (~/.codex/config.toml)

toml
[mcp_servers.handoffs]command = "handoffs"args = ["mcp", "--agent", "me"]

Cursor (MCP servers in Cursor settings)

json
{  "mcpServers": {    "handoffs": {      "command": "handoffs",      "args": ["mcp", "--agent", "me"]    }  }}

Point every process at the same database with --db or HANDOFFS_DB. The engine (handoffs serve or handoffs run) is what actually delivers; the MCP server only writes to the inbox. Details: docs/MCP.md.

Project memory: the ContextLib plugin

ContextLib keeps a project's decisions, facts and lessons as plain Markdown files. Install it and point the same server at a library, and each agent gets the context_* tools (brief, search, get, record, supersede, review, capture, export, import, status) next to its handoff tools:

bash
pip install "git+https://github.com/willykeenan/agentbrain-contextlib"claude mcp add handoffs -- handoffs mcp --agent me --context-library "/Volumes/SSD/ContextLib"

$CONTEXTLIB_ROOT works in place of the flag. The plugin runs as the server's fixed agent id, so an agent's records are authored by exactly the agent that sent its handoffs. Without a library, the server offers handoff tools only.

CLI

handoffs inithandoffs agent add planner --provider demohandoffs agent add builder --provider demo --name Builderhandoffs send planner builder "Add a health check" --title "Health check" --due-minutes 30handoffs serve                          # engine + live page on http://127.0.0.1:8765/handoffs inbox builderhandoffs read ID --as builderhandoffs return ID --as builder --summary "Health check is green"handoffs close ID --as planner acceptedhandoffs status --jsonhandoffs tick                           # one delivery pass (Codex and Claude Code turns wait for run or serve)handoffs release ID                     # stop tracking a stuck delivery; never resenthandoffs run                            # engine onlyhandoffs mcp --agent builder            # stdio MCP server

--db PATH or HANDOFFS_DB selects the database (default ./.handoffs/handoffs.sqlite3). --json is accepted on the commands that print records. Usage errors exit 2.

CommandPurpose
initCreate the database.
agent add|list|removeRegister agents. --set KEY=VALUE is JSON when it parses.
allow / blockDirected connections.
config KEY VALUEenabled, enabledAfter, connections, outageGuard.
send FROM TO MESSAGEInbox message; --title makes it work. --key is idempotent.
inbox / read / accept / return / closeWork lifecycle. --as or HANDOFFS_AGENT.
status / tick / run / serve / mcp / demoInspect and deliver.
release IDCancel one stuck delivery (for example UNCERTAIN) so its recipient is free. Nothing is sent.

Security

The live page binds to loopback and refuses non-loopback Host headers (DNS-rebinding). POST /api/send needs the token in <db>.token (mode 0600). --public-demo exists only on handoffs demo (simulated agents, temporary data); that page cannot send and shows plain state sentences instead of adapter errors. MCP identity is the --agent you started with. Full model: docs/SECURITY-MODEL.md.

Roadmap

  • Keep the demo and command adapters stable.
  • Harden the Codex and Claude Code adapters as those app protocols settle.
  • More status-page presets for outageGuard.
  • Planned: Agent Rooms will use this delivery contract.

Run with Docker

The image is published at ghcr.io/willykeenan/agentbrain-handoffs for Apple silicon and Intel.

bash
docker run --rm -p 8765:8765 ghcr.io/willykeenan/agentbrain-handoffs demo --host 0.0.0.0 --public-demo   # the live democlaude mcp add handoffs -- docker run -i --rm -v ~/.handoffs:/data ghcr.io/willykeenan/agentbrain-handoffs mcp --agent me

The MCP server writes to the handoff database in ~/.handoffs; run the engine (handoffs serve) on the machine where your agents live so it can deliver.

License

Apache-2.0. Copyright KE Studios.

Source: github.com/willykeenan/agentbrain-handoffs. Live demo: huggingface.co/spaces/willykeenan/agentbrain-handoffs.

AgentBrain Handoffs is the open delivery layer for AgentBrain, the agent runtime coming to Agent Rooms (agentrooms.io).

来源:README.md,提交 e1c71ee

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 27, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Brain 集成