Problem
VCQA reports standards D largely because several production files are still very large. This is valid PAGS technical debt, but it is not a single ready-to-pick implementation story unless it is treated as a tracking issue and split into smaller refactors.
Current line counts verified on 2026-08-07:
packages/sdk/src/voice/use-voice.ts — 1532 lines
workers/api/src/routes/coding.ts — 1738 lines
workers/api/src/routes/instances.ts — 1695 lines
workers/mcp/src/instance-tools/base.ts — 1778 lines
store/console/src/pages/InstanceDetail.tsx — 1230 lines
store/console/src/tabs/SettingsTab.tsx — 1148 lines
agents/coder/web/src/CodingTab.tsx — 1216 lines
Related narrower tickets already exist:
Fix direction
- Treat this as a tracking issue unless a dev explicitly picks one file/module boundary.
- Split by behavior boundary, not arbitrary line count.
- Add or preserve tests before moving behavior.
- Prefer small leaf modules for parsing, state derivation, route handlers, controller actions, and UI subpanels.
- Avoid broad refactors that mix route behavior, UI styling, and public API changes in one PR.
Ready child work candidates
- Extract voice audio/session/state-machine helpers from
packages/sdk/src/voice/use-voice.ts.
- Split
workers/api/src/routes/instances.ts into route registration plus small handler/service modules.
- Split
workers/mcp/src/instance-tools/base.ts into tool groups with shared helpers.
- Extract focused subpanels/hooks from
store/console/src/pages/InstanceDetail.tsx.
- Extract settings form sections from
store/console/src/tabs/SettingsTab.tsx.
- Extract Coder tab terminal/repo/session subpanels from
agents/coder/web/src/CodingTab.tsx.
Acceptance
- Each child PR names the boundary it is extracting and keeps behavior unchanged unless separately tested.
- Typecheck and relevant tests pass for each child PR.
- VCQA large-file/context findings improve over several focused PRs.
- A ratchet or CI check prevents the same files from growing back past the agreed threshold.
Problem
VCQA reports
standards Dlargely because several production files are still very large. This is valid PAGS technical debt, but it is not a single ready-to-pick implementation story unless it is treated as a tracking issue and split into smaller refactors.Current line counts verified on 2026-08-07:
packages/sdk/src/voice/use-voice.ts— 1532 linesworkers/api/src/routes/coding.ts— 1738 linesworkers/api/src/routes/instances.ts— 1695 linesworkers/mcp/src/instance-tools/base.ts— 1778 linesstore/console/src/pages/InstanceDetail.tsx— 1230 linesstore/console/src/tabs/SettingsTab.tsx— 1148 linesagents/coder/web/src/CodingTab.tsx— 1216 linesRelated narrower tickets already exist:
workers/api/src/routes/coding.tsFix direction
Ready child work candidates
packages/sdk/src/voice/use-voice.ts.workers/api/src/routes/instances.tsinto route registration plus small handler/service modules.workers/mcp/src/instance-tools/base.tsinto tool groups with shared helpers.store/console/src/pages/InstanceDetail.tsx.store/console/src/tabs/SettingsTab.tsx.agents/coder/web/src/CodingTab.tsx.Acceptance