symcc

Which of symcc's saved data is redundant or messy, and how to clean it up #

This note keeps the answer of task T-802. It was written on 2026-11-22 from the code at that time. File and line numbers point to that code and may have moved since.

The question #

Which of symcc's saved data is redundant or messy, and how to clean it up?

The short answer #

Four things cause most of the mess.

  1. The history saves facts as English sentences, and two separate sets of patterns read them back.
  2. One try's tokens and agent ids are kept in three to six places, and three writers must keep them in step by hand.
  3. Fields that belong to the running try sit loose on the task, and note quietly works as a state field.
  4. About ten one-time migrations still run on every read.

All four can be fixed with one migration of the owner's board, since no backward compatibility is needed.

How it was found #

The T-802 worker read the code only and changed no files. Files read: types/index.d.ts, hooks/core/board-file.ts, hooks/core/runs.ts, hooks/core/history.ts, hooks/core/board-parts.ts, hooks/core/stats.ts, hooks/core/live.ts, hooks/core/task.ts, hooks/core/events.ts, hooks/core/scouts.ts, hooks/core/passed-trees.ts, hooks/core/archive.ts, hooks/core/panel.ts, hooks/core/banner.ts, hooks/app/state.ts, hooks/app/lead.ts, hooks/app/checker.ts, hooks/app/debrief.ts, hooks/app/workers.ts, hooks/opencode/view.ts and hooks/opencode/board-view.ts.

What it could not check: the Bash guard refused every read of the owner's .symcc/ folder ("names .symcc in the owner's copy"). So there are no real figures from the owner's board, such as how many tries still hold unsplit tokens, how many history lines are old strings, or whether attempts ever differs from runs.length. Every example below is from the code, with file:line. Anything not confirmed is marked as a guess. (Below, "I" is the T-802 worker.)

The findings, in order of value #

1. History lines: the facts live only in the text, and two pattern sets read them back (high value, medium-large change) #

Where:

How the facts get re-read from the text:

Fix: give each entry structured fields: try?: number, step?: 'worker-start' | 'handed-back' | 'prep' | 'checker' | 'queue' | 'tests' | 'merge', place?, result?: string (the part after the arrow), reason?: FailReason. Write them where the line is made. Then:

This touches every place that writes history (mostly withHistory calls in workers.ts, review.ts, tools.ts, cleanup.ts and checker.ts), so it is the biggest change here and the one that removes the most fragile code.

2. One try's tokens are kept in up to four places (high value, medium change) #

Where (types/index.d.ts:18-57, hooks/core/runs.ts):

Why it is a problem:

Fix: make run.agents[] the only place tokens and cost are kept per try. Work out tokens and checker_tokens from it with a helper (tryTokens(r), checkerTokensOf(r)).

3. "Who worked on this try" is kept in six places (high value, medium change) #

Where:

Why it is a problem:

Fix: keep run.agents[] as the single list. Add an ended_by: 'restarted' (or a restart reason) on the entry in place of restarts[].agent.

The many t.agent readers (agents.ts, workers.ts, cleanup.ts, git.ts, doctor.ts) would call a helper instead.

4. Per-try fields sit loose on the task (medium-high value, medium change) #

Where: BoardTask (board-file.ts:108-130) carries session, finishing, checking, merge_wait, extra_minutes, time_ask, wrap_up, try_question, try_refused, checker, plus test_output and merge_main on SymccTask. All of them mean something only for one try or one status.

Why it is a problem:

Fix: move the try-only fields onto the open run, or into one task.live object, and clear them in one place when the try ends. Keep only merge_main on the task, as "next try merges main first", and store it only when true. Merge finishing into checking, using one at as the heartbeat.

5. note works as a hidden state field, and the stop reason is written three times (medium value, medium change) #

Where:

Fix: keep note for words to the owner only, and never test it in code.

6. Questions are kept in five shapes (medium value, small-medium change; best done together with T-801) #

Where:

Fix: use one Ask record, { by: 'worker' | 'lead' | 'symcc', text, options?, files?, asked_at, answer?, answered_at? }.

7. attempts vs runs.length (medium value, small change once checked) #

Fix: first run the probe at the end to see whether any task differs. If none do, make attempts a helper (runs.length) for open tasks.

8. Migrations that still run on every read (medium value: clarity and less code; small-medium change) #

These run on every load of board.json, archive.json or scouts.json:

Fix: one script, or one /symcc-doctor step, that loads every data file (board, parts, archive chunks, scouts.json, runs files), saves it once in the current shape and keeps a backup. Then delete all of the above and their tests. The only thing I could not check is whether some of the owner's data still needs them.

9. Scout data is kept twice (low-medium value, small change) #

Fix: drop last_report and last_run from scouts.json and read them from the newest run. Keep paused and usage, and maybe cut days to a year. Work out scouts_running from scouts[].running.

10. The view (PaneView / .symcc/view.json) (low value, small change) #

Fix: rename the view fields (on_here, notify_now, home_branch), or build them in the client. Once history has reason, keep it on the marks.

11. Small things #


Suggested order of work (each one task, each followed by the one-time migration) #

  1. Findings 8 and 11: a one-time migration step, then delete the old-shape code. Small to medium, and it makes the rest easier.
  2. Findings 2 and 3 together: run.agents[] as the only store of agent ids and tokens. Medium.
  3. Finding 1: structured history fields. Large; the parsers go.
  4. Findings 4 and 5: a live object and a note that code never tests. Medium.
  5. Finding 6: fold into T-801 before it adds question_lead.
  6. Findings 7, 9 and 10: small follow-ups.

Next step: before planning, run a read-only probe on the real board in the main folder (I was not allowed to). It should count:

The fake host in tests/fake-host.ts together with readBoard and joinedText from hooks/core can do this from /tmp. Its result says which migrations are still needed and how big step 1 really is.