second-desk-relay
Official# Second Desk Relay
One shared board for the AI agents working on my machine, so they stop redoing each other's work.
I run several agents and coding sessions at the same time, and I kept hitting the same problem: two of them would start the same job, or one would change a file another was in the middle of, and none of them knew what the others had already done. Relay is the MCP server I built to fix that. Every agent connects to the same local store and works from one shared picture: a task board where a claim is atomic, shared notes by topic, named locks with an expiry for taking turns, a presence list that shows who is active, and an event history that records what the group did.
**12 tools · one SQLite file · no account, no key, nothing leaves the machine.** In my own race test, two server processes claimed the same task in the same moment and exactly one claim landed. The full test outputs are in `TEST-EVIDENCE.md`.
## Tools
| Tool | What it does |
|---|---|
| `task_post(title, details, author, assignee)` | Post a task to the shared board. It starts open. The assignee is optional. |
| `task_list(status, limit)` | List tasks, newest first. Filter by open, claimed or done. |
| `task_claim(task_id, author)` | Claim an open task. Atomic: if two agents reach for it at once, one wins and the other is told who holds it. |
| `task_complete(task_id, author, result_note)` | Mark a task done and leave a result note. Only the agent who claimed it can complete it. |
| `note_post(topic, body, author)` | Leave a shared note under a topic for the rest of the group. |
| `note_list(topic, limit)` | Read notes, newest first, for one topic or all of them. |
| `lock_acquire(name, owner, ttl_minutes)` | Take a named lock so agents take turns around one file, one device or one job. If a live lock exists, you are told who holds it and when it frees. |
| `lock_release(name, owner)` | Release a lock you hold. Only the owner can release it. |
| `lock_list()` | List every live lock, its owner and its expiry. Expired locks clear themselves. |
| `presence_beat(author)` | Record a heartbeat: this agent is active now. |
| `presence_list(within_minutes)` | See which agents were active in the last N minutes, and how long ago each was seen. |
| `event_log(limit)` | Read the history of tasks, claims, completions, notes and locks, newest first. |
Every write carries the author label the caller passes and a UTC timestamp, so the board always shows who did what and when.
## Setup
1. Make sure Python is installed. I test on Python 3.12.
2. Install the one dependency, the official MCP SDK:
```bash
pip install -r requirements.txt
```
3. Start the server. It speaks MCP over stdio by default:
```bash
python3 mcp_server.py
```
4. Point every agent session at the same store. The store path comes from the `RELAY_DB` environment variable and defaults to `./relay.db` where the server starts:
```bash
export RELAY_DB=/path/to/shared/relay.db
```
Start one server process per agent session, all with the same `RELAY_DB`, and they share one board. Writes run in immediate transactions with a 30 second busy timeout and the database runs in WAL mode, so concurrent processes stay safe and readers are not blocked by a writer.
There is also an HTTP transport if you want one process serving several clients: `python3 mcp_server.py --transport streamable-http --port 8797`. It answers `GET /health` as well.
## Example
From a real run of mine (the full output is in `TEST-EVIDENCE.md`). One agent posts a task and another claims it:
```json
// task_post by builder
{"task_id": 1, "title": "Draft the release notes", "status": "open",
"assignee": "reviewer", "created_by": "builder",
"created_at": "2026-12-01T05:27:40Z"}
// task_claim by reviewer
{"claimed": true, "task_id": 1, "claimed_by": "reviewer",
"claimed_at": "2026-12-01T05:27:40Z"}
// task_claim on the same task by builder
{"claimed": false, "task_id": 1, "reason": "already_claimed",
"claimed_by": "reviewer", "claimed_at": "2026-12-01T05:27:40Z",
"detail": "Task 1 is already claimed by reviewer."}
// task_complete by reviewer, the claim owner
{"completed": true, "task_id": 1, "completed_by": "reviewer",
"completed_at": "2026-12-01T05:27:40Z",
"result_note": "Release notes drafted and posted for review."}
```
And the race that matters most, from the two process test: both agents claimed task 1 in the same moment, one through each server process. One answer came back `"claimed": true` for agent-a, and the other came back `"claimed": false, "reason": "already_claimed", "claimed_by": "agent-a"`. One winner, every time.
## Limits
- **Labels are trusted.** Any process that can reach the store can write under any author label. Relay coordinates a group you trust on your own machine. It is not an identity system and it is not a security boundary.
- **One machine, one file.** Relay does not sync across machines or over a network by itself. Every process has to reach the same SQLite file.
- **Locks are cooperative.** They work because every agent checks them. Nothing stops a process that ignores the store from touching the same file anyway.
- **Presence is a heartbeat, not proof.** A label shows as active because something beat for it recently. If an agent stops beating, it fades from the list on its own.
- **The event log records actions, not heartbeats.** Task, note and lock activity is logged. Presence beats are not, so the history stays readable.
## License
MIT. See `LICENSE`.
TDQS
Scored across 12 tools
Each tool maps to a distinct resource+action pair: tasks (post/list/claim/complete), notes (post/list), locks (acquire/release/list), presence (beat/list), and the event log. The only potential overlap is event_log versus task_list/note_list as history views, but the descriptions make clear that one is a cross-cutting audit trail and the others are per-resource queries.
Every name follows the same snake_case pattern of <resource>_<action> (task_post, note_list, lock_acquire, presence_beat), with the resource always first and the verb always second. No camelCase or verb-first outliers; even the slightly unusual event_log reads consistently as a resource_noun name.
Twelve tools is a well-scoped set for a group-coordination hub: four task tools, two note tools, three lock tools, two presence tools, and one log reader. Every tool earns its place, with no redundant or filler entries.
The core coordination lifecycle is covered: task post/claim/complete with atomic claiming, notes, TTL locks, heartbeats, and an audit log. Gaps exist around task recovery — there is no unclaim/abandon or reopen operation (unlike locks, tasks never expire), no task edit/cancel, and no note or lock administration (e.g. force-break), which could strand work if an agent dies mid-claim.