--- name: finish-branch description: Land a session's finished branch on main — ask the person "Shall it land?" with the evidence, check it does what was asked, read what moved on main, gate it on a build node, fast-forward main. Use when the work is done and verified (to ask), and when the person answers "Land it" or says to merge or land it. --- # finish-branch Land a branch, having first checked it is what was asked for — and only on the person's word: their answer to "Shall it land?", or their own "merge it", "land it", "merge to main". ## Asking When the work is done and verified, do not wait to be told: ask, with AskUserQuestion, so the question reaches the person on the hub's page (and their phone) as one card they can answer in a tap. Two things come before the question, because each, found after the person's "yes", costs them another round: - **The gate, green.** Run `land --verify-only` first (in the background, like the landing). A red gate is yours to fix now, not news for after the answer: 31 of 245 landings in two weeks of October failed at the gate or the pre-land check after the person had said yes. The pass is kept per commit, so when main has not moved by the time they answer, the landing does not run it again. - **A picture, for a change that can be seen.** Shown with `midas show`, and for a map or render change the before, after and reference beside each other. A visible change with no picture shown is not ready to ask about: the person judges what they see, and "slop" after a landing is a lost day. A hook refuses the card until one is shown since their last answer, or — for a change nothing draws — the card itself says `No picture: ` (in the question or the recommended option's description; the hook cannot see the message text sent with the card). **Look at it yourself first, as they will:** a view from the ground or at an angle for anything standing in the world (floating, sinking, gaps and wrong walls hide in a view from above), a video for motion, the phone's viewport for UI, the mockup or the reference beside it, rendered on a GPU node when colour or light is what changed. Of 190 landing cards answered "not yet" in the month to 2026-11-27, about 65 named what such a look would have shown. - **What it builds.** `midas land targets` says which deploy targets this landing changes, which it builds after landing (every changed one that is not optional, and any optional one whose `required_by` changed, such as the wire protocol a client shares with its server), and which changed ones it leaves to later. Propose the set in the evidence, with a word on why: a change the person wants to try in the browser needs the optional web client built (`+wasm`); a server fix does not. A built target costs minutes of a node; one left out goes once no session is at work, or with the next landing that picks it. **What landing it changes, first.** Before the evidence, write a fenced block of language `impact`, which the page draws as its own panel ("Once it lands"): - `### What changes` — what the person and others will see or do differently once it is live, step by step as they will meet it ("You ask during feedback… a new session appears in your list… only on your yes does the picture go into the deck"), in their words, not the code's; - `### What stays the same` — what it does not do, and its limits; - `### Before it works` — any step the landing does not take (a setting at the hub, a key, a host change, a deploy, a migration), or that there is none. The person decides on what the session's outcome means for them, not on what the diff touches: a landing question that gave only the evidence made them ask "so, how would it work when landed?" before they could answer (2026-11). Then put the evidence in your message just before the question, as short Markdown — what was asked, what the branch does, how it was verified (the gate and where it ran, other tests, the picture), and anything risky or touching another session's work. The question itself stays a line or two: **"Shall it land?"**, the project and branch, and the one thing to weigh if there is one — a phone shows it as a card, and a long one buries the choices. The options: - **Land it and finish** (recommended, when it is ready) — land with `--finish`: what the hub deploys after landings goes out with the next batch, and once it is live the hub ends the session and files it under Finished. Nobody archives anything by hand. - **Not yet** — ask what to change, and change it. - **Drop it** — nothing lands: `midas sessions finish --drop` ends the session and files it; its branch is kept. There is no "keep working" answer: a session that stayed open after landing took the next wish, and the next, and did not end. When the person writes a new wish into their answer ("land it, and also …"), weigh it — but first: - **A series they already said yes to.** When they asked for the work in parts (the steps of a plan, "doe alles"), or answered a landing with "land it and carry on" to the rest of it, each later part lands on its own green gate without a card: land it without `--finish`, say in a line what landed and where it is shown, and go on; ask "Shall it land?" for the last part, and for any part whose result is a matter of taste (a look, a text). s839 asked 26 times in one series and heard "land it" 26 times, s834 23 times. Then: - **It carries on this session's work** — a follow-up, a fix, the same feature in its docs, a slide or another project (add that project here). This is the usual case: land what is done without `--finish`, do the wish here, and ask "Shall it land?" again when it is done. Their wish is their word to keep the session open for it, and for nothing after it. - **It is wholly new functionality, unrelated to this session's work** — rare. Do not start a session yourself: write a fenced block of language `new-session` (`### The wish`, `### Why apart`, `### Builds on`, `### Recommendation`), which the page draws as its own panel, and ask with AskUserQuestion whether to start one. On their yes, land with `--finish` and run `midas sessions start --project "…"` — their words and what it builds on — and tell them its id; on "keep it here", treat it as above. **A question in their answer is answered, not asked over.** When the person's "Other" asks something ("looks good — what is X for?"), they have not said yes or no: answer it in your message, as visible text, and end your turn without asking "Shall it land?" again. Their next message is the answer to the landing — "land it" lands, anything else is a "not yet". An agent that put its answer only in its thinking and opened the same landing card again left the person with no answer and a second card to dismiss (2026-11-19). Land without `--finish` otherwise only when they say, in their own words, to keep this session open — or when what landed still needs a step only the person can take before this session's task is done (a token, a DNS record, an OAuth app). Then land without `--finish` and declare that step with `midas await` (the `session_await` tool), `--secret` for a token, before your turn ends. Said only in prose, the session sat under "Landed today" with the step undone and listed nowhere (2026-11-14); declared, the page lists it under Needs you until the person does it, and midas tells you when. With the session's autopilot on, it answers this question for them, from the evidence you give: one with the gate's pass in it is one it can decide. When the targets are a real choice (an optional one changed, or the person may want one left out), name the proposal in the question ("builds sim, web; wasm later") and let the answer change it: land with `--targets +wasm`, `-apk`, or a list (`sim,web`), as `midas land targets --pick` takes it. The person's "Other" answer may say which. Holding the deploy is not one of the answers: the person holds deploys on the Workspace page. Land with `--hold-deploy "why"` only when they ask for it. The person's answer is their word for this landing, and for nothing after it: a branch changed since asks again. ## A session in several projects A session started from the page can work in several projects, a worktree of each in its folder (`project_add`). Ask once, for all of them, naming each project and what its branch does. Then land each from inside its own worktree, **the one depended on first**: each landing must stand on its own on main, because the second can still fail its gate after the first is in. With "Land it and finish", pass `--finish` to every landing; the hub finishes the session once all of them are live. A project with nothing to land is left out. ## Order **1. Check what the branch was *for*.** Re-read what the person asked for in this session, the commit bodies (`git log origin/main..HEAD`) and, if the branch was handed over, the handover note. A branch drifts across sessions; if what you are about to land no longer matches what was asked, this is a conversation, not a merge. **2. Confirm it is finished.** Nothing left stubbed, the open questions answered, the verification actually run — not merely claimed in a commit message. A `wip:` commit is a handover's sweep and is refused (see the `handover` skill). **3. Land it**, in the background — the wait for the turn and the gate are part of the run: ```bash ~/.claude/skills/finish-branch/land --verify-only # gate only, push nothing: before asking ~/.claude/skills/finish-branch/land --finish # land; finish the session once live ~/.claude/skills/finish-branch/land # land; open on the person's own word ~/.claude/skills/finish-branch/land --finish --targets +wasm # land; build the optional web client too ~/.claude/skills/finish-branch/land --hold-deploy "why" # land; on main, not live ~/.claude/skills/finish-branch/land --deploy sim # land, then `midas deploy sim` ``` `--deploy` is only for a target the hub does not deploy after landings (`midas deploy` lists which it does): those go out by themselves, once no other landing is in line, so one deploy carries every landing of the hour. It refuses a dirty tree, a detached HEAD and a branch with a `wip:` commit, and otherwise: 1. takes **the turn to land** at the hub (`midas land take`; `midas land status` shows the line) and keeps it until its push is done, so a landing in progress is never overtaken and its gate never tests a main that another landing has already moved; 2. fetches main and runs the project's **pre-land check**, if it has one; 3. **stops when main changed a file this branch changes too** (exit 4), naming the commits. Read them — `git log -p` as it prints — for what git cannot see: a number main took, a function it renamed, a meaning it changed. Then re-run with `--seen ` as it says. Landings collide in ways that merge clean; 4. rebases onto main (a conflict stops it: resolving one is a judgement about two people's work), runs the project's **gate on a build node** — the one this worktree holds, else the free one fastest at this gate — and records the pass at the hub (`midas verified`, which `midas deploy` asks for); 5. holds the deploys after landings if `--hold-deploy` says so, pushes the branch, fast-forwards main (never forced), gives the turn back, deploys what `--deploy` names, and with `--finish` asks the hub to finish the session once the landing is live. Keep the node you worked on: releasing it first only buys a wait. ## The project's part The gate, which nodes may run it, the pre-land check and the name of main are the project's, kept at the hub (hub.conf `projects`) and read with: ```bash midas project # all of it, for this checkout's repository midas project --get gate ``` A project with no gate is refused; `--allow-unverified` lands without one and exists to be visible in a transcript on the person's explicit word, not to be routine. A project that needs a landing of its own keeps a `finish-branch` skill in its repository's `.claude/skills/`, which takes precedence over this one. Follow the `commit` skill for any fixup commit along the way, and run this from the session's own worktree: a checkout several sessions share always has somebody's work in it.