Using midas
- Building on a node — agents
- Running a bot — agents
- Landing and the shared skills — agents
- Seeing what is going on — anyone
- On a build machine — its owner
- Running the workspace — the operator
Building on a node
midas run -- cargo test # a node for this one command: waits in line, runs, exits with its status
midas run gpu -- cargo … # any node with a GPU; or a machine's name, or a node's
A run holds a node for one command, not for the session. It takes the free
node fastest at that command — the one the session ran on last when that is as
fast and nobody used it since, so only what changed is rebuilt — waits in line
for as long as it takes (run it in the background), and the node goes back a
minute after the command when somebody waits, ten when nobody does. In between,
ssh and scp to it work as for a taken node. A session that holds a node
already runs on that one. In the two weeks to 2026-11-14 the Macs were held
102 h and in use for 38 of them, while sessions waited 25 h for them.
Take a node for longer when the work needs one between commands — a bot, a running client to drive, a series of captures:
midas take # any free node; or: midas take gpu / midas take <machine or node>
ssh <node> 'cargo test' # runs in the node's checkout
scp <node>:/tmp/out.png . # fetch what it made
midas release # give it back
- Your worktree goes with you. Every
ssh,scporrsyncto the node first sends your new commits and uncommitted edits, so the command runs on exactly the tree you see. There is no sync step. - Waiting in line. If nothing is free,
midas takewaits 90 s, then exits with code 75 and keeps your place.midas wait(in the background, if your commands are cut off after a few minutes) carries on and gets you the node. - Giving it back happens by itself too: after 30 minutes with no ssh
session open (a long build keeps it), 20 while somebody waits for it, 5
while a deploy of what landed waits for it — and when an agent session
ends.
midas intent "…" --minutes Nkeeps it for that long. A deploy is first in every line, ahead of the sessions that asked before it. - A command that does nothing is stopped. No output and next to no CPU
for 15 minutes is said on its stderr; for 30, its whole process group is
stopped (unless another command on the node is moving, as a build another
cargo waits for is), so the ssh ends and the agent hears of it. One meant to
wait takes
MIDAS_STALL=off, or a limit such asMIDAS_STALL=2h, as its first word. A command that ended no longer leaves its ssh open behind a process it started that still holds its output (ssh node 'server &'): the session ends two seconds after it and names what it left. The session's node line on the page says when its command has done nothing for five minutes. - Only the holder gets in. ssh to a node your worktree does not hold is
refused, with the reason.
cargorefuses to build outside a node and says whichmidas run(or, on a node you hold, whichssh) to use (MIDAS_LOCAL_BUILD=1for a one-off). - "You" is your worktree, by its name.
--owner <name>(on any command, or MIDAS_OWNER) acts as another: the landing gate holds its node asgate-<worktree>.
An agent's machine needs ~/.config/midas/hub.env (hub.md)
and the ssh settings for the nodes, which midas ssh-config --flush --write ~/.ssh/config writes (the session hook in hooks/ runs it at every start),
and the session hooks and shared skills, which midas claude install puts in
~/.claude (below).
Running a bot
A bot is a long-running program on a node that you talk to over MCP — for
Cartopolis, the client running headless and signed in. midas bot start takes a
node in bot mode, starts it in the node's checkout (which follows your worktree,
as for a build), and returns once it answers. It needs two commands: the bot,
after --, and with --mcp the relay that turns stdin/stdout into the bot's
MCP:
midas bot start gpu --mcp 'cargo run -q -p cartopolis -- mcp --socket /tmp/bot/mcp.sock' -- \
cargo run -q -p cartopolis -- --mcp-headless --mcp-listen /tmp/bot/mcp.sock --connect cartopolis.org --mcp-allow sam
midas bot status # running?, since, the last of its log
midas bot stop # stop it and give the node back (midas release does too)
- Run
bot startin the background. The firstcargo runon a node compiles for many minutes; it waits up to--timeout(30 minutes) and says every 30 s where it is. Cut off, the bot carries on starting;midas bot statusshows it. Waiting in line for a node it allows an hour (--wait). - Talking to it: an MCP server whose command is
midas bot mcp, run in the worktree that holds the node — in.mcp.json:{"mcpServers": {"bot": {"command": "midas", "args": ["bot", "mcp"]}}} - The lease lasts while the bot runs, with no ssh session open, as long as
you keep talking to it: 30 minutes with no ssh session, command or
midas renewfrom you, and the node is given back and the bot stopped. Keep a waiting call to the bot running in the background if it must outlive a quiet spell. Releasing it stops the bot. - Its credential:
midas bot token gpu(asks for it with echo off;--envnames the variable, defaultCARTO_TOKEN) gives every GPU node's bots one, kept by the hub and handed to the bot when it starts — a node, a machine oranywork too, and--listnames what is set. The node itself asks the hub for them as the bot starts, and the hub answers only the node named, from its own address: a secret reaches the node that runs the bot and the session holding it, no other session, and each read is logged (bot_secrets_read, names only). A machine's owner can instead set one on the machine (sudo midas bot setup, node.md), which never passes through the hub; where both set a name, the hub's wins. - A named bot's sign-in and voice: Settings ▸ Bots on the page keeps, per
bot name, a Cartopolis server, username and password, and whether it takes
calls by voice with its own OpenAI key or the hub's.
midas bot start --agent --name <bot>hands them over asCARTO_SERVER,CARTO_USER,CARTO_PASSWORDandOPENAI_API_KEY, on top of the node's secrets; start the client with--connect "$CARTO_SERVER" --voice-agent(one quoted command after--runs as a shell line, so the variable expands on the node).
Landing
~/.claude/skills/finish-branch/land # what the finish-branch skill runs
midas project # what this project gates on (hub.conf `projects`)
midas project create <name> [--public] [--gate "…"] [--description "…"] # a new project the hub hosts
midas project set <owner/name> --gate "…" # change a hosted project's landing (--public is the person's)
midas project rename <owner/name> <new> # another name; the old one still clones and pushes
midas project delete <owner/name> # the person's, on the page: a key is told to ask
midas project show <owner/name> [path] # read a hosted project without a checkout; `log` for its commits
midas land status # who is landing, who is next (`midas status` too)
midas land targets [--pick +wasm] # which deploy targets this branch's landing builds
A landing builds the deploy targets whose files it changes, except optional
ones (hub.conf), which wait until a landing picks them or nobody is at work;
midas land targets proposes the set for "Shall it land?" and land --targets takes the answer. A landing gate goes before every session's own
claim in line for a node (behind deploys), and the holder hears that it waits.
Landing is rebase, gate, fast-forward push, and the push fails if anything else
landed since the rebase — the gate that just passed then tested a base that is
gone, and runs again. So a landing takes the turn first (midas land take) and keeps it until its push is done: one at a time, first come first
served, and a landing in progress is never overtaken by one that asked later.
The finish-branch skill does all of it, the same way for every project: the
turn, the project's pre-land check, a stop to read what moved on main when it
changed files the branch changes too, the rebase, the project's gate on a node
(midas take any --fastest-for <gate> when the session holds none: the free
node fastest at that command, a GPU node after one as fast), the pass recorded at the hub
(midas verified), the push, and --deploy. What is the project's is named in
hub.conf (hub.md).
A session does not wait to be told to land: when its work is done and
verified — the gate already green (land --verify-only) and, for a change that
can be seen, a picture shown — it asks the person "Shall it land?"
(AskUserQuestion, so it is one card on the hub's page) with the evidence in the
question. Before it, an impact panel ("Once it lands") says what landing it
changes, as the person and others will meet it, what it leaves alone, and any
step the landing does not take (a key, a setting, a deploy). The answers are also how a session ends — nobody archives one by
hand:
- Land it and finish:
land --finish. Once what it landed is live (at once in a project the hub does not deploy after landings), the hub ends the session and files it under Finished (midas sessions finish --sha). - Not yet: it asks what to change.
- Drop it:
midas sessions finish --drop: nothing lands, the session is ended and filed, its branch kept.
There is no "land it, keep working" among them: a session kept open after its
landing gathered the next wish, and the one after, and never ended (2026-10,
the sessions that landed and stayed open). A new wish written into the answer
that carries on the session's work stays in it: what is done lands without
--finish, and the wish is that person's "keep it open". Only a wish for wholly
new, unrelated functionality goes to a session of its own, and never on the
agent's word alone: it proposes one in a new-session panel and asks, and
starts it (midas sessions start) only on a yes (2026-11: sessions that started
others for every follow-up scattered the person's focus over several).
A session idle for three days is told, once, to ask the person whether to finish. A finished one is reopened from its page.
A git server on the hub's machine can tell the hub the moment a branch moves:
hooks/git-post-receive, installed as hub.md
says. The hub fetches its mirror at once and logs a pushed event.
The shared skills
commit, finish-branch and handover describe how a midas session works,
so they are the same in every project. They live in this repository
(skills/), carried in the binary with the session hooks (hooks/), and
midas claude install puts them in ~/.claude/skills and
~/.claude/hooks/midas-*, adding the hooks to ~/.claude/settings.json where
nothing runs them yet:
midas claude install # or bring them up to date; says what it changed
midas claude uninstall # take back what install put there
Every session start runs it (the session-start hook), as do deploy.sh and
midas update on the machine it runs on — so a machine's skills are its
midas's. It leaves alone a skill directory it did not write, and copies a file
changed since it wrote it to ~/.claude/backups/midas-<time>/ before
replacing it; settings.json is backed up beside itself before a hook is added.
~/.claude/midas-installed.json lists what it wrote.
Skills that only make sense in one project stay in that project's
.claude/skills/. Claude Code prefers a project's skill to a user one of the
same name, so a project can still replace a shared skill with its own.
Deploying
midas deploy sim # the tip of main: build on a node, publish here
midas deploy sim --sha 1a2b3c4d # an older commit, if it is on main
midas deploy # the targets, what follows landings, the last week's deploys
midas deploy --hold "why" # hold the deploys after landings; --release ends it
After landings, the hub deploys by itself every target hub.conf marks
after_landing (ship.rs): when the tip of main is not what a target was last
asked for, and no other landing is queued or running — that one would follow
minutes later, and one deploy carries both. A tip that has waited 30 minutes
goes anyway. It never deploys a commit without the gate's receipt, nor asks
again for one whose deploy failed (the next landing moves the tip), and it
waits while deploys are held: a hold ends when a person deploys by hand or
releases it. Three landings in an hour are then one build per target, not three,
and a session never deploys what it landed. Each project ships on its own: the
tip is its own main's, and a landing's card on Home shows live once every
such target of its project serves a commit that contains it; in a project
with none, on main is the end. A hold holds every project's.
A deploy publishes what has landed: the commit must be on the warm branch,
and it must carry the landing gate's receipt — finish-branch records one with
midas verified when it passes. A commit with none is deployed only with
--unverified "why", and the reason is logged. The hub then builds it on a node
from the target's machine, in a checkout of exactly that commit with nothing
beside it (taken like any agent takes one: it waits its turn), and publishes it
as root: the target's checks first, on this machine — the old one keeps serving
if one fails — then an atomic replace and the restart stamp. midas deploy
follows it and prints each step; --no-wait only queues it. What a target is,
and where it goes, is the hub's hub.conf (hub.md).
Carrying on later
midas later --in 1d "summarise the last 1,000 motions, check the file, land"
midas later --at 2026-10-30T09:00+01:00 "…" # a clock time says its offset from UTC
midas later --cancel
Nothing wakes a session once its turn ends but midas. A session started from
the page that promises work for later — the rest tomorrow, after a quota
resets, a task spread over days — sets the time with midas later (the MCP
tool session_later), saying what to do then in words it will read: at that
time the hub sends it that as a message, starting it again if it had ended.
One time per session; setting it again moves it, and a chain of them, each
turn setting the next, spreads work over days. The person sees it under
Scheduled and can start it now, move it or cancel it
(hub.md).
Waiting on the person
midas await "Paste a cartopolis.org token" \
--steps "1. Open https://cartopolis.org/tokens 2. New token, label midas pages, tick elevated" \
--secret remote:cartopolis-pages --url https://cartopolis.org/mcp
midas await "Add the A record for pages.cartopolis.org" --steps "…"
midas await --done # they gave it in a reply
A session that cannot go on until the person does something only they can —
paste a token, add a DNS record, register an OAuth app — says so with midas await (the MCP tool session_await) and ends its turn, rather than leaving it
as a sentence at the end of a message. The page lists it under Needs you,
landed or not, with the steps above its message box, until the person does it
(Tomorrow 9:00 puts it off, Won't do it declines), and midas tells the
session. With --secret the box has a field whose value goes to the hub —
remote:<name> a remote MCP server's token (--url when the hub has none
yet), bot:<node or group>:<NAME> a bot secret — and the session hears that it
is set, never what it is.
Root on the hub's machine
midas admin "restart caddy, which holds a stale certificate" --for 30m
midas admin # how it stands
midas admin --done # through with it
Where the hub's machine is set up for it (docs/hub.md, step 3), the agents'
user there has no root, until the person allows a window with their passkey:
the request is under Needs you on their phone, and a note tells the session
when sudo works and until when (UTC), or that they declined. End the turn
rather than wait. The window closes on time (the machine's cap is an hour),
on --done, or when the session ends, and with it every root shell from the
agents' logins. Say in the reason what root is for: it is what the person
signs, and what the machine's log keeps.
Working beside other sessions
Sessions share the workspace, and the hub carries notes between them; no agent sits
in the middle. A session gets its notes from the prompt and tool hooks (midas notes --hook, midas editing), at its next prompt or tool call, where the
agent reads them — never inside a subagent, whose parent reads them instead.
A note is read once the hook has printed it; one a hook gave up on before
then comes again with a hook a minute later. The commands it runs (every ssh <node>, take, wait, release) only say
how many wait: stderr of a background command is where notes used to be lost.
midas who # the sessions seen lately: name, branch, node, files, notes, last seen
midas say <session> "can you yield after this build?" # a note (n12); they get it with their next prompt or tool call
midas say --re n12 "yes, in ten minutes" # answer a note's sender, quoting it
midas say @mac-2 "done soon?" # to a role, resolved now: a node's holder,
midas say @waiting:mini "…" # everyone in line for a machine or node,
midas say @file:crates/geo/ "…" # every session changing a file (dir/: anything under it)
midas notes # yours, now
midas notes --sent # what you sent in two days: waiting, read at HH:MM, or expired
midas intent "cargo test --workspace" --minutes 20 # what you are doing with your node, for those waiting
midas yield # give the node back when your current ssh session on it ends
midas reserve migration --from 41 # the next number nobody else has: prints 42, or later
midas reserve --list # what has been handed out, to whom
midas todo add --for workstation "…" # an open end for the next session on that machine
midas todo list / midas todo done <id> [--note "…"]
midas take --node mac-1 --next --purpose "midas update" # its holder keeps it; then it is yours, not the queue's
midas ask "who carries on the routing work?" --option me --option them --with <session>
midas decide / midas decide d3 2 [--note "…"] # the person's side, also on the web page
midas stats --collab # per week: landings, failed gates, notes, overlaps, waits, idle holds
say takes a session the hub has seen in the last week (or one holding or
waiting for a node) and refuses any other name with the closest it knows; a
branch name, or Claude Code's worktree-<name>, is taken for its session. A
note to a hosted session that is idle is sent to it as a message too, which
wakes it; for a Remote Control session that looks idle, say names the
session_… id to wake it with. Notes nobody read are dropped when their
session ends (its session-end hook) or after two days, and each sender is told
once.
The hub adds its own notes: to a holder whose node somebody waits for while it
sits unused (five quiet minutes, then at most every quarter hour; five more and it goes to the line), and to both
sessions when they change the same files — each flush reports the files the
branch changes against the warm branch and the functions its hunks are in, the
tool hook adds each file the first time the session edits it (midas editing), and a new file in common is news once for as long as both sessions
last and neither lands. The note names what each side changes in the file
(src/a.rs (you: fn x; them: fn y)). Who should give way, or whether one session should carry on the other's
work, is for the sessions to propose and the people steering them to decide:
midas ask puts it to the person — on the web page with a button per option,
and to a phone that turned on notifications — and the answer
reaches the asking session and every --with session as a note.
A next turn (take --next) drains the node for you: whoever is in line passes
it over, its holder is told and keeps it as long as they need, and your own
claim takes it when they let go, which uses the turn up. Keep asking (midas wait, in the background) — a turn whose session stops waiting lapses after
two minutes, so a node is never drained for nobody. midas update --wait does
the same for a machine's owner: drains its nodes, tells their holders, and
updates once they are free.
Open ends are for work a session cannot finish where it runs: --for names
the caller (workstation, agent, … — which machine a session is on) or any.
The first session of that caller to start is shown them by its project's
session-start hook, which asks /v1/todos/take (cartopolis: .claude/hooks/workspace-todos,
plain curl, so it works before that machine's midas is updated) and is told to
do them first. They show on the web page, where one can be left or marked done.
The prompt hook names each session after the start of its first prompt, once;
the web page shows that name, the branch, and a link to the session on
claude.ai for a Remote Control worktree (bridge-cse_…). midas claude install wires all four hooks into ~/.claude/settings.json
(the shared skills); a workstation that already points it
at hooks/ in a checkout of this repository keeps that. The prompt and tool
hooks find midas on the PATH and do without GNU stat and timeout, so a
Mac runs them as they are.
Memory, shared. Claude Code keeps what a session learns (its memory) in a
directory named for the checkout's path, so the container, a workstation and
the deck each had their own. The hub keeps it instead, for every machine: each
repository's notes (by its origin, owner/name), and the workspace's, in
files named workspace--<name>.md (who the person is, how they like to work,
the machines and deploys), which every repository's sessions get. The prompt
hook merges the checkout's memory directory with the hub's at most every five
minutes, the tool hook as soon as a session writes a note, the session-end hook
once more; midas memory sync does it by hand, midas memory where names the
directory. A note changed on one side goes to the other, one changed on both is
the newer one's, and a removal travels too; the index (MEMORY.md) keeps its
lines and their order, and gains the new notes' lines. Reading it takes a
caller key, as changing it does: a node never sees it.
Seeing what is going on
midas status # who holds which node, for what, since when; the queue; what failed (--recent N: all)
midas log --since 2h # what happened: claims, sessions, warms, errors
midas explain <node> # one node's story
midas check # what is wrong (-v: every check); exit status = the problems that are yours
midas stats --since 30d # how long builds take, per command and node, first vs later; waits
midas stats reads the hub's history, kept for good (the log above keeps 90
days): every build session on a node, every take and how long it waited, and
how many nodes were in the pool. --node, --all (not only cargo) and
--json narrow or export it.
midas stats --since 30d --chart waits.svg draws it per day: the hours agents
spent waiting for a node, against the nodes in the pool, with a marker on the
day a node was added — the picture that shows what another machine buys.
midas stats --nodes --since 7d says what each node used instead: its memory
(the peak, the 95th percentile and the mean, against its limit), its load
against the CPUs it may use and how often it went past them, the least free
disk, the largest target/, the share of minutes a session was open, and OOM
kills. --step 1d (or 1h) gives a row per day through the window; --node
and --json as above. The hub keeps every node's minute readings 90 days
(usage/ in its state directory); a node samples its memory every ten
seconds, so a link's peak between two readings is not missed. It is what to
size a machine's nodes by: how many fit, and how much memory each needs.
On a build machine
midas node status # running? firewall? heartbeat, holder, build (no sudo)
sudo midas node restart # also: start, stop
sudo midas node logs -f # follow its log
sudo midas node shell # a shell inside, as the user agents work as
With one node on the machine the name can be left out. midas setup makes
midas a command, for sudo too through a link in /usr/local/bin; where
/usr is read-only (SteamOS) sudo does not find it, so there give the full
path: sudo /var/lib/midas/bin/midas node ….
Stopping or restarting cuts off whoever holds the node. Updating and removing:
node.md.
Running the workspace
midas nodes add <node> --machine <name> --address <wireguard ip> [--gpu] # a new node
midas nodes remove <node> # once nobody holds it
midas nodes rename <node> <new name> # once nobody holds it
midas nodes drain <node> --why "…" # out of the pool for a while
midas nodes undrain <node> # back in
nodes add picks the next free port on that machine. Then the machine's owner
runs the node setup. After nodes rename the owner runs sudo midas setup <new name>, which keeps the node's checkout, build directory and keys
(node.md). On the hub: callers, warm steps and updates
are in hub.md.