/upstream-sync:upstream-syncfrom upstream-sync
Investigates a local web app against its upstream product clone feature-by-feature using serial browser investigators, produces gap files with TDD tasks and a prioritized roadmap, then implements the roadmap on agent branches gated into a known-good local main.
Ships in upstream-sync. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Bring a local app to near-exact parity with the upstream product it mirrors: same features, DOM structure, class names and CSS values, minus anything with no local meaning. The investigation only writes under .llm/upstream-sync/. Implementation comes afterward, from the roadmap, on agent branches that each pass a per-commit gate before local main moves.
The engine is a Workflow script, <plugin-root>/scripts/upstream-sync-workflow.js. Resolve <plugin-root> first: in Claude Code use ${CLAUDE_PLUGIN_ROOT}; in Codex use the plugin root that contains this skills/upstream-sync/SKILL.md file. Codex has no Workflow tool, so it runs the same phases by hand; see the Codex section below. The script runs:
features/<slug>.md and returns any new features it discovered, which join the queue, so the investigation recurses.maxCriticRounds completeness reviews, each adding missed features, until a round adds nothing.SUMMARY.md, a roadmap ordered by milestone.The orchestrator owns features.md and rewrites it every registryEvery investigations. Investigators never edit it, so the queue never gets duplicate or conflicting rows.
Find out whether interacting with upstream or the local app changes real data. For example, both sides may write to the user's real account, or opening a page may create a record. Ask the user (with AskUserQuestion in Claude Code), offering these options:
Also check whether an upstream page is bridged to something live outside the browser. Existing claude.ai sessions, for example, may be connected to running local terminals, so a keystroke in the wrong tab acts on the user's machine. The rules must then name the only pages where writes are allowed (for claude.ai: the bare new-session page, or a session the agent created itself), and every agent must re-read location.href in the same step as any type, click or key action. A screenshot taken before an earlier action proves nothing about where the next one lands.
Create the sandbox through the project's own write path (its CLI or API), never by editing a cache or database directly. Then verify that it exists, and that it exists exactly once.
Write the rules as concrete, checkable instructions. Include the sandbox's id and URL, and the shortcuts that act on the focused item, so investigators verify focus before pressing them. These rules become the safety arg.
Create .llm/upstream-sync/ and confirm it is gitignored. Then fill it:
README.md: copy protocol-template.md from this skill's directory and replace every {{PLACEHOLDER}}. {{CONTEXT}} says how the local app differs from upstream on purpose: local extras to keep, upstream features that will never apply.features.md: a stub. The workflow overwrites it once the survey finishes.features/ and dumps/: create empty.If an earlier sync left this directory behind, read its README.md Tips and SUMMARY.md first. Carry the lessons forward instead of starting over.
To reuse an earlier run's queue, pass it as seed instead of re-surveying. Audit features.md first: a row marked done is only real if its features/<slug>.md exists and its notes describe findings. A row whose notes say the agent declined, answered another question, or did not investigate is a placeholder; seed it without existing. Seed real rows with existing: true, and seed todo and failed rows as they are.
Check that the local dev server is listening on the expected port and that an HTTP request returns a non-error response, before launching. Also confirm the user is logged in to upstream in the browser profile your browser tools drive: claude-in-chrome in Claude Code, or whichever browser MCP is connected in Codex. If no browser tool is available, stop and tell the user; the investigation can't run on code alone.
Call Workflow with scriptPath: <plugin-root>/scripts/upstream-sync-workflow.js and these args:
| Arg | Meaning |
|---|---|
dir | Absolute path of the sync directory |
upstreamName, upstreamUrl | The product being cloned and where to reach it |
localName, localUrl | The local app and its running dev URL |
localSource | Absolute path of the local source |
context | Intentional differences, as in {{CONTEXT}} |
safety | The concrete safety rules; this text goes into every browser prompt |
surveyFocus | Optional: surfaces and features to make sure the survey covers |
inventoryFocus | Optional: local areas to make sure the inventory covers |
acknowledgedIncidents | Optional: slugs whose investigator incidents the user has reviewed, so a resumed run records them and continues |
approvedExceptions | Optional: actions the user approved after an incident; this text goes only into investigator prompts |
acknowledgeSurveyIncidents | Optional: true once the user has reviewed a survey incident, so a resumed run continues |
only | Optional: a list of {slug, name, priority, notes} to re-investigate, skipping the broad and critic phases and merging rows into features.md |
seed | Optional: a list of {slug, name, priority, notes, existing?} that replaces the broad phase; critic rounds still run. existing: true makes the investigator re-verify that feature's file instead of rebuilding it |
maxInvestigations | Default 150; anything left over is listed as not investigated |
maxCriticRounds | Default 3 |
registryEvery | Default 6; how often features.md is rewritten |
Launch or resume the run only in a turn where the user's latest message asks for it. Workflow subagents read the user's most recent message as the request they are serving, and on an unrelated question they decline the browser work and report investigated: false, which marks every feature they touch failed. If the run needs relaunching after the user asked something else, ask them to say so first.
The run is long. Tell the user the run id, that /workflows shows progress, and that features.md plus the features/ file count are the live progress readout.
Codex has no Workflow tool, so you are the orchestrator and do by hand what the script does. The script stays the single source of truth for the briefs: read <plugin-root>/scripts/upstream-sync-workflow.js and reuse its local-inventory, survey, investigator, critic and summary prompts verbatim, filling each ${...} from the same args you would have passed.
features.md yourself, as the script's writeRegistry does: dedup slugs case-insensitively, and always take the next todo row in P1, then P2, then P3 order.features.md, and check its safety report. Stop at the first incident, exactly as the script would.failed, record its reason in the features.md row, and move on.SUMMARY.md with the summary prompt.features.md is the resume point: a fresh session continues from the first todo row.Don't edit the local source. The dev server hot-reloads under the investigators, and the findings would describe a moving target. Batch any bugs worth fixing until the run ends.
The workflow stops at the first reported incident. A survey incident stops it before any investigation; an investigator incident stops it after that investigation, and the summary is still written.
resumeFromRunId, so completed agents replay from cache. Keep safety, context and the survey args unchanged: changing any text in a cached prompt re-runs that agent and everything after it. Put newly approved actions in approvedExceptions, set acknowledgeSurveyIncidents: true when the incident came from the survey, and add the investigator's slug to acknowledgedIncidents when it came from an investigator; neither changes a prompt, so the cache still replays. Update the README's Tips to match the decision.An investigator whose agent dies (a network drop, a terminal API error) or declines is not retried. The feature is marked failed, its features.md row records the reason, and the run moves on. Don't stop the run to fix it: the result lists the failed slugs. After the run finishes, launch a fresh Workflow with the same args plus only set to those features (take name, priority and notes from features.md). Never run it while the main run is still going, because the two would fight over the browser.
Read SUMMARY.md and the result's notInvestigated and failed lists, and report them. The usual next step is to import the roadmap into .llm/todo.md with the markdown-tasks import-plan skill, then implement it.
Implementers may run in parallel, each on its own branch. Local main is the base every new worktree starts from, so it must always be known-good: it only fast-forwards, and only to commits that are already rebased onto it and already pass git test run per commit. Never cherry-pick work onto main and gate it afterwards.
Integrate each implementer branch with the same loop as the git plugin's rebase-all skill and the build plugin's test-all skill, scoped to one branch with local main as the base:
main (git worktree add -b <branch> <path> main). Agent worktree isolation branches from origin/main instead, so don't rely on it.main and run git test run main..<branch>.git commit --fixup <breaking sha>, replay the rest of the branch with git replay --onto HEAD HEAD^..<branch>, then GIT_SEQUENCE_EDITOR=true git rebase --autosquash main. Rerun git test run main..<branch> until every commit passes. Never run git test forget-results.git merge --ff-only <branch>.If a commit doesn't rebase or cherry-pick cleanly, abort. Don't rescue it by resolving the conflict, and don't read the conflicting diff. Wait until no other branch is integrating, then redo that task serially in a fresh subagent from its task description, on a new branch from main.
Tests that validate the user's live on-disk data, such as a schema check against real files, fail on every commit before the schema-drift fix that makes them pass. Put schema-drift fixes first, or fold them into the branch's first commit, before gating; otherwise every earlier commit reports a failure that isn't its own.
When origin/main moves, rebase promptly, while the gap is a few commits rather than dozens. git-test caches results per tree, so a rebase invalidates every result on the rebased commits and a long-diverged one forces a full re-gate. Rebase main's unpushed commits onto origin/main on a temporary branch, gate it with git test run origin/main..<temp>, and only then move main to it; then rebase the in-flight work branches onto the new main.
Keep the branch count minimal so the user can follow the state: delete merged, backup and leftover branches as soon as they stop being needed. Report the state as "main (known good, N ahead of origin/main) + these work branches".
Parity checks in the browser during implementation follow the same data-safety rules as the investigation, including the location.href check before every write action.
Append any lesson that would help the next project to the Tips section of plugins/upstream-sync/skills/upstream-sync/protocol-template.md in the plugin's source repository, not the installed plugin cache, and not only to the project's README.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub motlin/claude-code-plugins --plugin upstream-syncOther plugins' skills for the same job