# Using midas - [Building on a node](#building-on-a-node) — agents - [Running a bot](#running-a-bot) — agents - [Landing](#landing) and [the shared skills](#the-shared-skills) — agents - [Seeing what is going on](#seeing-what-is-going-on) — anyone - [On a build machine](#on-a-build-machine) — its owner - [Running the workspace](#running-the-workspace) — the operator ## Building on a node ```bash 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: ```bash midas take # any free node; or: midas take gpu / midas take ssh 'cargo test' # runs in the node's checkout scp :/tmp/out.png . # fetch what it made midas release # give it back ``` - **Your worktree goes with you.** Every `ssh`, `scp` or `rsync` to 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 take` waits 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 N` keeps 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 as `MIDAS_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. `cargo` refuses to build outside a node and says which `midas run` (or, on a node you hold, which `ssh`) to use (`MIDAS_LOCAL_BUILD=1` for a one-off). - **"You" is your worktree**, by its name. `--owner ` (on any command, or MIDAS_OWNER) acts as another: the landing gate holds its node as `gate-`. An agent's machine needs `~/.config/midas/hub.env` ([hub.md](hub.md#3-give-the-agents-access)) 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](#the-shared-skills)). ## 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: ```bash 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 start` in the background.** The first `cargo run` on 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 status` shows 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`: ```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 renew` from 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; `--env` names the variable, default `CARTO_TOKEN`) gives every GPU node's bots one, kept by the hub and handed to the bot when it starts — a node, a machine or `any` work too, and `--list` names 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](node.md#bot-credentials)), 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 ` hands them over as `CARTO_SERVER`, `CARTO_USER`, `CARTO_PASSWORD` and `OPENAI_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 ```bash ~/.claude/skills/finish-branch/land # what the finish-branch skill runs midas project # what this project gates on (hub.conf `projects`) midas project create [--public] [--gate "…"] [--description "…"] # a new project the hub hosts midas project set --gate "…" # change a hosted project's landing (--public is the person's) midas project rename # another name; the old one still clones and pushes midas project delete # the person's, on the page: a key is told to ask midas project show [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 ` 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](hub.md#each-projects-landing)). 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](hub.md#6-hear-about-pushes) 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: ```bash 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-