008-card-view — 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 007's protocol wholesale, which was 005's, which was 004's, 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/008-*), the read budget's file, the scoreboard, and the WORK shapes,
which are 008's six phases.
Advance card view & public renderers (008) 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/008-card-view/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 008 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/008-<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/008-<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 renderer ledger and its gate BEFORE any renderer
lands, for 004's reason: a scoreboard minted after the work measures
nothing. One row per public link type — the document that serves it, or
redirect-by-design with the reason. The gate fails when a named renderer
is deleted, when a row claims rendered without one, and when a type in
packages/link-model has no row.
- Phases 01–04 replace one `default:` 302 each, for their own type only:
vCard (page + generated .vcf), event (page + generated .ics), stored
documents served not bounced (file/static — the storage origin appears
in no response), payment page. Every renderer draws the author's DATA,
never their script (ADR-0094); the gate holds on every door into every
new document (ADR-0098) — page and generated file alike refuse until
unlock; a served document carries its configured pixels (007 phase 03's
mechanism, not a second one). A `.vcf`/`.ics` is asserted by parsing,
never substring.
- Phase 05 waits for at least one renderer: one `@slug` routing
convention claimed in one place beside /b/{url}, one summary-card
renderer for ANY public type, composed from public payloads only — a
card leaks nothing the payload refuses. Reuse the OG plumbing where it
helps; handlers/og_images.go is a webhook receiver, not a renderer —
never claim it as one.
- The public-origin question (charter Blocker 1, ADR-0096) is an OWNER
DECISION — build every renderer without it, keep the per-pixel honesty
the pickers already have, re-present it at close with the full surface
inventory.
- 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 006 section and
the assessment's §Collaborate, RE-SCOPED against the overview's pillar
as ROADMAP directs; where that section says chartering collects owner
decisions, the charter names each as a Blocker with options and a
recommendation — never invents the answer. Then mark 008 DONE on
ROADMAP, and subsequent runs work the new track. Tracks follow
ROADMAP's "last stretch" order; when the last one closes, drain
ROADMAP's "Standing repairs" the same way, then 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); no adjacent cleanup — one SESSION.md row instead. Nothing
user-visible merges wired to nothing, and a stored setting with no
serving-path reader is not enforcement. 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 008 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 007's, which was 005's, which was 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 one number from one script, so it cannot drift:
renderedovertypes, printed byscripts/check-renderer-parity.mjsand committed beside it. It only rises, and it rises in the commit that adds the renderer — never in the commit that adds the row.redirect-by-designrows (linkstays a 302 on purpose) count as neither: they are the ledger saying so out loud. - The ledger before the renderers, for the same reason as 004 and 007: a row minted in the same commit as its renderer is unfalsifiable.
- The riskiest thing this track can ship is a renderer that leaks what the gate refuses. 007 spent three ADRs (0083, 0094, 0098) earning the shape — allowlisted payloads, data-not-script, a gate on every door — and every new document here inherits all three rather than re-deciding them. The second riskiest is a card that becomes a second public payload: phase 05 composes from the payloads that exist, it mints none.
Source: .station/jobs/008-card-view/ROUTINE.md