Skip to content
quarry Documentation
Login

Documentation

Summary

Landing a branch through the forge works, and takes too much knowing. "Let my agent land on green" is held as three unrelated records, the workflow is 400 lines of curl in a guide, a refusal states a fact and stops, and nobody can read in one line what a landing is waiting on.

This RFC changes five things. 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. One narrow standing grant exists: agent A may land onto branch B of repository R when B's required checks are green, asked for and approved as one sentence and revoked in one place. And a small client, quarry, has five verbs: login, whoami, land, status and api. The guides then 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. The guide was wrong about who may read a CI log.

Each was answered that day by somebody who knew the code. The owner:

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.

and

In the future, my users won't be able to just call you and ask you for what they need.

So the forge has to hold the answer itself, at the moment of asking.

The eight symptoms have five causes:

Principles

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

  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 2).
  2. One goal, one consent, one place to revoke. Test: the journey tests count approvals; a named goal that takes more than one fails (step 20).
  3. One sentence, said everywhere. What an agent may and may not do is generated from the grant record. Test: the approval page, whoami, the agent's page and the email carry the identical string for one grant (step 14).
  4. An agent never holds more than the sentence said. The token's scopes, reach and ceiling are derived from the record that renders the sentence. Test: for generated grants, the minted token's limits equal the derivation, and no call sets them beside it (step 11).
  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. Test: fifty wrong-door calls on a valid token leave its address unheld (in flight, #458).
  6. Every wait names who or what it waits on. Test: over a matrix of landing states, no open landing and no pending request lacks waiting.on and a non-empty next (step 5).
  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 20).
  8. What the client does, curl can do. The client holds credentials 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 16).
  9. A doc line that names a command or a permission is run by a test. Test: commands in /llms.txt and docs/agents.md are extracted and run against a test forge; permission claims are a table checked against the registry (steps 21 and 22). A next may name a client command only once the client has that verb (step 16).
  10. Answer on the surface already in hand. This RFC adds no page: every step below names the existing page, op or download it changes. This one is held in review, not by a test.
  11. The forge tells the asker; nobody polls the person. When a request is decided, a landing is armed, lands or stops, or a grant changes, the account that asked or opened it is told on its own me.attention stream at once, with what took effect, so neither an agent nor its person repeats "you need to do X" after X is done. quarry status --watch and quarry land --watch follow that stream, never a polling loop. Test: for each decided request and each landing transition in the step 5 matrix, the asker's stream carries one event naming the new state, and the client's watch exits on it (steps 7, 18 and 20).

Design

quarry is the client. Each example shows the whole output. The repository dmestas/website is a placeholder.

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": "Get an api credential for this agent with one approval.",
          "call": "POST /api/v1/setup/start",
          "cmd": "quarry login --for land",
          "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 (from the admission check in internal/api/ask.go). help is an anchor, never the top of a page.

Particular refusals:

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. who names the person an approval waits on. 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 no check-in reaches a branch that was not tested as the thing that landed.

The land grant

A new, narrow record beside branch protection:

agent A may accept landings onto branch B of repository R, through the forge's accept path, when every required check on B is green.

It carries the agent, the repository, the branch, what it covers, who granted it and when. landing.accept, landing.auto and landing.land admit a caller who holds i as now, or a matching grant. The agent's role does not carry i.

Getting one. Two ways, both one approval:

The token of kind land. One token, scopes sync and api, reaching the one repository. Its ceiling is fixed by the kind and is not an input: the developer role's letters, with those needed to open and comment on landings and to read CI; never i, never a. This amends RFC 0030 decision 5 for this kind only: that decision makes a pushing credential sync only, and here one credential both pushes and calls the API, so there is one thing to hold and to revoke and the consent page states both scopes. No browser sign-in is possible with it.

The sentence. One struct holds the grant. It renders the sentence and derives the token's scopes, reach and ceiling; nothing else sets them. The required checks are read from B when the sentence is rendered, so it stays true as they change.

website-land may push branches to dmestas/website, open landings, and land its own and yours on trunk when its required checks (build, test) are green. It may not land over a failed check, change settings, or reach any other repository. Revoke any time at Your agents > website-land.

Security invariants

The land grant keeps each of these. Each has one test named for it, landed with the step given, and step 15 is an adversarial review that tries to break them before kind land is offered on the forge.

  1. It never lands over red checks. A grant admits an accept only when every required check on B is green for the exact check-in that would land. Pending, stale, never-ran and conflict all refuse (step 12).
  2. It never uses override. override on any accept call by a grant holder is refused, and a grant is not among the things that satisfy an override's own check (step 12).
  3. It never writes the branch over sync. The sync front does not read grants. A grant holder who pushes a merge to protected B is refused exactly as before (step 12).
  4. It is refused when the branch has no required checks. At grant time, with the next step ("trunk has no required checks, so this would let A land anything; set them at ..."), and again at land time if they were removed since (steps 11 and 12).
  5. It is revocable in one place. One control ends the grant and the token; an armed landing does not land afterwards (step 14).
  6. The sentence and the limits have one source. The sentence the person approves is generated from the same record that sets the token's scopes, reach and ceiling (step 11).
  7. It never exceeds the grantor. A grantor who can no longer accept onto B grants nothing; the grant stops working without being deleted, and says why (step 12).

Unchanged and relied on: setup cannot grant admin, a client cannot choose its own ceiling, a token value is never printed or passed through a person, and approval happens only in a signed-in browser or the phone app.

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 of it.

Verb Does
login [URL] [--for land\|push\|read] Makes a pickup key, starts a setup, prints the code and link, waits, collects, stores the token in the OS keychain (a 0600 file where there is none), saves the zit remote and login
whoami me.account and the sentence: may, may not, token life, revoke link
land [BRANCH\|!N] [--stack] [--watch] [--ask WHY] 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 waiting; --watch follows the event stream to the outcome; --log prints the failed step's tail
api METHOD PATH [-d JSON] [--ask WHY] Any op with the stored token, never on the command line
$ quarry login --for land
Open https://zeitforge.app/setup and type   KQ4T-9XWM   (10 minutes)
Waiting for your approval ...
Signed in to zeitforge.app as website-land, an agent of dmestas.
  may      push to dmestas/website; open landings; land its own and
           yours on trunk when build and test are green
  may not  land over a failed check; change settings
  token    in the login keychain; ends after 90 days unused
  revoke   https://zeitforge.app/me/agents/website-land
Next: quarry land

$ 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 ($ZIT_QUARRY, else quarry on the path). 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. The land grant, waiting, next and the stack run are forge records and API fields, outside the repository. The sync front still decides a push by letters and branch protection alone and does not read grants. The client works beside fossil push and fossil clone as it does beside zit: a stock fossil user pushes a branch with fossil and runs quarry land BRANCH.

Already in flight

Counted toward the stages below, and not repeated as steps:

Work Counts toward
!1396: a token is replaced with one approval Principle 2; stage A
!1397: a repository-limited token reads its own sign-offs Stage B (#461 item 6); the client's wait loop in step 16
branch for #458: a wrong-scope token gets wrong_scope and is not counted toward the lockout Principle 5; step 1 adds its next and closes the ticket
branch for #462: OWNER/NAME resolves on token and grant ops Step 3 finishes and closes the ticket
branch for #463: landing.auto requires on; the approval says arm or disarm Step 7 finishes and closes the ticket
danmestas/zit#356: landing open does not push Step 23, in zit's repository; step 4 covers the forge's side

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. Refusals that teach

  1. next on errors, and the wrong-door refusals. The next object on writeError and writeCodedError; wrong_scope and the 429 hold carry it; the kinds table in the guides says a push token cannot call the API and that a public CI log needs no token. Test: a sync token at the API gets wrong_scope with a next, fifty times, and its address is not held. Needs: the #458 branch. Closes #458.
  2. ask on a 403, and no refusal without next. Test: the registry walk of principle 1; a 403 whose ask is true succeeds when resent with Quarry-Ask. Needs: 1.
  3. Empty reach is a 403 that says so; pages show resolved repositories. Test: a token minted with OWNER/NAME lands a call on the repository; one whose reach matches nothing gets the 403 and no limiter miss; the approval page and me.account list resolved names. Needs: 1, the #462 branch. Closes #462.
  4. The local-only and forge-path hints. The 404 on a 64-hex landing id; the sync refusal on a protected branch. Test: each body carries its next. Needs: 1.

Stage B. What it is waiting on

  1. waiting on landing.get and landing.list. Test: the matrix of principle 6. Needs: 1.
  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 on a landing has a run id that fetches its log. Needs: 5. Closes #460.
  3. A landing lists its requests; a decided request says what happened. Test: three pending asks are three rows with distinct sentences; approving an arm reads "Armed ..." and approving a disarm of an unarmed landing reads "Already disarmed: nothing changed". Needs: 5, the #463 branch. Closes #463.
  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: 5, 6, 7.

Stage C. A stack is tested once

  1. One run at the top. 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. A split, or an accept of a rung without those above it, queues that rung's own run and waits on it; waiting reads stack for a rung held by inclusion. Test: accepting rung one of a green stack by itself does not land until its own run is green. Needs: 5, 9. Closes #464.

Stage D. The land grant

  1. The record, the sentence and the derivation. Storage; landing.grant (askable), landing.grant.list, landing.grant.revoke; refusal when B has no required checks. Test: invariants 4 (grant time) and 6. Needs: 2.
  2. The accept path honours the grant. landing.accept, landing.auto, landing.land and the sweep admit a matching grant; coverage defaults to the agent's and grantor's landings; "landed by A for PERSON". Test: invariants 1, 2, 3, 4 (land time) and 7; a third party's landing is refused under the default and admitted under "any". Needs: 10, 11.
  3. Setup kind land. agent.setup and setup/start take the kind and a branch; one transaction makes agent, role, grant and token. Test: an approved request yields a token with scopes sync and api, one repository and the kind's ceiling; a forced grant failure leaves no account. Needs: 3, 11, 12. Closes #459.
  4. The consent page, the agent's page and the protection list. Sign-off. The sentence, the "any landing" choice, "Revoke everything", grants listed beside B's owners. Test: principle 3; invariant 5. Needs: 13.
  5. Adversarial review of the grant. A reviewer who did not write steps 11 to 14 tries each invariant; every finding becomes a test. Kind land is switched on for the forge only after it. Needs: 14.

Stage E. The client

  1. forgeclient, the client-only build, login and whoami. The /runner/ download becomes quarry with quarry-runner as an alias; --for push and --for read work at once, --for land after step 15. 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 8's build check; every cmd in a next names a verb the build has. Needs: 2.
  2. api. Test: a call with --ask files a request and exits 3 while it waits; the token never appears in the process list. Needs: 16.
  3. status. Test: each waiting.on prints its three lines; --watch exits when the landing lands; --log prints the failed step. Needs: 6, 7, 16.
  4. land. Test: from a checkout with an unpushed branch, one command ends with the landing open and armed; --stack opens a chain and arms it; a refusal prints the server's next. Needs: 15, 18. Closes #461.
  5. The journeys run in CI. New person with login --for land; an agent landing a stack; a person asking why not; an agent refused and recovering with --ask. Each as written above, approvals counted. Test: principles 2 and 7. Needs: 19.

Stage F. Guides proven by code

  1. GET /api/v1 carries letters and askability; the permission table test. Test: changing an op's Caps without the guide fails. Needs: 2.
  2. The guides lead with the client. /llms.txt, docs/agents.md and docs/landings.md as under Guides proven by code. Test: extracted commands run green; /llms.txt is shorter than at the start of this RFC. Needs: 20, 21.

Stage G. 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: 19.

Done means #398's own test, for landing: a cold agent given only the forge's address lands a branch on green with one approval and no question to anyone but its person. #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"):

  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 standing "may land" exists as a narrow land grant: not branch ownership, and not a general standing-approval engine.
  3. A land grant covers landings opened by the agent or its person by default. "Any landing" is a visible choice on the consent page.
  4. Setup kind land mints one token with sync and api scopes, limited to the repository. This amends RFC 0030 decision 5 for this kind.
  5. A valid token at the wrong door is not counted as a failed sign-in.
  6. The verbs are login, whoami, land, status and api. The download is quarry, client-only, with quarry-runner kept as an alias.
  7. No approving from the terminal. Approval stays on the web or the phone; the terminal prints the link, waits, and prints the outcome.
  8. /llms.txt leads with the client; the wire format is one link away and still tested.

Decided here, reversible:

  1. next carries the API call from step 1 and the client command only once the verb exists. Reason: a refusal must not name a command nobody can run.
  2. A land grant is checked against its grantor at every use. Reason: an agent never holds more than its person (RFC 0021), and a grantor who leaves must not leave a standing grant behind.
  3. A grant is re-read when an armed landing lands. Reason: a revoke has to stop what was already armed, or "one place to revoke" is not true.
  4. The sentence names the branch's required checks as they are when read, not as they were when granted. Reason: the sentence must stay true; a branch left with none refuses the grant instead.
  5. Testing a stack once (#464) is a stage of its own, before the grant. Reason: "green" for a rung has to be defined before a grant may act on it.
  6. Kind land takes one repository and one branch. Reason: the sentence stays one sentence; a second repository is a second approval.
  7. The grant is its own review step, and kind land is off on the forge until it passes. Reason: it is the one change here that lets something reach a protected branch without a person present.