Skip to content
quarry Documentation
Login

Documentation

Summary

Landing a branch through the forge works, and takes too much knowing and too many approvals. A person's coding agent needed a named agent account, a role, a token per scope and a sign-off for most steps.

This RFC makes the forge work the way gh auth login and gh pr merge --auto do. quarry login runs once per machine: the browser shows one page with one Approve, and a token that acts as the person is stored in that machine's keychain. Any agent on the machine then pushes, opens landings, arms them and lands on green as the person, with no further approval. The person's own rights are the ceiling, a red check is never overridden by a token, and each machine's token is one row in the person's token list, revocable alone.

Around that: every refusal names the next step, every open landing says what it waits on in one sentence the forge composes, a stack is tested once at its top, and a small client, quarry, has five verbs: login, whoami, land, status and api. The guides lead with the client, and each line of them that names a command or a permission is run by a test.

Nothing changes on the Fossil wire.

Motivation

On 2026-11-20 one agent tried to push a stack to a repository and land it on green for its person. What it met:

  1. Its push credential, made by setup kind push, could not call the API. The API answered a bare 401, counted each retry as a failed sign-in, and locked the address out (#458).
  2. A second token, minted with the repository written OWNER/NAME, reached no repository and failed the same silent way (#462).
  3. A read credential could not open a landing, and nothing short of three grants let the agent arm one (#459, #461).
  4. Three arming requests were approved and armed nothing: the call without on disarms, and the approval read as success (#463).
  5. A merge conflict arrived as a failed check with no run id (#460).
  6. The landings had been opened locally and never pushed (danmestas/zit#356).
  7. A stack of five queued about ten runs of eight minutes each on a runner that takes one at a time (#464).
  8. An armed landing that was only behind its target sat until someone updated it by hand, and a green rung held by its stack said nothing (#466, #467).

The owner, that morning:

We need to prioritize making it super easy for the human. I want to do one thing, be okay that it's done, and know what that is.

The first text of this RFC answered with a narrow standing grant per agent, repository and branch. The owner accepted it, used the forge for the rest of the day, and then said:

I accepted everything and I'm getting frustrated with this. In gh I just tell my agent to land on green CI and it does so as me, so we need a plan to make this at least as seamless. All of these approvals and stuff are no bueno, and I'm getting too many named agents to follow.

So the bar is gh: one sign-in per machine, then the agent acts as its person. A grant per goal is still an approval per goal and a named agent per repository, and both are what went wrong.

The other causes stand:

Principles

Each is a rule a change passes or fails, with the test that holds it and the build step it lands with.

  1. Every refusal names the next step. A 401, 403, 404 on a known route, 409 or 429 body carries next. Test: a walk of the op registry fails for a refusal path without one (step 12).
  2. One consent per machine, one place to revoke. Test: the journey counts approvals; a machine that takes more than one to push, open, arm and land fails (step 5).
  3. One sentence, said everywhere. What a machine's token may and may not do is generated from the token's record. Test: the approval page, whoami and the token's row carry the identical string (step 3).
  4. The person's own rights are the ceiling. The token is the person less a fixed list, never more. Test: for every op, a call on a machine token is admitted only where the same person signed in would be (step 1).
  5. Asking never makes things worse. A valid credential at the wrong door is told what it is and is not counted as a failed sign-in (landed, #458).
  6. Every wait names who or what it waits on. Test: over a matrix of landing states, no open landing lacks waiting.on and a non-empty next (step 6).
  7. A command finishes the goal or says what is left. No exit 0 with a silent second step. Test: each client verb's journey ends in "done" or in a next line (step 5).
  8. What the client does, curl can do. The client holds the token and calls zit; rules and sentences live in the forge. Test: the client prints the server's next and waiting.say byte for byte, and a build check refuses a sentence template under the client's package (step 3).
  9. A doc line that names a command or a permission is run by a test (steps 14 and 15). A next names a client command only once the client has that verb.
  10. Answer on the surface already in hand. This RFC adds no page: every step names the existing page, op or download it changes. Held in review, not by a test.
  11. The forge tells the asker; nobody polls the person. When a landing is armed, lands or stops, or a request is decided, the account that acted is told on its own me.attention stream at once, with what took effect and which token did it. quarry status --watch and quarry land --watch follow that stream, never a polling loop. Test: for each landing transition in the step 6 matrix the stream carries one event naming the new state, and the client's watch exits on it (steps 4 and 6).

Design

quarry is the client. Each example shows the whole output. The repository dmestas/website and the machine mac-mini are placeholders.

Acting as the person

quarry login is the forge's gh auth login.

$ quarry login
Open https://zeitforge.app/setup/KQ4T-9XWM and approve   (10 minutes)
Waiting for your approval ...
Signed in to zeitforge.app as dmestas, on mac-mini.
  may      what you may: push, open landings, arm them, land on green
  may not  override a failed check; change your password or tokens;
           approve requests
  token    "mac-mini" in the login keychain; ends after 90 days unused
  revoke   https://zeitforge.app/me
Next: quarry land

One approval. The client makes a pickup key and starts a setup of kind me (setup/start, RFC 0030), sending a label. The link opens one page for a signed-in person: the code to compare with the terminal, the label, the sentence, one Approve. There is no agent name, no repository to pick and no second request to approve. The token is collected by pickup and never shown in a browser or printed.

The token. One token on the person's own account.

Acting. A call on the token is a call by the person. Roles, branch ownership and repository visibility are read for the person at every call, so the token never outlives or exceeds them. Landings it opens are the person's; arming and accepting are the person's.

Limits. A machine token cannot:

Each refusal carries a next naming the signed-in page where the person does it themselves.

One list, one revoke. /me already lists the person's tokens (me.sync.token.list). Each machine token is a row there: label, scopes, made, last used, and Revoke (me.sync.token.revoke with its id). Revoking one leaves the rest working, takes effect on the next call, and disarms the landings that token armed.

Audit. Every write made with a machine token records the person and the token: "accepted by dmestas via mac-mini token" on the landing, the timeline and the settings log. It is never recorded as an agent account.

Named agents. An agent account is for an unattended bot that must not be a person: a CI runner, the forge's own agent. Nothing creates one by default, and quarry login never does. Setup kinds push and read, agents and Quarry-Ask sign-offs (RFC 0027, 0028, 0030) remain for a credential deliberately narrower than its person. They are no longer how a person's coding agent works.

Migration. Agents that were made per repository only so a person's coding agent could push or land are retired by that person once the machine has run quarry login: Your agents lists each with its last use, and retiring one revokes its tokens. Nothing is retired automatically. docs/agents.md carries the note (step 15).

Security invariants

Each has one test named for it, landed with the step given. Step 2 ends with a reviewer who did not write steps 1 and 2 trying each one; every finding becomes a test.

  1. A landing is recorded as the person. A landing accepted or armed with a machine token names that person, with the token's label as the audit detail, never an agent account (step 2).
  2. The person's rights are the ceiling. No op admits a machine token where it would refuse the same person signed in, and a right the person loses is lost by the token at the next call (step 1).
  3. It never lands over red. An accept by a machine token needs every required check on the target green for the exact check-in that would land. Pending, stale, never-ran and conflict all refuse, override is refused, and the sweep re-reads the checks, the person's right and the token when an armed landing lands (step 2).
  4. It never writes a checked branch over sync. On a protected branch with required checks, a machine token's pushed merge is refused as a non-owner's is (step 2).
  5. It cannot widen or keep itself. It cannot change the account's password, email or sign-in methods, mint or replace a token, approve anything, or sign in to the web (step 1).
  6. It is revocable in one place. One row, one Revoke; the next call is refused and what the token armed does not land (step 2).
  7. Every action names its token. No write made with a machine token is recorded without the token's id and label (step 2).

Unchanged and relied on: a token value is never printed or passed through a person, approval happens only in a signed-in browser or the phone app, and a start lapses ten minutes after it is made.

Refusals carry next

writeError and writeCodedError take an optional object:

{"error": "this is a sync token; the API takes an api token",
 "code": "wrong_scope",
 "next": {"say": "Sign this machine in once; it then pushes and calls the API as you.",
          "call": "POST /api/v1/setup/start",
          "cmd": "quarry login",
          "ask": false,
          "help": "/llms.txt#credentials"}}

say is one sentence. call is the API call that takes the next step. cmd is the client command for it, present once that verb ships. ask says whether the same call sent with Quarry-Ask would be admitted. help is an anchor, never the top of a page.

What a landing is waiting on

landing.get and landing.list gain

"waiting": {"on": "checks", "say": "check \"test\" is running, 2m",
            "who": "", "next": {...}}

on is one of checks, conflict, approval, stale, never_ran, stack, protection, nothing. The server composes it from fields that exist. The landing page's header, the email and the push notification print say.

$ quarry status !43
!43  parse-docs -> trunk   open, not landing
  blocked   conflicts with trunk in internal/web/web.go, docs/api.md
  next      zit merge trunk, resolve, zit commit, quarry land

A stack is tested once

An open stack gets one run: its top merged onto the stack's target. When that passes, every rung is green by inclusion. Branch runs and pair runs of the rungs below are not queued. A moved rung restarts the top's run and no other.

Green by inclusion holds only for landing the stack whole. A rung that is to land without the rungs above it, or that leaves the stack, gets its own run against the target first, and waiting says so (stack, then checks), so a held rung is never silent (#467) and no check-in reaches a branch that was not tested as the thing that landed.

The client

Five verbs in a new internal/forgeclient beside internal/pickupclient, in the quarry binary and in the small static download the forge serves at /runner/. That download becomes quarry, a client-only build; quarry-runner stays as an alias.

Verb Does
login [URL] [--label NAME] Makes a pickup key, starts a setup of kind me, prints the link, waits, collects, stores the token in the keychain, saves the zit remote and login
whoami me.account and the sentence: who, which token, may not, token life, revoke link
land [BRANCH\|!N] [--stack] [--watch] Pushes if the forge lacks the tip, opens a landing if none is open, arms it, says what it waits on
status [!N] [--watch] [--log] Prints what the landing waits on; --watch follows the event stream to the outcome; --log prints the failed step's tail
api METHOD PATH [-d JSON] Any op with the stored token, never on the command line
$ quarry land --stack
Pushed 3 branches to dmestas/website.
  !41  parse-fix     -> trunk   opened
  !42  parse-tests   -> !41     opened
  !43  parse-docs    -> !42     opened
Armed. The stack lands itself when its top is green (build, test).
Follow it: quarry status !43 --watch

Rules:

zit lists login, land and status as pass-throughs, the way zit ui runs quarry ui. The code is quarry's: zit carries no forge call, no token store and no pickup, and a stock fossil user lands without zit.

Guides proven by code

Fossil compatibility

No wire change: no new card, artifact, pragma or sync behaviour. A machine token is a login and a password to a Fossil client, as a push token is today, and its limits, waiting, next and the stack run are forge records and API fields outside the repository. The one sync decision added is a refusal a stock client already meets: a pushed merge onto a protected branch, refused with a readable message. A stock fossil user pushes a branch with fossil and runs quarry land BRANCH.

Landed

Not repeated as steps:

Work Holds
next on errors; wrong_scope and the 429 hold carry it; a wrong-door token is not counted toward the lockout (#458) Principles 1 and 5
OWNER/NAME resolves on token and grant ops; empty reach is a 403 that says so (#462) Principle 1
landing.auto requires on; a decided request says what happened, in the past tense (#463) Principle 11
A token is replaced with one approval; a repository-limited token reads its own sign-offs Narrower credentials

Build order

Each step is one landing and lands alone. "Sign-off" marks a step that changes something a person sees: the owner approves the real output on real data before it lands. "Needs" lists earlier steps; a step with none can start now.

Stage A. Acting as the person

  1. A person mints a token as themselves, by pickup. Sign-off for the approval page. setup/start takes kind me and a label and makes no agent; one page with one Approve mints a token on the approving person's account, scopes sync and api, labelled, collected by pickup; the fixed limits on the account, tokens, approvals and site administration; the token is a row in me.sync.token.list with its label, revocable by id. Test: an approved start yields a token whose me.account is the person, that pushes with zit and calls the API; invariants 2 and 5; revoking it leaves the person's other tokens working. Needs: none. Closes #459.
  2. Recorded as the person; never over red. "accepted by PERSON via LABEL token" on the landing, the timeline and the settings log; override and a pushed merge onto a checked branch refused; the sweep re-reads checks, right and token; a revoke disarms. Then the review of the invariants. Test: invariants 1, 3, 4, 6 and 7. Needs: 1.
  3. forgeclient, the client-only build, login and whoami. The /runner/ download becomes quarry with quarry-runner as an alias. From here a next may carry cmd. Test: against a test forge, login ends with a stored token and no value on the terminal; principle 3; principle 8's build check. Needs: 1.
  4. land and status. status prints the landing's state and checks as the server gives them, and waiting.say once step 6 lands. Test: from a checkout with an unpushed branch, one command ends with the landing open and armed as the person; --stack opens a chain and arms it; --watch exits when the landing lands; a refusal prints the server's next. Needs: 2, 3. Closes #461.
  5. The journey runs in CI. A cold machine given only the forge's address: login, one approval, land, landed on green, recorded as the person. Approvals counted. Test: principles 2 and 7. Needs: 4.

Stage B. What it is waiting on

  1. waiting on landing.get and landing.list. Test: the matrix of principles 6 and 11. Needs: none.
  2. Conflict as a state, the update preflight, and runId on every check. Test: a conflicting branch reads waiting.on: conflict with its files and has no failed check; landing.update refuses beforehand and names them; every check has a run id that fetches its log. Needs: 6. Closes #460.
  3. An armed landing updates itself when the merge is clean. In flight. Test: an armed landing three check-ins behind lands with no call from anyone; one that conflicts reads conflict. Needs: none. Closes #466.
  4. The landing page, email and push print waiting.say. Sign-off. Test: one landing in each state shows the same string on all three, by data hook. Needs: 6, 7.

Stage C. A stack is tested once

  1. One run at the top. In flight. Rungs green by inclusion; branch and pair runs of lower rungs not queued; a moved rung restarts only the top's run. Test: a five-rung stack queues one run; moving rung two cancels and queues one. Needs: none.
  2. A rung landing alone is tested alone, and a held rung says so. In flight. Test: accepting rung one of a green stack by itself does not land until its own run is green; a rung held by its stack reads waiting.on: stack. Needs: 6, 10. Closes #464 and #467.

Stage D. The rest of the refusals, and api

  1. ask on a 403, the local-only and forge-path hints, and no refusal without next. Test: the registry walk of principle 1; the 404 on a 64-hex landing id and the sync refusal on a protected branch each carry their next. Needs: none.
  2. quarry api. Test: a call lands with the stored token, and the token never appears in the process list. Needs: 3.

Stage E. Guides proven by code

  1. GET /api/v1 carries letters, machine-token reach and askability; the permission table test. Test: changing an op's Caps without the guide fails. Needs: 1.
  2. The guides lead with the client, and the migration note. /llms.txt, docs/agents.md and docs/landings.md as under Guides proven by code; when an agent account is still right, and how to retire the per-repository ones. Test: extracted commands run green; /llms.txt is shorter than at the start of this RFC. Needs: 5, 14.

Stage F. The zit seam (landed in zit's repository, tracked there)

  1. zit landing open pushes, or says plainly that it has not. danmestas/zit#356. Needs: none.
  2. zit landing accept with a saved remote says it merged locally and that no forge gate was consulted. Needs: none.
  3. zit login, zit land and zit status pass through to quarry. Needs: 4.

Done means #398's own test, for landing: a cold agent given only the forge's address lands a branch on green as its person, with one approval and no question to anyone. #398 and #434 stay open for their other items.

Not in this RFC

Decisions

Settled by the owner on 2026-11-20 ("Yes, build it all"), and standing:

  1. The forge workflow lives in a small quarry client. zit lists login, land and status as pass-throughs, the way zit ui runs quarry.
  2. A valid token at the wrong door is not counted as a failed sign-in.
  3. The verbs are login, whoami, land, status and api. The download is quarry, client-only, with quarry-runner kept as an alias.
  4. No approving from the terminal. Approval stays on the web or the phone; the terminal prints the link, waits, and prints the outcome.
  5. /llms.txt leads with the client; the wire format is one link away and still tested.

Settled by the owner later on 2026-11-20, superseding the first text's decisions 2, 3 and 4 (the land grant, what it covers, setup kind land) and its decisions 10, 11, 12, 14 and 15, which only served them:

  1. The gh model. quarry login runs once per machine with one browser approval and mints a token that acts as the person, with sync and api scopes, kept in that machine's keychain and labelled by machine or session. Any agent on the machine pushes, opens, arms and lands on green as the person with no further approval.
  2. The person's own rights apply and are the ceiling. Protected branches still need their required checks green, and nothing overrides a red check unless the person does it themselves, signed in.
  3. Landings land as the person. A landing accepted or armed with a machine token is recorded as that person, with the token and machine as the audit detail, never as an agent account.
  4. A person's machine tokens are one list under their account, each revocable alone.
  5. Named agent accounts are for unattended bots that must not be a person. Nothing creates them by default. Per-repository agents made for a person's coding agent are retired, with a migration note; narrower credentials and Quarry-Ask sign-offs remain for what they alone do.

Decided here, reversible:

  1. next carries the API call from the start and the client command only once the verb exists. Reason: a refusal must not name a command nobody can run.
  2. A machine token cannot change its account's password, email or sign-in methods, mint or revoke other tokens, approve requests, or sign in to the web. Reason: a token copied off one machine must not be able to keep the account or approve its own asks.
  3. A machine token does not administer the site or delete a repository. Reason: neither is part of pushing and landing, and gh leaves deleting a repository out of its default sign-in too.
  4. A machine token lands on a protected branch with required checks only through the forge, never by a pushed merge. Reason: otherwise "never over red" holds on one door and not the other.
  5. Revoking a token disarms what it armed, and the checks, the person's right and the token are re-read when an armed landing lands. Reason: a token is revoked because its machine is no longer trusted.
  6. One label holds one live token; logging in again replaces it. Reason: the list stays one row per machine.
  7. Testing a stack once (#464) is its own stage. Reason: "green" for a rung has to mean one thing before anything lands on it unasked.