The whole repository was read area by area: 104,000 lines of source and the tests. No code was changed. The result is a plan doc with 25 workstreams and a findings file per area, for an agent to work from.
156 are DRY (one piece of knowledge in several places), 69 KISS (more machinery than the job needs), 21 YAGNI (code nothing needs).
workers.ts is one class of 4,860 lines, serve() one function of 1,120 lines with 17 positional parameters, Canvas one component with about 120 hooks.| Finding | Area | Workstream | |
|---|---|---|---|
| T1 | "A card started, a commit in its workspace, handed over" is written about a dozen times | Tests | W2 |
| T2 | The workers fixture cannot be told its adapter: 27 "remove it and set it up again" calls, about 85 tests build everything twice | Tests | W2 |
| T3 | The one-repository canvas harness is rebuilt in file after file: there is a workers fixture but no canvas fixture | Tests | W3 |
| E1 | "Git steps" generators serve a synchronous runner that only two scripts and tests use | Git and workspaces | W5 |
| E2 | The git runner is private to workspaces.ts, so seven modules wrote their own | Git and workspaces | W5 |
| E5 | workspaces.ts is three modules; most importers want only the smallest one | Git and workspaces | W5 |
| C2 | What a card row's JSON columns hold is cast by hand at about ninety places | Board and database | W7 |
| C1 | Board repeats the Store's sheet and history API method by method | Board and database | W8 |
| C3 | board.ts holds three subsystems that are not the board | Board and database | W9 |
| A1 | workers.ts is a grab bag: one 4,860-line class behind five banners | Workers | W11 |
| B1 | runtime.ts is the interface, the Claude Code runtime and a shell reader in one 1,167-line file | Runtimes | W13 |
| D1 | canvas.ts is four modules in one file, and CanvasRuntime alone runs 2,680 lines | Canvas and assistant | W14 |
| F1 | serve() is one 1,120-line function | HTTP server | W16 |
| J1 | types.ts is a grab bag: 89 functions and constants in a file called "shapes", several of them used by one side only | Core | W19 |
| H3 | Phone() is one 616-line component that does six jobs | UI: phone and panels | W21 |
| G1 | Canvas is one 2,045-line component with about 120 hooks | UI: app shell and card | W21 |
| G2 | Detail renders four kinds of card through early returns and some twenty booleans | UI: app shell and card | W22 |
| P1 | director.ts is five modules in one file | Plugin | W24 |
| R1 | scratch-obeya.ts stages in 580 lines of top-level statements | Scripts | W25 |
Each is a package that can land on its own. An agent takes one, reads its findings, checks each against the code again, and changes no behaviour.
| Workstream | Findings | |
|---|---|---|
| W1 | Dead code and stray comments | 26 |
| W2 | A workers test fixture that covers the common setups | 221 |
| W3 | A canvas test fixture | 12 |
| W4 | The rest of the test infrastructure | 51 |
| W5 | One git module | 342 |
| W6 | Small shared server helpers, each written once | 313 |
| W7 | A card's row and its events typed in one place | 145 |
| W8 | The sheet as an object of its own | 1 |
| W9 | board.ts holds the board after W7 and W8 | 11 |
| W10 | The pause protocol once for every kind of agent | 2 |
| W11 | workers.ts split along its seams, by moves only after W2 and W7 | 111 |
| W12 | The long functions of the workers after W11 | 68 |
| W13 | The runtimes | 117 |
| W14 | canvas.ts and coordinator.ts by subject after W3 | 115 |
| W15 | The commands | 24 |
| W16 | The HTTP server and the configuration | 149 |
| W17 | Sharing, demo sites and demo pages | 615 |
| W18 | Forges, the PR watcher, hosts and folders after W5 | 15 |
| W19 | src/core | 134 |
| W20 | The UI's shared mechanisms | 314 |
| W21 | The app shell and the phone after W20 | 236 |
| W22 | The card after W20 | 146 |
| W23 | The settings sheets and panels after W20 | 59 |
| W24 | The plugin | 1210 |
| W25 | The scripts and the desktop app | 146 |
n major n moderate n minor
No second opinion from Codex. The Codex review was stopped before it produced results, so the findings are one model's reading. About forty claims, the ones the 19 major findings rest on among them, were checked a second time against the code and held.
The tests were read in part. The shared test infrastructure and all setup code were read, the test bodies of the twelve largest files only to about 15 %.
Nothing was tried. No proposed change was compiled or run. Each finding says how sure its reviewer was.
41 bugs were noticed in passing. They are listed at the end of each findings file and are outside the cleanup, since fixing one changes behaviour.
docs/plan/code-cleanup.md is the plan doc: the goal, how the review was made, the rules for the agent that works from it, and the workstreams. Once it is on main, Obeya shows it as a project. The findings are in docs/plan/code-cleanup/, one file per area, each finding with where the code is, what it does now, the proposed change, the win, the risk and the reviewer's confidence.