The backend half of the sweep RD-18 did for the front end. git blame holds the provenance and stays correct when the code moves; the comment names a closed ticket and tells the reader nothing the sentence around it does not. public/letter.css and LetterHtml.golden.html change together, because the renderer inlines the CSS and the golden file snapshots the result. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
16 KiB
Readable codebase — apply the dashboard pattern to the rest of the app
The dashboard refactor cut dashboard.page.ts from 340 lines to 42. It was built as a
reference implementation: prove the pattern on one screen, then hold the rest of the app
to the budget it establishes.
This arc applies that result. The full design record, with every measurement and every
rejected alternative, is PLAN.md. Each ticket below is one commit.
Two findings shape the work:
- Pages are already thin (17 pages, median 88 lines). The remaining bulk sits one layer down, in organisms.
- The worst problem is not size.
runIfSubmittingis copy-pasted into 5 components and must be called by hand afterdispatch. Forgetting it fails silently. RD-06 fixes two user-facing bugs that follow from it.
Session protocol
- One ticket per session. Read
CLAUDE.md, this README, the ticket file, and the ticket's "Read first" list — then execute. Do not start the next ticket in the same session. - The Decisions block in each ticket is pre-made. Do not relitigate it.
PLAN.mdrecords why, including the alternatives that were rejected and the reasons. - Ticket files are written just in time, not all 35 up front. Writing one means choosing
which decisions and which traps from
PLAN.mdbelong in it, so the supervisor writes the ticket file (an Opus-shaped job) immediately before delegating it. The file lands in that ticket's own commit. Generating all 35 in advance would be speculative — later tickets are better written once the earlier ones have taught us something. - Match the model to the step (see CLAUDE.md, "Model routing for agent delegation").
Executing a ticket is written for the
developeragent (Sonnet). Read-only checks go totask-runner(Haiku). Escalate toplanner(Opus) only if a Decisions block turns out to be wrong — in which case stop, and fixPLAN.mdfirst. - A ticket ends GREEN, with its acceptance criteria checked, its
Status:set todone, and its README row updated — all in the same commit as the code. Never in a follow-up commit. This is what makes a restart safe: whatever is committed is done, and whatever is not is not. Status: donecarries no commit hash, because a commit cannot contain its own hash. The commit is recoverable when you need it:git log --oneline --diff-filter=A -- docs/project/readable-codebase/RD-NN-*.md.- No ticket leaves a check disabled without an inline reason and a reference to the ticket that removes it.
GREEN (global definition of done)
npm run ci
For any ticket whose "--full?" column says yes — it touches a story, an .mdx, or
libs/shared/src/ui/** — additionally:
npm run ci --full
npm run ci does not build Storybook. Only --full does, and a broken .mdx story
import is invisible until it runs. RD-27 in particular must not be pushed without it.
Recovery after a restart
A fresh session with no context needs three commands:
git log --oneline -8
grep -rn '^Status:' docs/project/readable-codebase/RD-*.md | grep -v done # next work
npm run ci # is HEAD green?
Then read PLAN.md for the design record, and the first todo ticket for the work.
The agent loop
One supervisor session drives it; one developer agent executes each ticket:
- Read the Order table. Pick the first
todowhose dependencies are alldone. - Spawn one
developeragent: "ReadCLAUDE.md, thendocs/project/readable-codebase/README.md, thenRD-NN.mdand its Read-first list. Execute it. End GREEN. Update the ticket Status and the README row in the same commit as the code. Do not start another ticket." - Verify with
task-runner:npm run ci,git log -1 --stat, and thatStatus:now readsdone. Never mark a ticket done on an agent's report alone — the check is the exit code. - Green: next iteration. Red: stop and surface it.
Run tickets sequentially. Three properties make concurrent writes to one branch hostile:
behaviour-spec.mdx and snippets.generated.ts are regenerated and drift-checked, so two
agents regenerating conflict by construction; every ticket writes this README's Order table;
and the file sets overlap (the three wizards appear in RD-06, RD-07, RD-22 and RD-23).
Parallel work pays only for genuinely disjoint tickets, in separate git worktrees, merged deliberately — RD-18/RD-19 (the ticket sweep) and the Phase 5 doc tickets qualify. Cap at two. Note that RD-15 exists because 22 abandoned agent worktrees are still on disk.
Order
| ID | Ticket | Deps | --full? |
Status |
|---|---|---|---|---|
| RD-01 | Scaffold this backlog: README, PLAN, ticket template | — | done | |
| RD-02 | max-lines rule + reportUnusedDisableDirectives + 7 disables |
01 | done | |
| RD-03 | overzicht context: page + 2 nav sections, boundary edge, admin-links token |
02 | yes | done |
| RD-04 | Story titles to Domein/<Context>/<Name>; add the missing stories |
03 | yes | done |
| RD-05 | createStore gains the effect map + specs |
02 | done | |
| RD-06 | Bug fix: 2 single-step forms to the effect map + retry affordance | 05 | yes | done |
| RD-07 | Add Primary to the 3 wizard machines + specs |
05 | done | |
| RD-08 | Migrate the 3 wizards to the effect map + Primary |
07 | yes | done |
| RD-09 | Teach the effect map: ARCHITECTURE §2d + fp-tea (2 docs, no generator) | 08 | done | |
| RD-10 | WizardStatus to a payload-carrying WizardPhase |
08 | yes | done |
| RD-11 | Fold the lifecycle projection into remote-data.ts; PascalCase 3 machines |
01 | done | |
| RD-12 | ActionState becomes action on BriefState.Loaded |
11 | done | |
| RD-13 | Same for org-template, folding pendingPublish in |
12 | done | |
| RD-14 | Move SaveState to debounced-save.ts; delete action-state.ts |
13 | done | |
| RD-15 | Remove 22 abandoned agent worktrees (4.7 GB) | 01 | done | |
| RD-16 | parseDashboardView returns BigProfile |
01 | n/a | |
| RD-17 | successOf/successOr sweep — 10 sites, 8 files |
01 | done | |
| RD-18 | Ticket-reference sweep, frontend — 181 refs, 100 files | 01 | yes | done |
| RD-19 | Ticket-reference sweep, backend — 370 refs, 86 files | 01 | done | |
| RD-20 | wizard-errors.ts + spec, adopted by all 3 wizards |
02 | todo | |
| RD-21 | rich-text-dom.ts helpers + spec cases |
02 | yes | todo |
| RD-22 | intake-wizard to 3 step components |
08, 20 | yes | todo |
| RD-23 | registratie-wizard to 3 steps + the upload-controller move |
08, 20 | yes | todo |
| RD-24 | concepts.page to 6 sections + concept-card + globals + code tokens |
02 | yes | todo |
| RD-25 | org-template-editor to sample-letter.ts + labels + 2 children |
02 | yes | todo |
| RD-26 | letter-canvas: inline the labels + letter-line; keep one disable |
02 | yes | todo |
| RD-27 | The layer move: 33 git mv + 28 specifiers + 8 MDX imports |
21 | yes | todo |
| RD-28 | Layer-tag fixes + the libs/beheer title rule |
27 | todo | |
| RD-29 | The 3 atomic-ladder rules in dependency-cruiser | 27 | todo | |
| RD-30 | Archive the finished backlogs (16,300 lines) + an archive README | 01 | todo | |
| RD-31 | ARCHITECTURE.md section 6a: symbols not lines, 2 dead paths, new names |
03, 08, 16 | todo | |
| RD-32 | fp-tea-atomic-design.md: 11 broken paths + the broken anchor |
27 | todo | |
| RD-33 | CLAUDE.md + atomic-design.mdx + the ui-component skill |
03, 27, 29 | yes | todo |
| RD-34 | (optional) NO_SUBORGS/NO_TABLES become RemoteData.Empty |
11 | todo | |
| RD-35 | (optional, last, alone) upload type: discriminant to tag: |
27 | todo |
The ID order already respects every dependency, so it is the recommended running order.
Independent tickets. RD-15 through RD-19 depend only on RD-01. Pull them forward to fill a short session. Take RD-15 early: it makes every later repository search faster.
Two ordering traps the table encodes. RD-01 must precede RD-30, because RD-01 copies its ticket template out of the directory that RD-30 archives. And four tickets edit the same two documents in different sections — RD-09 rewrites the submit-idiom teaching, while RD-31 and RD-32 fix section 6a and the stale paths. Sequential is fine. Never put those pairs in parallel worktrees.
Ticket template
# RD-NN — Title
Status: todo | in-progress | done
Source: PLAN.md section <n>
## Why
## Read first
## Decisions (pre-made, don't relitigate)
## Files
## Steps
## Acceptance criteria
## Verification
## Out of scope
## Risks
Three rules when you write a ticket file, because the agent reads its ticket and not
PLAN.md:
-
Copy the decision, never a pointer to it. The verdict goes in the Decisions block, verbatim.
-
Inline the traps that apply to that ticket. A trap recorded only in
PLAN.md's global Risks section is a trap that fires. -
State acceptance as a command, not a sentence. "Lands about 230 lines" is a design estimate and nothing can check it.
npm run linthas an exit code. -
Run every acceptance command against the tree before you hand the ticket over. A command that cannot pass is worse than no command: the agent either wastes a cycle or, worse, "fixes" correct code to satisfy it. Seven real misses so far, all in tickets written by the supervisor:
- RD-06 grepped only
runIfSubmitting, missing that one wizard spells itrunIfIndienen. - RD-08 grepped bare
onPrimary\|onRetry, which can never return nothing — an unrelateduploadCtl.onRetryexists inupload-controller.ts. - RD-08 said "no machine changes" while also requiring a repo-wide grep to come back clean, which forced comment edits in three machines. The two instructions contradicted each other.
- RD-09 grepped
docs/ apps/ libs/ .claude/, which also matched this backlog's own ticket files (they name the deleted method as the history ofdonework) and 22 gitignored abandoned worktrees. Satisfying it literally would have corrupted completed-ticket history. - RD-11 asserted
git grep "machineRemoteData\|LoadLifecycle"returns nothing, but the replacement it mandates is namedfromLoadLifecycle— which contains the old name as a substring. The check can never pass. When the new name contains the old one, anchor on word boundaries:git grep -w machineRemoteDataandgit grep -nE "(^|[^a-zA-Z])LoadLifecycle\b".
Four habits that prevent all five:
- Use
git grep, notgrep -r. It searches tracked files only, so untracked and gitignored paths never pollute the result. Measured on this repo:grep -rfinds 132 hits under.claude/,git grepfinds 0. This matters most for RD-17, RD-18 and RD-19, which are repo-wide sweeps. - Anchor on a declaration (
^ onRetry\(\)), not on a name that may legitimately appear elsewhere. git grep -ccounts matching LINES, not occurrences. RD-14 assertedgit grep -c "'Idle'\|'Saving'\|'Saved'\|'Error'"would be>= 4, but all four tags live on one line of a single-line type declaration, so the honest answer is1. The agent correctly refused to reformat the type across four lines to satisfy the number. When you want occurrences, usegrep -o … | wc -l; when a line count is what you mean, say so.- Scope every acceptance command to the ticket's Files list, never to a parent
directory. This is the habit most often broken, including by the supervisor in RD-12:
the check
git grep "ActionState" -- apps/ssp/src/app/briefcannot pass, becauseorg-template.store.tslives in that directory and is deliberately out of scope until RD-13. Name the files. If a command reaches a file the ticket says not to touch, one of the two is wrong. - Prefer a number over a prohibition for anything that must not change. "Do not rename
BriefStatus" invites reasoning around it; "this count must still be 54, and if it moves, revert rather than adjust the number" does not. RD-11 renamed tags across 19 files with a wire contract in the same file — on the same line in one place — and the count held.
- RD-06 grepped only
Troubleshooting
dotnet test fails with SQLite Error 1: 'no such table: <X>'. Stale, gitignored
bigregister.db artifacts from an old build. Found during RD-11, where a 0-byte file dated
months earlier failed 6 backend tests on an otherwise clean tree. Delete all three and re-run:
rm -f backend/bigregister.db backend/src/BigRegister.Api/bigregister.db \
backend/tests/BigRegister.Tests/bin/Debug/net10.0/bigregister.db
These are build artifacts, not fixtures — removing them is always safe.
A second cause reaches the same error: two agents running dotnet test at the same time in
one checkout. They share those files, so one run truncates the other's database. RD-17 hit
this. The fix is the same three deletions, but the cause is concurrency — see the next entry.
dotnet test reports one failure in OpenZaakIntegrationTests. That test carries
[Trait("Category", "Integration")] and needs the live OpenZaak harness. Both ci.yml and
scripts/ci-local.sh filter it out. A bare dotnet test does not. Run npm run ci — a bare
dotnet test is the wrong command, not a red build.
An unexplained dirty tree may be a running agent, not an interrupted session. /clear
ends the supervisor's context. It does not stop the developer agent that session
spawned. That agent keeps writing to the same branch. In RD-17 a fresh supervisor read the
half-finished tree as an interrupted session, wrote a "continue from here" ticket, and
dispatched a second agent onto the work the first was still doing. Both agents then ran the
backend tests together, which produced the stale-database failure above.
Nothing was lost, because the second agent committed first and the first agent checked before committing rather than committing blindly. That was luck. Before you dispatch, confirm no agent is live:
git status --short # modified files nobody in THIS session touched = suspect
git log --oneline -1 # did an agent already commit the ticket?
If the tree is dirty and this session did not dirty it, find the agent before you write a ticket around the evidence it leaves.