garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

.. /src/session-start.md

raw

Builds run on a build node, over ssh. @FIRST@ @FREE@ of @TOTAL@ nodes free.@NOTE@

midas run -- cargo test -p …      # a node for this one command (or: midas run gpu -- …)
scp <node>:/tmp/x.png /tmp/       # fetch what it wrote, within a minute of the run

Run builds with midas run: it takes the fastest free node for that one command, sends your worktree, runs it, exits with its status, and lets the node go a minute later if somebody waits. Nobody holds a node while reading and editing, so the line is short. It waits in line for as long as it takes: run it in the background when it may wait or build long, and end your turn or do other work: its end comes to you as a notification, so never sleep-poll its output file (206 such loops in a month, half of them refused). midas take holds a node for longer — for a bot, a running client to drive, or a series of commands that must share one node — and ssh <node> … then runs on it.

A node is a contained checkout with its own warm build directory on a build machine, held by one session at a time. It follows your worktree: every ssh, scp or rsync to it first sends your new commits and uncommitted edits, so edit here and run there. Commands start in the checkout. ssh refuses a node this worktree does not hold, and cargo refuses to build here.

If none is free, midas take waits 90 s and then exits 75 with your place in line kept: run midas wait in the background to get the node when it frees. A node with no ssh session open for 30 minutes goes back to the pool; the session-end hook gives it back too. midas status shows who holds what, midas log what happened. A command there that prints nothing and uses no CPU for 30 minutes is stopped, which ends your ssh and says why (MIDAS_STALL=off or =2h as its first word for one meant to wait), and a process left behind holding a command's output no longer keeps its ssh open. A stopped command is yours to solve at once, without asking the person: find what it waited for, fix that, run it again.

Subagents. A subagent in this worktree shares its node: it can ssh there too, but every ssh first re-syncs the node, so two agents running commands there at once change files under each other's build — midas holds back the sync while a command of this worktree still runs there (MIDAS_SYNC=force sends it anyway): a build or test started meanwhile waits up to a minute for it, then gets the edits, or is refused rather than run on old files. A subagent in a worktree of its own (isolation: "worktree") cannot use this session's node and may not take one: give builds back to this session.

Other sessions share the workspace, and midas carries notes between you. midas who lists them: name, label, branch, node, the files each changes, and when it was last seen. Notes reach you as "Notes from the build workspace" at your next prompt or tool call (lines starting midas: in a command's output only say how many wait; midas notes reads them now): somebody waits for your idle node, another session changes the files you change, or a session writes to you. Answer with commands, not by waiting: midas say <session> "…", or midas say --re <note id> "…" to answer a note — or to a role, resolved when sent: @<node> its holder, @waiting:<machine> those in line, @file:<path> whoever changes it — midas yield (give the node back when this build ends), midas intent "what" --minutes N. midas notes --sent shows whether yours were read. Need one node in particular, and soon? midas take --node <n> --next --purpose "why": its holder keeps it, then it is yours. Before taking a number two branches must not share — a migration, a wire message kind — get it from midas reserve <namespace> --from <highest on your branch>.

When another session changes the files you change, agree with it who changes what (midas say). What only the person may decide — who gives way, whether another session carries on your work or you on theirs — put to them with midas ask "…" --option A --option B --with <session> and carry on with what does not depend on it; the answer comes as a note. Never fold sessions on your own; the handover skill moves a branch once they have.

The nodes: @NODES@

A node without a GPU renders on the CPU (llvmpipe): right for geometry, placement and visibility, but seconds a frame and no evidence about colour, lighting or frame time. midas run gpu -- … (or midas take gpu) when the work needs a real GPU.