Skip to content
Toolkit

007-enforcement — 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 005's protocol wholesale, 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/007-*), the read budget's file, the scoreboard, and the WORK shapes, which are 007's five phases.


Advance enforcement (007) 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/007-enforcement/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 007 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/007-<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/007-<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 ledger and its gate BEFORE any enforcement lands, for
  004's reason: a scoreboard minted after the work measures nothing. A
  point is unenforced until a named serving path reads it; the gate fails
  when that reader is deleted, when a point claims enforcement without
  one, and when a capability bills a control no point covers.
- Phase 01 is the redirect path: display rules through the EXISTING
  `DisplayRulesService` (a second matcher is a defect in the second
  place), then start/end dates, then `clicks_limit` with `expiration_url`
  as the fallback the form already collects. Every branch is inert on
  absent data — a link with no rules takes the current path byte for byte.
- Phase 02 is ONE interstitial mechanism, three reasons, ONE PER PR:
  password (unlock verifies the ADR-0083 digest, never a plaintext
  compare), sensitive content, splash. The bar for the password slice is
  the ABSENCE of the destination from every response until unlock, not
  the presence of a form.
- Phase 03 emits pixels by id on the surfaces that carry a document. A
  bare 302 has nowhere to emit from: record that constraint, never work
  around it with a synthetic redirect page nobody asked for.
- Phase 04 makes `Verify` do a lookup. The backfill of existing
  `is_verified` rows is an OWNER DECISION (charter Blockers) — build the
  lookup, leave the migration.
- 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 008 from ROADMAP's table under
  docs/guides/workstream.md — README, ROUTINE.md (inherit this
  protocol), SESSION.md — scoped from ROADMAP's 008 section and the
  assessment §Card view / §Resource types; then mark 007 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 007 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 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: enforced over points, printed by scripts/check-enforcement-parity.mjs and committed beside it. It only rises, and it rises in the commit that adds the reader — never in the commit that adds the row.
  • The ledger before the enforcement. 004 ran its grandfathering audit before any gate existed and found the finding that reshaped its first slice. The ordering is the same here for the same reason: a point that gets its row and its reader in one commit is unfalsifiable.
  • The riskiest thing this track can ship is a redirect that stops working. Every branch it adds is inert on absent data, and every slice is revertible alone. The second riskiest is an interstitial that shows a form while the payload beside it still carries the destination — which is why phase 02's bar is an absence, and why ADR-0083 narrowed the payload first.

Source: .station/jobs/007-enforcement/ROUTINE.md

Library