Skip to content

Parallelize the doc-sync and scaffold-sync surface sweeps and boots #1163

Description

@vivek7405

Problem

The two sync skills are the most parallelizable work the project has, and both run serially. webjs-doc-sync walks "the complete doc surface map" surface by surface (SKILL.md L31, L85, and the audit sweep at L104); webjs-scaffold-sync walks the scaffold surface map (L91, L179, audit at L214) and ends every change with the mandatory "generate + boot + check" verification, inline. Each surface check is an independent read (does surface X still tell the truth about change Y?), and each scaffold verification is an independent boot. Serially, a full audit is an hour; fanned out, it is the slowest single check.

Design / approach

  • webjs-doc-sync: the per-change procedure (L85) and the audit sweep (L104) fan out one read-only Explore agent per doc surface in one message, each answering "does this surface describe the changed behavior, and does it still tell the truth at head?", then the caller synthesizes and makes the edits itself. Edits stay in the main session: parallel WRITERS on overlapping docs would collide, so the fan-out is for the reads only.
  • webjs-scaffold-sync: the "generate + boot + check" verification (L179 procedure, and the per-row mandates in the L163 mapping) runs as background Bash tasks, one per affected template, in one batch, with all results collected before the sync is declared done. The audit sweep (L214) gets the same Explore fan-out as doc-sync.

Implementation notes (for the implementing agent)

  • Where to edit: .claude/skills/webjs-doc-sync/SKILL.md (the procedure at L85 and audit at L104), .claude/skills/webjs-scaffold-sync/SKILL.md (procedure L179, mapping rows L163 to L177, audit L214). Line numbers drift; grep the section headings.
  • Landmine: reads fan out, writes do not. State explicitly that the Explore agents report and the main session edits, because two agents editing AGENTS.md concurrently is a merge conflict factory.
  • Landmine: scaffold boots bind ports; parallel boots must use distinct ports or the ephemeral-port pattern the scaffold tests use (see test/scaffolds/* for the pattern). Check what the tests do and name it in the skill rather than hand-waving.
  • Landmine: mirror both skills to ~/.claude/skills/ in the same change (diff -q); the doc-sync and scaffold-sync globals drifted for months until 2026-07-28 (found stale during docs: make the self-review loop fast, parallel, and stall-proof #1159, describing the deleted agent-docs/ layout).
  • Invariants: AGENTS.md invariant 11 on new prose.
  • Tests / docs: node --test test/hooks/route-skills.test.mjs still passes; no other surface.

Acceptance criteria

  • doc-sync's per-change procedure and audit sweep fan out read-only Explore agents, one per surface, in one message
  • scaffold-sync's generate+boot+check runs as parallel background tasks with results collected before done is declared
  • Both skills state that reads fan out and writes stay in the main session, with the collision reason
  • The parallel-boot port question is answered concretely from the scaffold tests' pattern
  • All copies identical (diff -q for both skills)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions