Repository avatar
Other Tools
v1.6.1
active

coordinationhub

io.github.IronAdamant/coordinationhub

Shared board for coding agents: identity, file locks, tasks, messages and handoffs.

Documentation

CoordinationHub

A shared board for coding agents working on the same project. It records who is working, who holds which file, which tasks are open, claimed, done or handed off, and lets agents message and wait on each other. Agents use it through MCP (stdio) or the command line; a small HTTP server shows a live dashboard.

It is one Rust binary built from the standard library only: no crates, nothing to install at run time. It replaced the Python 0.8.0 program in 1.0.0 with the same tools, commands and replies; MIGRATION.md is the guide for users coming from it. The older Python releases on PyPI are frozen, unsupported and not part of this repository. Version 1.1.0 makes task claims safe under concurrency, adds explicit handoff tools and sends compact replies; 1.2.0 keeps locks alive while their holder heartbeats, reports lapsed locks, and stops long waits from holding up other calls; 1.3.0 reads requests as strict JSON, recovers from an unfinished journal write, drops old events and compacts the journal, and hardens the HTTP server and its token; 1.4.0 shows which agents have gone quiet, counts every call that names an agent as its heartbeat, adds hand_back so an agent's final report survives a restart, and adds coordinationhub ready (see the changelog). coordinationhub --version prints the installed version.

Install

From npm (Linux x64 and arm64, macOS x64 and arm64, Windows x64; Node 18 or later runs a small launcher, the binary itself has no npm dependencies):

npm install -g @iron_adamant/coordinationhub   # installs `coordinationhub`
npx -y @iron_adamant/coordinationhub --version  # or run it without installing

From source:

cargo install --path . --locked    # builds and installs `coordinationhub`

Then:

coordinationhub init               # optional: IDE hooks in ~/.coordinationhub/hooks.json
coordinationhub doctor             # check the setup

Tagged releases attach binaries for Linux x64 and arm64, macOS x64 and arm64, and Windows x64, with SHA256SUMS. The release workflow publishes the same binaries to npm (@iron_adamant/coordinationhub and one @iron_adamant/coordinationhub-<os>-<arch> package per platform) and lists the server in the MCP Registry as io.github.IronAdamant/coordinationhub.

Connect an agent

Claude Code (.mcp.json at the project root), Cursor (.cursor/mcp.json) and other MCP clients start the stdio server the same way:

{
  "mcpServers": {
    "coordinationhub": {
      "command": "coordinationhub",
      "args": ["serve-mcp"]
    }
  }
}

Without a global install, let npx fetch it:

{
  "mcpServers": {
    "coordinationhub": {
      "command": "npx",
      "args": ["-y", "@iron_adamant/coordinationhub", "serve-mcp"]
    }
  }
}

The server keeps its store in the project's .coordinationhub/ directory (the nearest folder with .git), or in ~/.coordinationhub/ outside a project. A client that cannot pass --project-root or --storage-dir can set COORDINATIONHUB_PROJECT_ROOT or COORDINATIONHUB_STORAGE_DIR in the server's env.

Example

Two agents split dependent work and contend for a file:

coordinationhub register planner
coordinationhub register worker-1 --parent-id planner
coordinationhub create-task T-api planner "add retry to fetch()"
coordinationhub create-task T-tests planner "test the retry path" --depends-on T-api
coordinationhub assign-task T-api worker-1
coordinationhub assign-task T-api planner           # refused: T-api is already assigned to worker-1 (exit 4)
coordinationhub acquire-lock src/api.rs worker-1
coordinationhub acquire-lock src/api.rs planner     # FAILED: src/api.rs is locked by worker-1 (exit 4)
coordinationhub acquire-lock src/api.rs src/util.rs planner   # several paths: all or none (exit 4); --best-effort takes the free ones
coordinationhub update-task-status T-api completed --summary "3 tries with backoff"
coordinationhub release-lock src/api.rs worker-1
coordinationhub get-available-tasks                 # T-tests is open now

Over MCP the same steps are register_agent, create_task, assign_task, acquire_lock, update_task_status, release_lock and get_available_tasks. Add --json to any command for machine-readable output; coordinationhub <command> --help lists every flag.

An agent claims a task by assigning it to itself. The claim is checked and written in one step under the store lock, so when several agents claim the same task at once exactly one gets it and the others are told who holds it; get_available_tasks with unassigned_only lists only tasks nobody holds, and force reassigns on purpose. A handoff goes broadcast (with handoff_targets), acknowledge_handoff by each recipient, then complete_handoff; wait_for_handoff only waits or reads the status.

How it works

  • One store per project. State is an append-only journal (coordination.jsonl). Each call takes a short file lock, reads lines written since its last call, applies the change and appends it, so any number of agent sessions, CLI calls and hooks share one board safely.
  • Agents register with an id and an optional parent, send heartbeats, and deregister; leaving releases their locks and re-parents their children. A registration reply lists the agent's own live locks (held_locks) and unread messages (unread_messages, the newest 10 in messages), so an agent coming back after a restart needs no further calls.
  • Locks are exclusive or shared, for a whole file or a line range, with a TTL. A line range is region_start to region_end, inclusive and 1-based like an editor's line numbers: 10-20 and 20-30 overlap on line 20. Pass both or neither; a missing end, a start after the end or a line below 1 is refused with the rule. A refused lock says who holds it and until when. document_path may be a list (the CLI takes several paths before the agent): the list is locked in one step, all or none, and a refusal names every holder; best_effort takes the free paths and lists the rest. release_lock takes a list the same way. Each heartbeat renews the caller's locks that have less than half their TTL left, so a lock lasts as long as its holder keeps heartbeating, and the TTL only frees the files of an agent that stopped. A lock that ran out anyway is reported as expired (with expired_at) by release_lock, refresh_lock, heartbeat, get_notifications (with agent_id), deregister_agent (locks_expired) and admin_locks release_by_agent.
  • Quiet agents. The reaper marks an agent stopped after 600 s without a heartbeat (COORDINATIONHUB_AGENTS_STALE_TIMEOUT_S); its next heartbeat makes it active again (revived: true). list_agents names the agents it hides for being quiet in stale_hidden. A quiet agent keeps its locks until their TTL runs out (it may be in a long build and come back); deregister_agent releases them at once.
  • Waits (get_notifications with timeout_s, wait_for_*, await_*, acquire_lock with retry) run on their own thread and engine, so they never hold up other calls on the same server, stop when the client cancels them, and last at most 600 s (COORDINATIONHUB_MAX_WAIT_S sets a lower cap) before answering timed_out. A call waits at most 30 s for the store's file lock (COORDINATIONHUB_LOCK_WAIT_S) and then fails with store busy instead of hanging.
  • Work: tasks with priority, dependencies and subtasks, assignment and status, failure history and retries, work intents, and agent-to-agent dependencies.
  • Talking: direct messages, sibling broadcasts with acknowledgements, formal handoffs, change notifications, and wait tools that return as soon as the thing they wait for happens. MCP replies are compact JSON.
  • Leadership: one coordinator lease with a TTL; a refused lease names the holder and its expiry.
  • Hooks: coordinationhub hook (written by init) registers a session, locks a file before Write, Edit, MultiEdit or NotebookEdit (refused for a file another agent holds or one in a superseded plan area), and notifies and releases afterwards. Each subagent gets its own agent, <session agent>.<type>.<n>, tied to the IDE's id for it, so two subagents of one type running at once hold their own locks. A refused write names the holder, says until when, and suggests messaging the holder, waiting for the lock or working elsewhere. Subagent prompts are redacted (keys, tokens, emails, long hex strings) before they are stored. init keeps a differing ~/.coordinationhub/hooks.json as hooks.json.bak.
  • Dashboard: coordinationhub serve-sse serves a live page and opens it in the browser. See HTTP server and dashboard.

It works alongside Relatum (handoff documents), stele-context (code map), Trammel (plans) and Chisel (test impact); it does not duplicate them.

The store

  • Requests are strict JSON. One value, RFC 8259 numbers and strings, no duplicate object keys, at most 128 levels of nesting, and every number finite and between -1e15 and 1e15 (1e400, NaN and Infinity are refused, on the CLI too). The error names the field or the byte and what to send instead. An MCP frame or /call body is at most 1,000,000 bytes.
  • An unreadable last record is moved out. If a process dies while appending, the next call saves the incomplete final record in coordination.jsonl.<UTC time>.torn beside the journal, cuts it off, says so once on stderr and carries on. A final line that is complete but is not a record goes to a .unreadable file the same way, and the notice says that it was not an unfinished write. coordinationhub doctor lists both kinds. A bad record in the middle of the journal is an error that names the line and how to recover.
  • doctor reads the journal as the hub does, under the same lock, and changes nothing. It fails only on what the hub refuses; a journal the next command will mend (numbers 1.2.0 wrote as Infinity, an unfinished last record) is reported as such.
  • What is stored stays readable. Text stored by an earlier version (a message payload nested deeper than a request may be now, or with a repeated key) is read back with a tolerant reader: up to 320 levels, the last value of a repeated key. A payload that still cannot be shown as JSON is returned as its stored text, with payload_unreadable saying why; it is never replaced by null.
  • Old events are dropped. Hub events, change notifications and claim events older than seven days (COORDINATIONHUB_EVENTS_MAX_AGE_S; 0 keeps everything) are removed by the servers' housekeeping and by any call once the journal passes the compaction size. Each agent's last lifecycle event and every lock-lapse warning not yet delivered are kept, so heartbeat answers the same.
  • The journal is compacted. Once it is over 1 MiB (COORDINATIONHUB_COMPACT_MIN_BYTES; 0 turns it off) and holds more than twice as many records as live rows, it is rewritten as one record per row through a temporary file and a rename, under the store's lock. Every other server and process notices on its next call and reloads.
  • Durability. A call's records are appended in one write and, by default, not synced: a crashed process loses nothing, while a power cut or a crashed machine can lose the last calls (or leave the torn record described above). The store holds coordination state that expires and is re-established (registrations, locks, heartbeats), and a sync after every call costs a disk flush each time (a heartbeat over MCP took about 1.2 ms without and 2 to 5 ms with it on an SSD under Windows 11, measured on 15 November 2026; a hard disk or a network share costs more), so it is off by default. Set COORDINATIONHUB_FSYNC=1 to sync after each commit when the task board is your record of work.
  • A store 1.2.0 damaged opens. 1.2.0 could write Infinity into the journal (a lock TTL of 1e400) and then fail every command with unexpected JSON byte I. 1.3.0 reads such a journal, gives the rows large finite values, rewrites the file and says so once.

HTTP server and dashboard

coordinationhub serve (port 9877) is the HTTP API; coordinationhub serve-sse (port 9898) adds the dashboard page. Both listen on 127.0.0.1 unless --host says otherwise.

  • The token. Without --no-auth every path except / and /health needs Authorization: Bearer <token>. The token is 16 bytes from the operating system's random generator (the server does not start if there are none), or the value of --auth-token. It is printed on the server's stdout, so whoever can read that terminal can call every tool. auto-start-dashboard sends that output to ~/.coordinationhub/dashboard.log, which is created readable by its owner only (mode 0600 on Unix; on Windows the file has the permissions of your profile folder). A token passed with --auth-token is also visible in the process list.

  • The dashboard. serve-sse prints Dashboard: http://127.0.0.1:9898/#token=<token> and opens that address. The page itself never contains the token: its script reads it from the address, keeps it for that browser tab, removes it from the address bar and sends it with every request. Opened without the token, the page says to open the printed address. When the server stops answering or the data is old, the page shows a banner with the time of the last update.

  • Who may call. A request must name the server in Host: a loopback address or localhost, the --host value, or the address the connection arrived on, each with the port. Anything else is answered 421. A request with an Origin header other than the server's own address is answered 403. POST /call needs Content-Type: application/json, else 415. Together these stop another web page, or a DNS name pointed at 127.0.0.1, from using the hub.

  • Other answers. 401 without the token, 400 for a malformed request or JSON (the body says what is wrong), 404 for an unknown path or tool, 411 without Content-Length, 413 for a body over 1,000,000 bytes, 431 for headers over 64 KiB, 400 at once for a head whose lines end with a bare line feed instead of CRLF, 408 for a head that is not complete within 5 seconds of connecting or a body within 30 seconds after that, 501 for Transfer-Encoding, 429 for a fifth event stream from one address, and 503 when 256 connections are open (COORDINATIONHUB_MAX_CONNECTIONS) or 64 waits are running.

  • Beyond this machine. --no-auth with a --host that is not a loopback address is refused. A non-loopback --host with auth prints a warning: the token then crosses the network unencrypted.

  • Limits. A connection holds one of the 256 slots from the moment it is accepted. Its request head must be complete within 5 seconds and a /call body within 30 seconds after that, or the connection is answered 408 and its slot is free again; so a client that opens many sockets and sends nothing useful can delay others by 5 seconds at most per round, and /health and the dashboard recover by themselves. An event stream lasts at most 600 seconds and a waiting /call at most 600 seconds.

Known limits

  • A very busy store still grows within the retention window. Compaction counts every retained event and notification as a live row, so a journal that is mostly events younger than seven days is not rewritten; lower COORDINATIONHUB_EVENTS_MAX_AGE_S on such a store.
  • A compaction that fails after it was counted (the lock file grows before the rename) makes the other processes reload once for nothing. The other order could hide a compaction from them.
  • Linux needs glibc 2.25 or newer (2017), or musl 1.1.20, for getrandom. An older C library cannot link the binary.
  • Relative lock paths resolve against the process's working directory, not --project-root.

Performance

1.4.0 on GitHub's ubuntu-latest runner, over MCP stdio, median of 3 runs, in seconds. These are the figures in examples/bench_baseline.txt: CI's benchmark-gate reruns the rows on every pull request and fails when one takes longer than three times its figure plus 0.02 s. BENCHMARKS.md has the details and the earlier measurements.

OperationSeconds
startup and status0.0017
status x450 after 450 agents0.0140
register x2000.0539
lock x2000.0319
get_agent_tree x20 after 200 agents0.0700

When the hub applies

  • Locks and claims matter when several agents edit one working tree. With a git worktree for each agent nothing is shared, and locks do nothing.
  • Heartbeat and hand-back matter in every setup. Any call that carries your agent_id counts as a heartbeat, so an agent does not have to remember one. status and list_agents lead with the agents that have gone quiet (quiet: who, and "no call for 42 min", most quiet first), which is how a lead sees two stuck agents. A hook can send coordinationhub heartbeat <agent>: it registers an unknown agent, takes tens of milliseconds and prints one line.
  • Hand back your work so it survives a restart. Before its final message an agent calls hand_back once with a summary and the paths of its files. A lead that restarted calls get_hand_backs to read what is waiting, then acknowledge_handoff on each (any agent may acknowledge a hand-back). status shows hand_backs_waiting.
  • coordinationhub ready [--json] prints one line such as 3 agents, 1 quiet for 42 min, 0 locks, 2 hand-backs waiting; the hub is always ready.
  • Seals: is it current, is it done, whose is it, where is it. seal_put records a piece of work by where it lives (file:src/x.rs, libellus:main/q1, relatum:net/retry), its Sigillum stamp, its owner and its state (open, done with the stamps of what it delivered, or superseded with what replaced it). seal_check says whether the stamp you hold is current, stale, superseded or unknown (the hub hashes file: refs itself, and only those); seal_ls state=open lists the open work and whose it is. Only the owner, its ancestors or a root agent may change a seal, and expect makes a change compare-and-set.
  • Plan state, gated. A root agent sets the objective and next step (plan_set) and marks areas that must not be resumed (plan_supersede with project-relative globs, replaced_by and reason). plan_get returns the plan with one plan_stamp; a sub-agent briefed with that stamp checks it before acting. acquire_lock, and so the write hook, refuses a file in a superseded area: "paused: do not resume; replaced by ()". coordinationhub gate PATH --agent-id AGENT [--json] answers the same question for other hooks without changing anything (exit 0 allow, 1 deny), coordinationhub plan [--json] prints the plan (the plan_get reply with --json), and coordinationhub seals [--json] [--owner A] [--state S] [--prefix P] [--limit N] lists seals (the seal_ls reply with --json; otherwise one <ref> <state> <owner> <stamp> line each, then the count). Like hook and ready, none of the three is listed in --help, and none writes anything.
  • Behind Mem-Harness (MEM_HARNESS_TOOL_PREFIX, for example hub_) tool names in hints and descriptions carry the prefix, and a hint that names a tool switched off in this session is left out.

Tool groups

The MCP server exposes 62 tools in eight groups. An agent that only needs part of them can switch the rest off in the client's env block; the CLI is not affected. locks, tasks and messages are the names the IronAdamant tools share for overlapping features, so one word means the same thing in every tool.

GroupToolsOverlaps with
core (always on)register_agent, heartbeat, deregister_agent, list_agents, status
locksacquire_lock, release_lock, refresh_lock, get_lock_status, list_locks, admin_locks, wait_for_locks, get_conflicts, get_contention_hotspots, manage_work_intents, acquire_coordinator_lease, manage_leases, whoChisel locks, Trammel step claims
taskscreate_task, create_subtask, assign_task, update_task_status, query_tasks, get_available_tasks, wait_for_task, task_failures, manage_dependenciesTrammel plans
messagessend_message, manage_messages, broadcast, acknowledge_broadcast, wait_for_broadcast_acks, hand_back, get_hand_backs, acknowledge_handoff, complete_handoff, cancel_handoff, wait_for_handoff, notify_change, get_notifications
spawnspawn_subagent, report_subagent_spawned, get_pending_spawns, await_subagent_registration, request_subagent_deregistration, is_subagent_stop_requested, await_subagent_stopped, await_agent
agentsget_agent_relations, get_agent_tree, get_agent_status, update_agent_status, get_file_agent_map
diagnosticsscan_project, load_coordination_spec, run_assessment
sealsseal_put, seal_check, seal_ls, plan_set, plan_supersede, plan_getLibellus and Relatum stamps (the hub records them; it never reads their stores)
  • COORDINATIONHUB_TOOLS: comma-separated groups and/or tool names to expose (plus core); all is accepted.
  • COORDINATIONHUB_DISABLE: groups and/or tool names to hide, applied after COORDINATIONHUB_TOOLS.
  • Case and spaces are ignored, and an empty value counts as unset. An unknown name, or naming core or one of its tools in COORDINATIONHUB_DISABLE, stops the server with one line on stderr and exit code 2, so the client shows it failed. Calling a hidden tool returns an error that names the variable and what to change, and initialize ends with one line listing the groups on and off. With no agent-tools block (below) and neither variable set, the tool list is unchanged. Agents normally choose the groups in the project's AGENTS.md; the variables are the operator's override.
"env": {"COORDINATIONHUB_DISABLE": "spawn,diagnostics"}

A lean set for agents that coordinate files, tasks and messages (24 tools with core, about half the schema text: a tools/list reply of 19,660 bytes instead of 39,097, measured on 1.3.0):

"env": {"COORDINATIONHUB_TOOLS": "acquire_lock,release_lock,list_locks,who,acquire_coordinator_lease,manage_leases,create_task,assign_task,update_task_status,get_available_tasks,query_tasks,wait_for_task,send_message,manage_messages,get_notifications,broadcast,acknowledge_handoff,complete_handoff,wait_for_handoff"}

Choosing groups

CoordinationHub's MCP tools come in groups, and the agent working on a project picks the ones it needs. Put one line per agent tool (coordinationhub:, trammel: and so on) in the first fenced block whose info string is agent-tools in the project's AGENTS.md (project root: --project-root, COORDINATIONHUB_PROJECT_ROOT, the nearest folder with .git, else the current directory). Use coordinationhub: tools <groups> to keep only those (plus core) or coordinationhub: disable <groups> to hide some. The server rereads the file on the next request and the client refetches the tool list, so no restart is needed. COORDINATIONHUB_TOOLS / COORDINATIONHUB_DISABLE in the client's env override the matching line. A mistake in the file is reported in the initialize instructions and by status; it never stops the server.

CoordinationHub is the suite's owner for locks, tasks and messages. When it runs, keep those here and switch them off in the other tools; when it does not need them, switch them off here instead.

GroupForTurn it off when
coreregister, heartbeat, deregister, list agents, statusnever (always on)
locksfile locks, the coordinator lease, work intents, who claimsone agent works on the project, or every agent has its own worktree
tasksthe shared task board: dependencies, assignment, waits, failuresone agent works alone, or Trammel's step queue already hands out the work
messagesmessages, broadcasts, handoffs, change notificationsagents never need to talk while they work
spawnthe sub-agent spawn registrythe client tracks sub-agents itself (Claude Code's Task tool with the hook)
agentslineage, agent status, the file-to-agent mapyou do not inspect who spawned whom
diagnosticsproject scan, coordination spec, assessmentyou do not use a coordination spec

Several agents or sessions sharing one checkout (CoordinationHub owns locks, tasks and messages):

coordinationhub: tools locks, tasks, messages
trammel: disable locks
chisel: disable locks

One agent working alone (solo): with one agent there is nothing to lock and no one to message or hand work to, so keep only the core tools (register, heartbeat, deregister, list agents, status):

coordinationhub: tools core

When a second agent joins, add the groups back (coordinationhub: tools locks, tasks, messages); until then a call to a hidden tool answers with the line to change.

Exit codes

CodeMeaning
0Done
1An error: the reply or message says what went wrong. Also load-spec that loaded nothing, validate-spec of an invalid or missing spec, and doctor with a failed check
2Bad command line (usage error), or a bad COORDINATIONHUB_TOOLS / COORDINATIONHUB_DISABLE for serve-mcp
3Not found: assign-task of a task that does not exist, cancel-spawn of an unknown or consumed spawn (with --json it prints the reply and exits 0), request-subagent-deregistration of an agent that is not active
4Refused because another agent holds it: acquire-lock not granted, assign-task of a task assigned to someone else, refresh-coordinator-lease refused

watch clears the screen between refreshes only when its output is a terminal and NO_COLOR is unset. --replica and --force-refresh are accepted for 0.8.0 scripts and have no effect.

Develop

cargo test --release
cargo clippy --all-targets -- -D warnings
cargo run --release --example check_zero_deps
cargo run --release --example check_no_todos
cargo run --release --example check_no_legacy
cargo build --release
cargo run --release --example bench -- target/release/coordinationhub

On Windows the binary path is target/release/coordinationhub.exe; bench compares with figures from CI's Linux runner, so its verdict means something only there. AGENTS.md is the guide for working on this repository, MIGRATION.md lists the differences, BENCHMARKS.md has the timings, RELEASING.md the release steps, and CHANGELOG.md the releases.

Environment

VariableRole
COORDINATIONHUB_STORAGE_DIR, COORDINATIONHUB_PROJECT_ROOTStore and project for serve-mcp when the flags are not given
COORDINATIONHUB_COORDINATION_URLURL included in a registration reply
COORDINATIONHUB_HOUSEKEEPING0 stops the background reaping of stale agents, expired locks and lapsed claims in serve and serve-mcp
COORDINATIONHUB_HOUSEKEEPING_AGENTS_INTERVAL_SHow often a server's housekeeping reaps stale agents, expired locks and lapsed claims (default 30)
COORDINATIONHUB_AGENTS_STALE_TIMEOUT_SHeartbeat age after which an agent is stale (default 600)
COORDINATIONHUB_LOCK_WAIT_SHow long a call waits for the store's file lock before store busy (default 30)
COORDINATIONHUB_MAX_WAIT_SA lower cap for waiting calls than the default 600 seconds
COORDINATIONHUB_TOOLS, COORDINATIONHUB_DISABLEMCP tool groups for serve-mcp (see Tool groups)
COORDINATIONHUB_EVENTS_MAX_AGE_SHow long events and notifications are kept, in seconds (default 604800, seven days; 0 keeps everything)
COORDINATIONHUB_HOUSEKEEPING_EVENTS_INTERVAL_SHow often a server's housekeeping drops old events (default 600)
COORDINATIONHUB_COMPACT_MIN_BYTESJournal size from which old events are dropped on a call and the journal may be compacted (default 1048576; 0 turns both off)
COORDINATIONHUB_FSYNC1 syncs the journal to disk after every commit (default off)
COORDINATIONHUB_MAX_CONNECTIONSHTTP connections served at once before 503 (default 256)
COORDINATIONHUB_MAX_DESCRIPTION and the other COORDINATIONHUB_MAX_* capsField length caps, as in 0.8.0
COORDINATIONHUB_SPAWN_TTL_SECONDS, COORDINATIONHUB_MAX_PENDING_SPAWNSPending sub-agent spawn lifetime and cap