Upstream Convergence
Safely move a maintained fork to a pinned upstream commit without silently
discarding product-owned behavior or turning historical commit archaeology into
the recurring workflow.
Success Evidence
A completed refresh reports:
- the exact worktree, branch, starting
HEAD, merge base, local commit, upstream
commit, canonical remote URL, and remote-tracking tip;
- conflict and residual counts by repository-defined lane and contract;
- governance changes, guard violations, waiver counts, and stale waivers;
- one append-only evidence snapshot for a new upstream range;
- repository-defined tests and builds run only after the structural review;
- remaining product decisions, blockers, and the next safe action.
Never describe a refresh as complete merely because it compiles or merges.
Authority Boundary
The shared skill owns trigger recognition, safe orchestration, phase boundaries,
reporting, and handoff. The repository owns all product policy and enforcement:
- upstream identity and adapter metadata;
- path lanes, contract IDs, and conflict semantics;
- snapshots, guard manifests, waivers, and historical anchors;
- exact tests, builds, CI, release gates, and branch policy.
Do not copy repository-specific rules into this skill. Read root AGENTS.md,
then locate upstream/convergence-policy.json and the repository-local driver.
Read references/repo-adapter.md before executing that driver.
Workflow
1. Orient
- Read applicable
AGENTS.md files and the active GitHub plan.
- Identify the current branch, repository default branch, all linked worktrees,
dirty state, in-progress Git operations, remotes, and existing refresh owner.
- Verify the adapter schema, repository-relative paths, canonical upstream
identity, and repository driver before executing candidate-owned code.
- If the repository is GitHub-backed, use
$github-plan for durable status and
$github for PR operations. Chat plans are execution aids, not recovery state.
2. Isolate
Create or select a focused linked worktree from the intended integration head.
Never edit the default branch, a shared release/candidate branch, the primary
checkout, or another session's worktree. Never reset, stash, clean, switch, or
delete another session's state.
Read references/git-safety.md when worktrees, concurrent sessions, remote
identity, provenance, resource pressure, or rollback are relevant.
3. Pin and Inspect
- Confirm the configured upstream remote URL before fetching.
- Fetch without changing the current branch, then resolve the merge base,
upstream target, and local baseline to full immutable commit IDs.
- Run the repository driver's
inspect phase with those exact IDs.
- Review governance, red/manual, and contract-adapted paths before merging.
- Treat green paths as upstream-owned unless the repository names a contract.
Do not make commit-by-commit inspection the normal integration unit. Use it only
for a bounded red/manual contract or forensic question that the range inventory
cannot answer.
4. Apply
Apply the pinned upstream range in the isolated worktree. Preserve upstream
behavior by default, synthesize only repository-named contracts, and resolve
governance conflicts manually. Do not auto-resolve product identity, state-home,
authentication, release, model-default, or other red/manual boundaries.
Review source and build-system changes before running candidate-provided builds,
hooks, generators, or package scripts. Structural inspection is safe to perform
first; untrusted execution is not.
5. Record and Validate
Use the repository driver's phases rather than rewriting Git plumbing:
record writes one new snapshot atomically and refuses overwrite;
validate checks governance wiring, semantic guards, snapshot structure and
reproducibility, and historical snapshot mutation against a pinned base;
- repository tests and builds then validate the named product contracts.
Never regenerate a pre-anchor ownership baseline from the current candidate.
Never rewrite an existing snapshot to match a newer classifier. Version the
policy and preserve the historical evidence instead.
6. Review and Publish
Use independent agents for semantic-contract, security/provenance, and
operations/release review when those surfaces changed. Give reviewers exact
worktree and commit provenance; discard reviews performed against the wrong
checkout.
Commit and push only a focused task branch. Open or update a PR rather than
pushing directly to the default or shared candidate branch. Read
references/review-handoff.md before updating durable status or PR evidence.
When a repository adds routing to this skill in the same rollout, land the
shared skill first and reconcile the active runtime skills checkout before
landing the repository route.
Refuse or Stop
Refuse write phases when any of these are true:
- the adapter is missing, unknown, unsafe, or points outside the repository;
- the worktree is dirty, detached, primary/shared, on a protected branch, or
already running a merge, rebase, cherry-pick, or revert;
- refs are symbolic or ambiguous instead of full commits;
- the upstream URL does not match the adapter, the commit is unreachable from
the configured tracking ref, or upstream history moved backward;
- another convergence operation holds the repository lock;
- an existing snapshot would be overwritten or historical evidence changed;
- the immutable guard baseline would be advanced as part of routine refresh;
- governance files would be auto-resolved or CI enforcement weakened;
- a build requires executing unreviewed upstream code, unavailable credentials,
or unbounded disk, network, time, or output.
Ask the user only for a genuine product-policy decision, unavailable credential,
or irreversible live-system authorization. Resolve ordinary Git, test, and
review work autonomously.
Result Contract
Return a bounded status containing exact SHAs and provenance, conflict/residual
counts, affected lanes/contracts, governance changes, guard and waiver counts,
tests performed, PR/check state, blockers, and the next safe action. Keep large
path sets in generated artifacts rather than terminal output.
1---2name: upstream-convergence3description: Use when asked to update, refresh, synchronize, converge, or forward-port a maintained downstream fork against its upstream repository, including recurring upstream snapshot integrations and guarded fork cutovers. Do not use for an ordinary feature-branch merge, a one-off cherry-pick, or discussion of an upstream API that does not change the fork's upstream baseline.4---56# Upstream Convergence78Safely move a maintained fork to a pinned upstream commit without silently9discarding product-owned behavior or turning historical commit archaeology into10the recurring workflow.1112## Success Evidence1314A completed refresh reports:1516- the exact worktree, branch, starting `HEAD`, merge base, local commit, upstream17 commit, canonical remote URL, and remote-tracking tip;18- conflict and residual counts by repository-defined lane and contract;19- governance changes, guard violations, waiver counts, and stale waivers;20- one append-only evidence snapshot for a new upstream range;21- repository-defined tests and builds run only after the structural review;22- remaining product decisions, blockers, and the next safe action.2324Never describe a refresh as complete merely because it compiles or merges.2526## Authority Boundary2728The shared skill owns trigger recognition, safe orchestration, phase boundaries,29reporting, and handoff. The repository owns all product policy and enforcement:3031- upstream identity and adapter metadata;32- path lanes, contract IDs, and conflict semantics;33- snapshots, guard manifests, waivers, and historical anchors;34- exact tests, builds, CI, release gates, and branch policy.3536Do not copy repository-specific rules into this skill. Read root `AGENTS.md`,37then locate `upstream/convergence-policy.json` and the repository-local driver.38Read `references/repo-adapter.md` before executing that driver.3940## Workflow4142### 1. Orient43441. Read applicable `AGENTS.md` files and the active GitHub plan.452. Identify the current branch, repository default branch, all linked worktrees,46 dirty state, in-progress Git operations, remotes, and existing refresh owner.473. Verify the adapter schema, repository-relative paths, canonical upstream48 identity, and repository driver before executing candidate-owned code.494. If the repository is GitHub-backed, use `$github-plan` for durable status and50 `$github` for PR operations. Chat plans are execution aids, not recovery state.5152### 2. Isolate5354Create or select a focused linked worktree from the intended integration head.55Never edit the default branch, a shared release/candidate branch, the primary56checkout, or another session's worktree. Never reset, stash, clean, switch, or57delete another session's state.5859Read `references/git-safety.md` when worktrees, concurrent sessions, remote60identity, provenance, resource pressure, or rollback are relevant.6162### 3. Pin and Inspect63641. Confirm the configured upstream remote URL before fetching.652. Fetch without changing the current branch, then resolve the merge base,66 upstream target, and local baseline to full immutable commit IDs.673. Run the repository driver's `inspect` phase with those exact IDs.684. Review governance, red/manual, and contract-adapted paths before merging.695. Treat green paths as upstream-owned unless the repository names a contract.7071Do not make commit-by-commit inspection the normal integration unit. Use it only72for a bounded red/manual contract or forensic question that the range inventory73cannot answer.7475### 4. Apply7677Apply the pinned upstream range in the isolated worktree. Preserve upstream78behavior by default, synthesize only repository-named contracts, and resolve79governance conflicts manually. Do not auto-resolve product identity, state-home,80authentication, release, model-default, or other red/manual boundaries.8182Review source and build-system changes before running candidate-provided builds,83hooks, generators, or package scripts. Structural inspection is safe to perform84first; untrusted execution is not.8586### 5. Record and Validate8788Use the repository driver's phases rather than rewriting Git plumbing:8990- `record` writes one new snapshot atomically and refuses overwrite;91- `validate` checks governance wiring, semantic guards, snapshot structure and92 reproducibility, and historical snapshot mutation against a pinned base;93- repository tests and builds then validate the named product contracts.9495Never regenerate a pre-anchor ownership baseline from the current candidate.96Never rewrite an existing snapshot to match a newer classifier. Version the97policy and preserve the historical evidence instead.9899### 6. Review and Publish100101Use independent agents for semantic-contract, security/provenance, and102operations/release review when those surfaces changed. Give reviewers exact103worktree and commit provenance; discard reviews performed against the wrong104checkout.105106Commit and push only a focused task branch. Open or update a PR rather than107pushing directly to the default or shared candidate branch. Read108`references/review-handoff.md` before updating durable status or PR evidence.109110When a repository adds routing to this skill in the same rollout, land the111shared skill first and reconcile the active runtime skills checkout before112landing the repository route.113114## Refuse or Stop115116Refuse write phases when any of these are true:117118- the adapter is missing, unknown, unsafe, or points outside the repository;119- the worktree is dirty, detached, primary/shared, on a protected branch, or120 already running a merge, rebase, cherry-pick, or revert;121- refs are symbolic or ambiguous instead of full commits;122- the upstream URL does not match the adapter, the commit is unreachable from123 the configured tracking ref, or upstream history moved backward;124- another convergence operation holds the repository lock;125- an existing snapshot would be overwritten or historical evidence changed;126- the immutable guard baseline would be advanced as part of routine refresh;127- governance files would be auto-resolved or CI enforcement weakened;128- a build requires executing unreviewed upstream code, unavailable credentials,129 or unbounded disk, network, time, or output.130131Ask the user only for a genuine product-policy decision, unavailable credential,132or irreversible live-system authorization. Resolve ordinary Git, test, and133review work autonomously.134135## Result Contract136137Return a bounded status containing exact SHAs and provenance, conflict/residual138counts, affected lanes/contracts, governance changes, guard and waiver counts,139tests performed, PR/check state, blockers, and the next safe action. Keep large140path sets in generated artifacts rather than terminal output.