Skip to content
Toolkit

011-plan-ladder — routine prompt

The prompt block below is this track's live driver: the CS-Hourly routine reads ROADMAP's front track and follows that track's ROUTINE.md, so this file is the prompt and edits here take effect on the next firing without touching the trigger.

It inherits 010's protocol wholesale, which was 009's, 006's, 008's, 007's, 005's, 004's, 003's and 002's — batch loop, atomic claim refs, read / verify / output budgets, worktree rule, track handoff. Each was earned by a recorded failure and is not re-derived here. What changes is the claim namespace (claim/011-*), the read budget's file, the scoreboard, the WORK shapes — 011's six phases — and one addition this track earns on its own: a rung is closed only when something reads it.


Advance the plan ladder (011) by a BATCH of items, then stop.

BATCH LOOP: repeat {claim → build → verify → PR → merge → update
SESSION.md} item by item — one item per PR (revertible slices), each fully
merged before the next is claimed. Continue until the FIRST of:
- 4 items landed this run;
- the next item is a phase-scale block (a whole phase, one slice per PR
  notwithstanding) — do its first shippable slice as one item, then stop;
- the next item is blocked → one line in SESSION.md, stop;
- no unclaimed item remains, or remaining context is too small to land
  another item cleanly (never start what you cannot merge).
Read budgets are paid ONCE per run; between items re-read nothing — only
`git fetch` + the claim check for the next item.

READ BUDGET (hard): read .station/jobs/011-plan-ladder/SESSION.md
from the top through the end of "Next", once per run, and stop there. Open
the charter, the product gap assessment or an ADR only when the claimed
item names it. Trust SESSION.md's scoreboard line; re-run a gate only after
a diff that moves it. Re-deriving settled context is the run's largest cost
— spend it on the diff.

CI POLICY (settled — spend zero words on it): GitHub Actions here is
noise; the merge gate is local `npm run verify` exit 0, plus
`cd apps/api && go vet ./... && go test ./...` only if apps/api changed.
Green locally → merge the PR. Never re-run, mention, or "fix" Actions.
Canonical: ROADMAP.md "Standing policy".

CLAIM, THEN BUILD (002's protocol — the open-PR gate alone raced 8 times):
1. `git fetch origin` · list open PRs · `git ls-remote origin 'refs/heads/claim/*'`.
   - An open 011 PR exists → resume and land THAT PR as the batch's first
     item, then continue the loop.
   - Else take the top item under "Next" whose `claim/011-<item-slug>` ref
     is absent OR stale. Ref deletion returns 403 in the remote
     environment, so claim refs accumulate: a claim ref with no open PR
     and no branch commit newer than 3 hours is stale — treat it as free
     and re-claim over it. A slug SESSION.md's Completed already records
     is done, not in flight.
2. Claim atomically BEFORE writing any code:
     git push origin origin/main:refs/heads/claim/011-<item-slug>
   Rejected push = claimed between your list and your push → return to 1.
   Only a successful push is a claim; a SESSION.md line is not.
3. When your PR merges, attempt to delete branch and claim ref once; a
   403 is expected there, not a failure — move on.
Take ADR numbers only after `git fetch`, from origin/main's docs/decisions/.

WORK: fan out where the item is an enumeration, solo where it is not.
- Phase 00 mints the ladder ledger AND its gate BEFORE any axis or tier
  lands, for 004/006/007/008/009/010's reason: a scoreboard minted after
  the work measures nothing. One row per rung — each new quota axis, the
  expiry path, the tier seed — naming what stores it, the path that must
  READ or RUN it, and its test. Everything starts open. A row flips only
  in the commit that adds its reader.
- A RUNG IS CLOSED ONLY WHEN SOMETHING READS IT. A stored number, a
  seeded row and an admin control are each necessary and none is
  sufficient. An axis with no write path that refuses on it is 007's
  inversion with a number in it; the ledger row may not claim closed on
  the storage half alone.
- NO NUMBER THE OWNER HAS NOT AGREED TO. Prices, tier names and per-tier
  axis values are Blocker 1 and are never invented by a session — a
  seeded price is a number customers are charged from. Phase 05 seeds the
  SHAPE with prices empty and rows not purchasable, and the admin form
  004 built fills them without a deploy.
- AN UNSET QUOTA UNLIMITS (004's fail-open), which is the opposite of a
  capability's default deny. A new axis ships unseeded and changes
  nothing until a plan carries it.
- A STATEMENT IS PROVED AGAINST POSTGRESQL, never against a mock — 009
  phase 05's rule, and phase 01's defect was found exactly that way. A
  PostgreSQL 16 cluster runs here without Docker: initdb as an
  unprivileged user, start on a unix socket, apply every
  `apps/api/migrations/*.up.sql` in order, and the repository integration
  tests stop skipping.
- A TRANSITION IS IDEMPOTENT AND RE-RUNNABLE (009's rule), and it is
  handed a clock rather than reading one (ADR-0113) wherever elapsed time
  decides it.
- SUBDOMAINS ARE NOT THIS TRACK'S. The axis has no serving path to read
  it because 009 phase 06 was never built; it stays an open ledger row
  with no phase (Blocker 3). A session that adds it unenforced has left
  the charter.
- A new or widened gate is watched FAILING once on a deliberately broken
  input, and the run that widened it records that in evidence/.
- TRACK HANDOFF: when every charter phase is closed and verified, write
  reports/CLOSE.md, mark 011 DONE on ROADMAP — and 011 is the LAST track
  in ROADMAP's "last stretch". Subsequent runs drain ROADMAP's "Standing
  repairs" the same way, one per PR, taking one when it neighbours work
  in hand. When those are drained too, change nothing, report completion
  and recommend disabling the routine — do not invent scope.
Integrate and verify results yourself; never merge on an agent's word.
Any agent that writes ANYTHING runs in its own `git worktree`, never the
run's tree (an in-tree reviewer destroyed an uncommitted fix on 002); if
worktree tests resolve workspace packages, relink node_modules first — a
symlink into the run's tree reads the wrong files and false-passes.

VERIFY ONCE: while iterating, run only the touched tests
(`npx vitest run <files>`, `go test ./internal/<pkg>/...`) or the one gate
the item moves. Run `npm run verify` exactly once, when the diff is final,
immediately before the PR, plus `go vet ./... && go test ./...` in apps/api
if apps/api changed; if it fails, fix and re-run — never as a baseline,
progress check, or "before and after".

RULES THAT STAND: migrations at the next free number with .down.sql,
applied manually, never renumbered; handler → repository → database
layering, no business logic in handlers; APIResponse envelope; breaking
API changes under /api/v2/, never in place; frontend uses Studio
primitives and tokens only — nothing new in components/ui, no raw
colours; product vocabulary from docs/GLOSSARY.md; strings behind `t()`
with the key in the `en` bundle (005 closed; a new surface does not
reopen it); Redis is optional (AGENTS.md §4) and every phase works
degraded without it; no adjacent cleanup — one SESSION.md row instead.
Nothing user-visible merges wired to nothing, and a quota axis no write
path refuses on is exactly that. Consequential product calls become ADRs,
never silent choices.

OUTPUT BUDGET (hard — the run's meaning is its diff, not its prose):
- New ADR only for a decision that constrains future work, ≤ 120 lines.
- SESSION.md Completed entries ≤ 8 lines, linking the ADR/PR.
- ≤ 3 new open-item rows per run, ≤ 3 lines each; a one-line fix in a
  file already touched is fixed, not recorded.
- PR body ≤ 20 lines. Final report: one line per item landed (item, merge
  commit, scoreboard before → after) + one line for what is next.

Close out per item: SESSION.md Completed entry + refresh "Next"; tick
ROADMAP.md's 011 row only when verification proved it. Conventional
Commit, PR to main, merge on local green.

Shape notes

  • Inherited, not re-derived. The protocol above is 010's, which was 009's, 006's, 008's, 007's, 005's, 004's, 003's and 002's. The history behind each rule lives in 002's ROUTINE.md shape notes; a run that wants to change a rule reads that first, because each one is a fix for something that actually went wrong.
  • The scoreboard is one number from one script, so it cannot drift: closed over rungs, printed by scripts/check-ladder-parity.mjs and committed beside it. It rises only in the commit that adds the reader. This is 007's enforcement ledger, 009's lifecycle ledger and 010's hosting ledger, one subject over.
  • The new rule is a number's version of 007's. 007 proved that a boolean a plan bills must be read where it serves. This track's subject is quantities, and the same inversion is available one axis at a time: a seats_limit nobody reads bills for a limit that does not exist. So a rung's row flips on the refusal, never on the column.
  • The riskiest thing this track can ship is a number nobody agreed to. Every other track's mistakes cost a revert; a seeded price is a figure customers are charged from, and an invented per-tier quota silently decides what the product sells. Hence Blocker 1 and the shape/price split in phase 05: the mechanics are the session's, the numbers are the owner's, and the boundary is the row's status and its empty prices.
  • Phase 01 exists because a statement was run. The downgrade path was on the ROADMAP as missing; it is present, and it has never executed. That finding cost one initdb and three statements, and it is the reason this track's verification bar names PostgreSQL rather than a mock.

Source: .station/jobs/011-plan-ladder/ROUTINE.md

Library