Skip to content
Toolkit

002-renaissance — routine prompt

Paste the block below as the prompt of a recurring Claude routine. Each run advances the workstream by a batch of items, merging each as it lands. Previous versions are archived at .archives/removal-safe/.ops/projects/002-renaissance (2026-08-20 long form; 2026-08-21 pre-budget form).


Advance Studio renaissance (002) by a BATCH of items, then stop.

BATCH LOOP: repeat {claim → build → verify → PR → merge → delete refs →
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 unclaimed item is a phase-scale block (a whole phase, a
  multi-day promotion) rather than a run-scale item — 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 your remaining context is too small to
  land another item cleanly (never start what you cannot merge).
The read budget below is paid ONCE per run, not per item; between items
re-read nothing — only `git fetch` + the claim check for the next item.

READ BUDGET (hard): read .station/jobs/002-renaissance/SESSION.md
from the top through the end of "Method" and stop there. Open
LEDGER.md only if your claimed item lives in it; open an ADR, the
charter, ROADMAP.md, the archived logs, or the preview pages only if the
item links to them by name. Trust SESSION.md's scoreboard header — do not
re-run check:studio-parity or any gate to "confirm" state your diff has
not moved. Re-deriving settled context is the run's largest cost; spend
it on the diff instead.

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, delete the branch. Never re-run, mention,
or "fix" Actions. Canonical: ROADMAP.md "Standing policy".

CLAIM, THEN BUILD (this closes the duplicate-run race — 8 duplicates and
one ADR-number collision are on record):
1. `git fetch origin` · list open PRs · `git ls-remote origin 'refs/heads/claim/*'`.
   - An open 002 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/002-<item-slug>`
     ref does NOT exist. Every listed claim ref is taken — skip it.
2. Claim atomically BEFORE writing any code:
     git push origin origin/main:refs/heads/claim/002-<item-slug>
   Ref creation is atomic at the remote: if the push is rejected, the
   item was claimed between your list and your push — return to step 1.
   Only a successful push is a claim; a SESSION.md line is not.
3. A claim ref with no open PR and no branch commit newer than 3 hours
   is stale: delete it (`git push origin :refs/heads/claim/002-<slug>`)
   and re-claim.
4. When your PR merges, delete both your branch and your claim ref.
   Also take an ADR number only after `git fetch`, from origin/main's
   docs/decisions/ — two runs both took 0042 on 2026-08-21.

WORK: solo by default. Spawn a scout sub-agent only when the item needs
real enumeration (tens of call sites / emitted classes); spawn an
adversarial reviewer only for a diff that authors or converts a
component. Any agent that writes ANYTHING runs in its own `git worktree`,
never the run's tree — a reviewer once destroyed an uncommitted fix.

VERIFY ONCE: while iterating, run only the touched tests
(`npx vitest run <files>`). Run `npm run verify` exactly once, when the
diff is final, immediately before the PR; if it fails, fix and re-run —
but never run it as a progress check, a baseline probe, or "before and
after". Mutation-test NEW assertions only, ≤ 10 mutations, in a worktree,
via `node scripts/mutate.mjs` — never an ad hoc replace/revert loop.

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.
  A conversion that follows the Method without deciding anything new gets
  NO ADR — the ≤ 8-line Completed entry and an archive-register row carry it.
- ≤ 3 new LEDGER.md rows per run, ≤ 3 lines each. A finding that is a
  one-line fix in a file you already touched is fixed, not recorded.
  Never write rows about the routine's own process — that goes here, in
  ROUTINE.md's shape notes, once.
- PR body ≤ 20 lines. Final report: one line per item landed (item,
  merge commit, parity before → after) + one line for what is next.
  No narration of method, policy, or history — link.

Rules that stand: components built in studio/, never apps/web; tokens
only; types before call sites move; app CSS deleted same commit with
emitter counts; icons inline; `npm run studio:build` + commit dist after
core CSS changes; parity ledger regenerated
(`node scripts/check-studio-parity.mjs --write`); no adjacent cleanup —
one LEDGER.md row instead.

Close out: SESSION.md Completed entry ≤ 8 lines linking the ADR/PR
(Completed keeps the newest 5 — roll the oldest into the archive log when
you add a sixth); refresh "Next"; tick ROADMAP.md's 002 checklist only
when verification proved it, as strikethrough + ADR link, no narrative.
Conventional Commit, PR to main, merge on local green, delete branch and
claim ref.

Shape notes

  • Batching amortises the fixed cost. One item per run meant the context read, the environment warm-up and the run's framing overhead were paid per item. The batch loop pays them once and spends the rest on diffs — while keeping one PR per item, so every slice stays independently revertible and a dead run loses at most the item in flight, never a half-merged batch. The 4-item cap and the never-start-what-you-cannot-merge rule are the guardrails; per-item claims (not a batch claim up front) keep parallel runs from starving on items a run may never reach.
  • The read and output budgets are the point of this revision. Runs were burning most of their spend re-reading a 330-line session file, re-running verify as a mood check, and writing ADRs, ledger rows and PR essays that restated each other. The budgets are hard limits, not style advice: a run that exceeds them is off-prompt even if its diff is good. Prose that three documents repeat is waste in all three.
  • The claim ref is atomic where every previous protocol was not. Open-PR listing (#90/#91), claim commits plus "In flight" lines (#93/#94), and SESSION.md edits all race, because both runs read before either writes. git push creating refs/heads/claim/002-<slug> cannot: the remote accepts exactly one creator, and the loser's push is rejected in the same operation that would have claimed. The residual races are the stale-claim takeover (rare, bounded by the 3-hour rule) and ADR numbering, which the fetch-first rule covers.
  • Ref deletion does not work from this environment, so claim refs are append-only in practice. git push origin :refs/heads/<ref> returns either Everything up-to-date or a sideband disconnect and deletes nothing (2026-08-22, retried with backoff and with --delete); the MCP GitHub tools expose branch creation but no deletion. Every landed item's claim ref is therefore still on the remote, which is why step 1's "every listed claim ref is taken" over-blocks — resolve by step 3: a claim ref with no open PR and no branch commit newer than 3 hours is stale, so treat it as free and re-claim on top of it (the re-push is a no-op that still proves nobody else moved it). Cross-check against the Completed log before claiming: a slug named there is done, not in flight.
  • verify runs once because it is a ~2-minute full build and every run was executing it two to four times — as an opening baseline, after npm ci repairs, and again per fix. The touched-file vitest loop gives the same signal at seconds per iteration; verify's job is the merge gate, not the inner loop.
  • Sub-agents are opt-in, not default. Steps 1–5 of the Method parallelise cleanly for a 20-file conversion and are pure overhead for a debt row touching six files. The worktree rule stands unconditionally: on 2026-08-21 a reviewer ran git checkout -- in the run's own tree and destroyed an uncommitted fix, and the following commit shipped the fix's test without its source change.
  • ≤ 8-line log entries, 5-entry Completed, LEDGER.md split keep SESSION.md a continuation point a run can afford to read every hour; the 3,500-line predecessor and the 330-line successor it grew back into are what these rules prevent.
  • The live E2E suite runs in the remote-session environment (2026-09-02, against 010's note that it cannot): no Docker daemon, but Postgres 16, Redis, Go and a Chromium at /opt/pw-browsers/chromium-1194 are all installed. The recipe is in .station/jobs/002-renaissance/evidence/display-rules-live-run-2026-09-02.md: raise the cluster, apply the migrations and seed-users.sql, build and run the API with the compose file's dev environment, vite --port 3000 with API_PROXY_TARGET, and point Playwright at the installed browser through a scratch config that extends playwright.config.ts with launchOptions.executablePath (Playwright's own download is disabled here, and its pinned build number does not match). Budget ~5 minutes for the stack. A row that says "reviewed, not run" is runnable.
  • Ref deletion 403s in the remote-session environment (2026-08-21, PR #103's run): git push origin :refs/heads/<x> — branch or claim ref — returns HTTP 403 while ref creation succeeds, so "delete branch and claim ref" cannot complete there and lingering claim refs are that environment's signature, not abandonment. Consequence for the claim check: a claim ref whose slug matches an item SESSION.md's Completed already records is dead — skip the item, not the run; delete the ref when an environment that can. Known-dead now: claim/002-filterbar-promotion (the Segmented slice, #102), claim/002-item-119-layout-primitives (ADR-0044), claim/002-dashboard-stats (#103).

Source: .station/jobs/002-renaissance/ROUTINE.md

Library