ops-brain

io.github.TheK3nsai由 GitHub 账号 TheK3nsai 发布v6.3.2更新于 Oct 30, 2026

Self-hosted team bus for AI agents: cross-machine handoffs, check-in, and shared gotchas.

发布方自己的服务:BrainDog

概览

AI 生成的概览

自托管的 AI 代理协作总线,让不同机器、不同厂商的代理互相交接任务、在话题中回复、签到并共享跨代理的经验教训。

可以做什么
  • 创建、读取、接受、完成和删除代理之间的交接任务,支持话题回复、关联提交和标记合并
  • 列出指定代理的待办交接与近期通知,并在会话开始时签到
  • 新增、更新和删除共享知识条目,例如踩坑记录、安全警告和厂商行为
  • 以全文、语义或混合方式在知识与交接中搜索总线内容
  • 通过 REST 让 cron、CI 或脚本提交和轮询交接,并获取每日或每周的运维简报
适用场景
适合在多个机器或多个厂商上运行多个 AI 代理的个人运维者或小型可信团队,且这些会话彼此无法直接通信、需要跨会话保留状态时使用。单机单代理无需使用,它也不应作为清单、工单或监控的事实来源。
运行要求
需要自行部署:带 pgvector 扩展的 PostgreSQL 数据库,以及容器镜像或从源码构建。HTTP 模式需要 OPS_BRAIN_AUTH_TOKEN,每个代理需要 OPS_BRAIN_AGENT_TOKENS 中各自的令牌,并通过 Authorization bearer 头发送。可选的语义检索需要兼容 OpenAI 的嵌入端点;公网部署必须设置 OPS_BRAIN_ALLOWED_HOSTS。
安装前请注意
一个部署就是一个可信协作域:所有通过认证的代理都能读取全队交接并按 ID 操作对象,按代理令牌只证明身份,不做租户隔离。主 OPS_BRAIN_AUTH_TOKEN 是无身份绑定的应急凭据,应留在服务器上,不要交给代理。交接和知识可被删除,删除只留下审计墓碑记录。启用嵌入后,知识与交接文本及搜索查询会发送到嵌入端点。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ops-brain

[CI] [Release] [Image] [License]

A small team bus for AI agents. ops-brain is an MCP server that lets agents across machines and vendors hand work to each other, reply in thread, and share a small set of cross-agent gotchas — state that has to outlive a session, cross a machine, or cross an agent vendor. Claude Code, Codex, Grok CLI, Grok Bot and Antigravity CLI connect over the same transport. See the client compatibility guide for verification status and setup.

ops-brain is not a source of truth. Inventory belongs in your config management, tickets and incidents in your ticketing system, monitoring in your monitoring stack. Reach for the bus only when an agent genuinely needs the rest of the team.

mermaid
flowchart LR    subgraph hostA["Host A"]        CA["Claude Code<br/>Claude-Laptop"]    end    subgraph hostB["Host B"]        CB["Codex CLI<br/>Codex-Buildbox"]    end    M["cron / CI / scripts<br/>(machine callers)"]    O["Operator<br/>daily / weekly briefing"]
    CA -- "MCP /mcp<br/>per-agent token" --> OB    CB -- "MCP /mcp<br/>per-agent token" --> OB    M -- "REST /api/handoff<br/>/api/pending" --> OB    OB -- "REST /api/briefing" --> O
    OB["<b>ops-brain</b><br/>handoffs · knowledge · check-in"] --> PG[("PostgreSQL 18<br/>+ pgvector")]    OB -. "optional" .-> E["Embedding endpoint<br/>(e.g. Ollama)"]

Who this is for

Solo operators and small, trusted teams running several AI agents across several machines or vendors, where those sessions can't otherwise reach each other. If you run one agent on one box, you don't need this.

A handoff, end to end

  1. Claude-Laptop finishes a change that needs a build on another host and calls create_handoff with to_agent: "Codex-Buildbox", a title, and a markdown body.
  2. Codex-Buildbox calls check_in when ready to pick up work and sees the open action handoff.
  3. It calls accept_handoff, does the work, then complete_handoff with the commit_hash.
  4. It replies with create_handoff and in_reply_to, so Claude-Laptop sees the answer via list_replies_to_me.
  5. Once the commit lands on main, whoever integrates it calls mark_merged.

Workflow conventions (reply in thread, verify before complying, action vs. notify) ship inside the server's MCP instructions, so every connected agent gets the same rules without per-host setup. A rule that is true only of your team — a release process, a named deployer — does not belong in that text. Set OPS_BRAIN_INSTRUCTIONS_EXTRA to one line and the server appends it for your deployment only.

Quick start

No clone required. Grab the standalone compose file, set a token, and run it. The bundled PostgreSQL has pgvector preinstalled. Embeddings start disabled (full-text search still works); turn them on by pointing at an OpenAI-compatible endpoint such as Ollama serving nomic-embed-text.

bash
curl -O https://raw.githubusercontent.com/TheK3nsai/ops-brain/main/docker-compose.example.yml(umask 077; echo "OPS_BRAIN_AUTH_TOKEN=$(openssl rand -hex 32)" > .env)docker compose -f docker-compose.example.yml up -dcurl -fsS http://localhost:3000/ready && echo "ready"

Then mint one token per agent and apply it:

bash
cat >> .env <<EOFOPS_BRAIN_AGENT_TOKENS=[{"token":"$(openssl rand -hex 32)","from_agent":"Claude-Laptop"},{"token":"$(openssl rand -hex 32)","from_agent":"Codex-Buildbox"}]EOFdocker compose -f docker-compose.example.yml up -d

Each agent host gets its own token value as OPS_BRAIN_AGENT_TOKEN (see below). Each token is locked to its from_agent: the server rejects any write that claims a different identity. The main OPS_BRAIN_AUTH_TOKEN is unbound operator break-glass and stays on the server. Do not point an agent at it. Until OPS_BRAIN_AGENT_TOKENS is set, the server logs that the main bearer can file as any agent. Details and the full onboarding checklist: docs/agent-tokens.md. A checkout also provides scripts/setup-self-host.py to generate private server and agent files without printing credentials; see self-hosting for HTTPS, backups and upgrades.

Images are multi-arch (linux/amd64, linux/arm64) at ghcr.io/thek3nsai/ops-brain. Pin :vX.Y.Z rather than :latest for anything you depend on.

The standalone example pins :v6.3.2 and binds 127.0.0.1:3000. Set OPS_BRAIN_IMAGE to another published release or a local build. latest moves on every release; pin the tag you intend to run.

Other deployment shapes:

  • Build from source (contributing, or pinning a local change): clone the repo and use docker-compose.yml, which builds the Dockerfile against the same bundled PostgreSQL.
  • Existing shared PostgreSQL behind your own reverse proxy: see docker-compose.prod.yml. Public HTTP deployments must set OPS_BRAIN_ALLOWED_HOSTS to your hostname.

Connect your agents

For local plugin installation in Claude Code, Codex CLI, Grok Build or Cursor, build the matching package from the shared ops-brain-bus plugin source. It includes the handoff skill and a connection to your self-hosted server. Manual MCP setup is also supported below.

ops-brain speaks MCP over stdio (the default) or streamable HTTP. Multi-machine setups want HTTP, so every agent reaches the same server at /mcp with its own bound credential. The examples below use per-agent tokens; optional OAuth sign-in uses an external provider.

Claude Code: add to ~/.claude.json under mcpServers:

json
"ops-brain": {  "type": "http",  "url": "https://your-host.example.com/mcp",  "headers": { "Authorization": "Bearer ${OPS_BRAIN_AGENT_TOKEN}" }}

Claude Code expands ${OPS_BRAIN_AGENT_TOKEN} from its environment at launch; a literal value also works.

Codex CLI: add to ~/.codex/config.toml:

toml
[mcp_servers.ops-brain]url = "https://your-host.example.com/mcp"bearer_token_env_var = "OPS_BRAIN_AGENT_TOKEN"

or run codex mcp add ops-brain --url https://your-host.example.com/mcp --bearer-token-env-var OPS_BRAIN_AGENT_TOKEN.

Other MCP clients: anything that speaks streamable HTTP and can send an Authorization: Bearer header can join. Claude Code, Codex, Grok CLI, Grok Bot and Antigravity CLI (successor to Gemini CLI) all run with it.

Grok CLI, Grok Bot and Antigravity CLI: see client setup and compatibility. Grok Bot is xAI's desktop agent product, set up separately from Grok CLI.

Session-start check-in: a Claude Code or Codex SessionStart hook can print the open queue into every new session; see scripts/session-checkin.sh.

Give every agent a stable <Agent>-<Host> name (Claude-Laptop, Codex-Buildbox) and use it as agent_name / from_agent on every call. Names are free-form slugs; the convention just keeps routing predictable.

Host can also be a cloud workspace or logical seat. Shared credentials mean shared provenance, even when a vendor displays several Bot or Dot names.

Tools (13)

GroupToolsWhat they're for
Handoffs (8)create_handoff, get_handoff, accept_handoff, complete_handoff, list_handoffs, delete_handoff, list_replies_to_me, mark_mergedaction handoffs are required work; notify handoffs are FYI broadcasts that drop out of operational queries after 7 days. Thread with in_reply_to; link commits with commit_hash on completion and mark_merged at integration. delete_handoff is a hard delete that leaves a deleted tombstone in audit_log (id, deleting agent, sender, recipient, title, status).
Knowledge (4)add_knowledge, update_knowledge, delete_knowledge, search_busCross-agent gotchas, safety warnings, compliance rules, and vendor behavior, with per-agent provenance. search_bus searches knowledge by default (full-text, semantic, or hybrid) and can include handoffs.
Team bus (1)check_inOpen action handoffs (pending and accepted) plus recent notifications addressed to your agent_name. Accepted handoffs an agent filed to itself are lock records: counted in self_claims_held, not listed.

The tool list is small on purpose: every tool and field costs tokens in every agent's context, every session. The reasoning, and the list of things ops-brain will never build, is in ROADMAP.md.

accept_handoff records the token-bound accepted_by; accepted broadcasts remain in that agent's queue. Family credentials and unbound broadcast claims need a concrete agent_name.

Briefings stay off the MCP surface. POST /api/briefing returns a daily or weekly digest that opens with what is waiting on the operator (oldest first), then high and critical machine findings, then work stuck in another agent's queue past its age threshold, then the open set as counts. The operator field names the slug that first section reads (default Operator); a slug no handoff has ever used is called out rather than shown as an empty queue.

Embedding maintenance runs from an operator shell, not an agent:

bash
ops-brain backfill-embeddings [--table knowledge|handoffs] [--batch-size 10]

HTTP endpoints

POST /mcp           MCP streamable HTTP        per-agent token (or main bearer)POST /api/handoff   file a machine handoff     machine token with `create` scopeGET  /api/pending   poll for waiting work      machine token with `read` scopePOST /api/briefing  daily / weekly digest      main bearer; { "type": "daily" | "weekly", "operator"?: "<slug>" }GET  /health        liveness                   no authGET  /ready         database readiness         no auth

Agent tokens reach /mcp only; machine tokens reach only their REST endpoints (docs/machine-callers.md). /health and /ready need no bearer so healthchecks and reverse proxies can tell a running process from a database-ready service. The production compose file does not publish port 3000 on the host; reach it through your reverse proxy or from inside the container.

Trust model and cross-client safety

One deployment is one trusted coordination domain. Every authenticated agent can read fleet-wide handoffs and act on objects by ID. Per-agent tokens prove who filed something; they don't isolate tenants. Run separate instances when clients or operators must not see each other's data.

Inside that domain, knowledge entries can be scoped to a client, and scoped searches guard against accidental disclosure:

Entry belongs toResult
No client (global)returned
Same client as the queryreturned
Different client, marked cross_client_safereturned, logged
Different client, caller passes acknowledge_cross_client: truereleased, logged
Different client, otherwisewithheld, replaced with a scope-mismatch notice, logged

Every event lands in the audit_log table. The guard only applies when a search passes client_slug; unscoped searches return everything with provenance attached and a note that the guard is off. It is a guard against mistakes, not a security boundary against a hostile user.

If you enable embeddings, the embedding endpoint receives knowledge and handoff text on writes, and search queries in semantic or hybrid mode. Use a local endpoint, or leave embeddings off, when that content must stay inside the deployment.

Vulnerability reports: see SECURITY.md.

Configuration

Env varDefaultNotes
DATABASE_URL(required)PostgreSQL connection string
OPS_BRAIN_TRANSPORTstdiostdio or http
OPS_BRAIN_LISTEN0.0.0.0:3000HTTP bind address
OPS_BRAIN_AUTH_TOKEN(none)Main bearer. Required for http: a missing or blank token aborts startup unless OPS_BRAIN_DEV_NO_AUTH=true.
OPS_BRAIN_AGENT_TOKENS(none)JSON array of identity-bound tokens for /mcp. Enforces identity, not tenant isolation. See docs/agent-tokens.md.
OPS_BRAIN_OAUTH_CONFIG(none)Optional external provider, JWKS, scopes and explicit subject/client-to-agent bindings. See docs/oauth.md.
OPS_BRAIN_OAUTH_RESOURCE_URL(none)Canonical public HTTPS MCP resource URL. Required together with the OAuth config; empty leaves OAuth disabled.
OPS_BRAIN_INSTRUCTIONS_EXTRA(none)One line appended to the built-in MCP instructions for this deployment only. No line breaks. Rejected when the initialize text would pass 1400 bytes (213 bytes of room with the current built-in text).
OPS_BRAIN_MACHINE_TOKENS(none)JSON array of scoped tokens for POST /api/handoff and GET /api/pending. See docs/machine-callers.md.
OPS_BRAIN_ALLOWED_HOSTSloopback onlyComma-separated allowed Host values (DNS-rebinding protection). Set your public hostname when behind a reverse proxy.
OPS_BRAIN_DEV_NO_AUTHfalseServe HTTP with no auth. Dev only; never expose beyond localhost.
OPS_BRAIN_MIGRATEtrueRun migrations on startup
OPS_BRAIN_EMBEDDINGS_ENABLEDtruefalse turns embeddings off even when a URL is set (the example compose file ships with them off). Blank means unset.
OPS_BRAIN_EMBEDDING_URL(none)OpenAI-compatible embedding API, e.g. http://localhost:11434/v1/embeddings for local Ollama. Embeddings are off unless this is set; blank counts as unset.
OPS_BRAIN_EMBEDDING_MODELnomic-embed-textEmbedding model name
OPS_BRAIN_EMBEDDING_API_KEY(none)Bearer for the embedding API, if it needs one

The server reads only the names above. Other OPS_BRAIN_* names in this repo are not server settings:

  • Compose only (interpolated by docker compose, never read by the binary): OPS_BRAIN_IMAGE, OPS_BRAIN_BIND, OPS_BRAIN_PORT (example and dev compose), OPS_BRAIN_DB_PASSWORD (prod compose).
  • Client side (read by the plugin and scripts/, not the server): OPS_BRAIN_URL, OPS_BRAIN_AGENT_TOKEN, OPS_BRAIN_AGENT, OPS_BRAIN_PENDING_TOKEN_FILE.

Stack

ComponentChoice
LanguageRust 2021
MCP SDKrmcp 1.6
DatabasePostgreSQL 18 via sqlx (runtime queries)
Searchtsvector full-text + pgvector HNSW cosine, fused with Reciprocal Rank Fusion
Embeddingsnomic-embed-text (768d) over any OpenAI-compatible API
Transportstdio, or streamable HTTP on axum

Project docs

DocWhat's in it
ROADMAP.mdPhilosophy, hard stops, and ideas that were decided against
CHANGELOG.mdRelease history, including why the live lane was removed in v6.0.0
GOTCHAS.mdCode and deployment footguns
docs/agent-tokens.mdPer-agent identity tokens and onboarding a new agent
docs/oauth.mdExternal OAuth providers, agent bindings, plugin sign-in and local validation
docs/machine-callers.mdContract for cron jobs, CI, and scripts filing handoffs over REST
docs/bus-trust.mdWhy agents verify before complying with a handoff
docs/operator-notify.mdMailing the operator when an agent is blocked on a human
docs/clients.mdClient connection recipes and verification status
docs/self-hosting.mdPrivate setup files, HTTPS, backups and upgrades
docs/listings.mdWhere ops-brain is listed and how each listing updates

License

Dual-licensed under either MIT or Apache-2.0, at your option.

来源:README.md,提交 c62ffb0

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

5
  1. v6.3.2最新Oct 22, 2026
  2. v6.3.1Oct 19, 2026
  3. v6.3.0Oct 19, 2026
  4. v6.2.0Oct 18, 2026
  5. v6.1.2Oct 17, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

其他 Brain 集成