symcc

How much board page logic is duplicated between Claude Code and OpenCode? #

Kept from task T-569 (answer written in .symcc/reports/T-569-try-1.md). Nothing here was run or re-checked: the line counts are estimates from reading the code.

The question #

How much board page logic is copied between Claude Code (terminal and VS Code) and OpenCode, and what would it take to move the page contents into shared core?

Short answer #

Every page has two or three copies. They agree on what to show and which keys and actions exist, but each copy writes those rules again. About 900-1,000 lines out of roughly 4,400 lines of page code are this kind of duplicate "what to show" logic (an estimate, not a measurement). Several copies have already drifted apart.

OpenCode's hooks/opencode/board-view.ts is already the plain-data shape wanted: colored lines, each with what a click does, plus key hints. So the cheapest path is to move those page builders into core, add the missing parts, and have the Claude Code terminal draw from them too. VS Code keeps its own layout but takes its labels, sections and actions from the same data. The task page has the most duplication and the most value. Start with its actions and its "what does it ask" rule.

1. Where each page is built #

All ui/ paths are under hooks/claude/. board-view.ts line numbers are in hooks/opencode/board-view.ts.

Page / partClaude terminalVS CodeOpenCodeRough duplicate lines
Band / stripui/above-prompt.tsx (88)same fileboard-view.ts bandDraw :188-226~35 (nearly line for line)
Board listui/list.tsx (190)ui/vscode-list.tsx (233)listBody :629-696~120
Task pageui/task-page.tsx (481)ui/vscode-task.tsx (443)openedPage, asksWhat, answerOptions, panelKeys (~70)~250
Question pageui/question-page.tsx (80, both looks)same fileopenedPage :711-716~20
Scouts list, page, runui/scouts-page.tsx (232)ui/vscode-scouts.tsx (282)scoutsBody, scoutPage :411-494~150
Settings list, pick / editui/settings.tsx :478-643ui/vscode-settings.tsx (115)settingsBody :582-625, plus the settings press in tui.ts (~25)~80
Roles / Kinds list and pageui/settings.tsx :1-476ui/vscode-roles.tsx (426)viewDefs, defsList, defPage :73-100, :501-578~250
Key hintscore/panel.ts taskKeys, scoutKeys and others :435-565none (buttons only)panelKeys :312-338 (its own copy)~40

The same in every copy (the logic):

Only drawing: Ink Boxes, Buttons and focus in the terminal; badges, folds, callouts and Markdown in VS Code; the "›" cursor, click areas and mouse wheel in OpenCode. The color names (claude, ide, inactive, ...) are already shared.

Sharing that exists today: rows use core helpers (panelSections, rowExtra, fitRow, detailRows, scoutRow, settingInfo, settingChoices, answerChoices). The key-hint lists in core/panel.ts are shared by the Claude screens, but OpenCode keeps its own copy.

Copies that already drifted apart #

  1. Task dates. Claude uses when in hooks/app/tools.ts:22 (local time, like "Nov 11, 09:30"). OpenCode has its own when (board-view.ts:273) that just cuts the stored ISO string. That string is UTC (hooks/app/store.ts:10), so OpenCode shows UTC times as if they were local.
  2. Role and kind text on the task page. Claude passes roles and kinds to detailRows (task-page.tsx:236). OpenCode passes roles: [] and no kinds (board-view.ts:720), so it shows no role description, role model or kind description. The view file has carried roles and kinds since T-562.
  3. Footer hints vs buttons on the Claude task page. Buttons are listed in task-page.tsx:343-380, hints in taskKeys (core/panel.ts:455), and VS Code has a third list in vsActions (vscode-task.tsx:102). The hints leave out p pause, u resume, h already merged and n needs review. They also leave out r retry for a dropped task, though that button exists. They show x drop only for backlog and failed tasks, while the Drop button takes x for every open task not in review.
  4. Text of a waiting task's question. Claude shows t.question, or "(no question)" (task-page.tsx:259, :432). OpenCode shows t.question || t.note || 'it waits for your answer' (board-view.ts:752).
  5. Question rows in the band. Claude always adds " — " plus the options, so a question without options ends in a stray " — " (above-prompt.tsx:73). OpenCode adds it only when there are options (board-view.ts:214).

Smaller ones:

OpenCode's task page also lacks whole parts: why it failed, the answer, history, report, runs, changes, and most buttons (only approve, reject and answer). That is missing work, not drift.

2. Proposed shape #

Add hooks/core/pages.ts (or core/pages/) next to panel.ts, built mostly by moving board-view.ts into core:

type PageLine = { segs: Seg[]; action?: ActionId | { open: string } | ... }
type Page = { head: PageLine[]; sections: { id, title, lines: PageLine[], fold?: boolean }[];
              actions: { id, label, key?, main? }[]; boxes?: (pick | text box)[] }

Stays per host on purpose:

3. Costs and risks #

4. Plan of small tasks, in order #

  1. Task page actions and "what it asks" in core (most value; start here). One taskActions(t, ctx) replaces the button list in task-page.tsx, vsActions, taskKeys and OpenCode's panelKeys, plus one shared asks/choices rule replacing answerable in task-page.tsx and asksWhat/answerOptions in OpenCode. Fixes drifts 3 and 4, and gives OpenCode pause, resume, retry, drop and the other actions.
  2. Shared date and role facts on the task page. One when in core; pass roles and kinds in OpenCode (drifts 1 and 2). Tiny.
  3. Band model (bandModel in core, both bands draw it). Small, nearly identical today, and a good first try of "model plus drawer". Fixes drift 5.
  4. Task page sections model (why it failed, answer, details, what to do, changes, history, report, runs). Terminal and OpenCode draw it; VS Code takes the sections' contents. OpenCode gains history and reports.
  5. Board list model. Questions, NEEDS YOU, running, then the folded groups with Done by day. Settle the backlog-open default and "show all".
  6. Scouts list, page and run model. The pages are already near line-for-line copies.
  7. Roles / Kinds list and page, and the Settings list. One defRow and defPage model with the turn-off and reset rules in core, shared by OpenCode's viewDefs and Claude's settings.tsx.
  8. Question page model (title, "asked by" line, choices).

Each task: keep the snapshot trees identical, or say up front that they will be recaptured.

How it was found #

By reading the page files for each host. No tests or screens were run. Line counts are estimates. Whether each drift is a bug or an unwritten choice was not checked; for drifts 1, 2, 3 and 5 nothing in the code suggests they were on purpose.

Queue task 1 (shared task page actions and asks rule) with hooks/core, hooks/claude/ui, hooks/opencode and tests/ as its files. Before it starts, decide which behavior wins for the two drifts it touches: the hint/button mismatch and the waiting-question text.