005-i18n — 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 004's protocol wholesale, which was 003's, which was 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/005-*), the read budget's file, the
scoreboard, and the WORK shapes, which are 005's five phases.
Advance i18n extraction (005) 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 surface 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/005-i18n/SESSION.md from the
top through the end of "Next", once per run, and stop there. Open the
charter, ADR-0010, the baseline evidence or plans/04-system-integrity.md
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 005 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/005-<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/005-<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 makes the public read serve what an admin stored: `ListActive`
in repository/languages.go selects a literal '{}' where the admin reads
select `strings`. Widen the public payload only as far as a consumer
reads it — a payload no client consumes is the defect this track exists
to close, not a head start.
- Phase 01 widens the ratchet's SCOPE, then re-baselines IN THE SAME
COMMIT with a movement row in 001-renaissance/evidence/i18n-baseline.md.
A scope change that moves the number without a stated reason is the one
move that file exists to make visible.
- Phase 02 is the extraction, ONE SURFACE PER PR, each slice lowering
`hardcodedStrings` in the commit that extracts it. Keys go through
docs/GLOSSARY.md. A missing key falls back to `en`, never to itself.
- Phase 03 resolves the Settings Language dropdown — one namespace and one
store, or archived to .archives/removal-safe/. Deciding that `users.language`
should not drive the UI language is a legitimate result; leaving a
control that answers success to a write nothing reads is not.
- Phase 04 remounts a language control and settles first-paint gating.
It is LAST by ADR-0010, not by convenience: a control ships only once
selecting a language changes what a user reads.
- 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, the
next run's single item is to charter 006 from ROADMAP's table under
docs/guides/workstream.md — README, ROUTINE.md (inherit this
protocol), SESSION.md — scoped from ROADMAP's track section and
001-renaissance/plans/05-collaboration.md; then mark 005 DONE on
ROADMAP, and subsequent runs work the new track. When 006 closes, drain
ROADMAP's "Standing repairs" the same way; when those are done, 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; no adjacent cleanup —
one SESSION.md row instead. No language control ships while nothing is
translated (ADR-0010 rule 1), and the baseline never rises silently.
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 005 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 004's, which was 003's, which was 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 two numbers from one script, so it cannot drift:
hardcodedStringsandtranslatedCallSites, both printed bynode scripts/check-i18n-coverage.mjsand both committed inscripts/i18n-baseline.json. "Before → after" in the report makes each run's contribution visible. The first number falls; the second rises; neither may move without a row in the baseline evidence file. - Scope before extraction. Phase 01 comes before phase 02 for the same reason 004's audit came before its gate: extraction measured against the wrong scope destroys the measurement, and 002 already moved strings out from under the counter once.
- The riskiest thing this track can ship is a control that lies — the exact defect ADR-0010 closed. Rule 1 is structural rather than name-matching, phase 04 is last, and a rebuilt switcher under a new name fails the build the same way the old one would.
Source: .station/jobs/005-i18n/ROUTINE.md