18 KiB
up-parallel-work-integrate — Cross-cutting branch integration
Objective
Turn independently completed lane branches into one reviewable, verified master-lane result without treating Git's textual merge as governance reconciliation. Preserve each lane's product work and evidence, resolve shared-artifact conflicts by contract and source-of-truth rules, and canonicalize branch-local governance before a Gate can promote scope.
Branch-local governance IDs and current-status summaries are provisional until this skill completes. This skill does not replace up-traceability-gate: integration establishes a coherent candidate tree; the gate decides whether stories are Delivered.
Parameters
Invoke with one or more source branch names. Use two or more when all lanes were developed away from the target; one source is valid when another lane was implemented directly on the checked-out master lane:
/up-parallel-work-integrate <branch-1> [branch-2 ...]
- Target: the currently checked-out branch, called the master lane.
- Sources: branch arguments, integrated serially in the supplied order.
- Branch arguments may be local names or remote-tracking names such as
origin/lane-a. - Never infer branches from naming patterns, open pull requests, or recent commits.
- Never use the current branch as a source argument.
When to invoke
- After one or more lanes in an approved
parallel_work_plan.mdhave pushed complete branches and must converge with the master lane. - Before Gate 14.1, release integration, or any status promotion based on combined lane evidence.
- To recover when lane branches independently edited governance registers and generated duplicate IDs or contradictory current summaries.
- To resume an integration that was deliberately paused mid-merge (context limit, handoff to another agent/session) — read its interim
integration_manifest.md(merge_state: in_progress) rather than starting over.
Do not invoke while a source lane is still changing, or while an earlier merge/rebase/cherry-pick is git-unresolved (conflict markers present). A cleanly paused integration recorded as merge_state: in_progress should be resumed once the target is checked out and clean, not treated as a blocker. Do not invoke when the intended target branch is not checked out.
Read first
- Repository instructions (
AGENTS.mdand applicable nested instructions). - Latest relevant checkpoint and its referenced registers.
- Current iteration's
parallel_work_plan.md,iteration_plan.md,iteration_backlog.md, anditeration_surface_matrix.mdwhen present. 00_process_control/change_request_register.md,defect_register.md,ambiguity_register.md,decision_log.md,traceability_graph.md, and checkpoint index.- Each source branch's required session transcript and lane verification/evidence summary.
- The governing requirements, architecture, contracts, and tests for files changed by more than one lane.
Safety Invariants
- Do not push, force-push, rewrite source branches, amend commits, or alter remote history.
- Do not discard unrelated target or source changes. Never resolve a conflict using blanket
oursortheirsacross a file. - Do not start from a dirty target worktree. A transcript created for the integration session is permitted only after its initial user request has been recorded; all other changes must be committed/stashed by their owner or explicitly dispositioned before integration.
- Integration requires durable merge commits. Before starting the first merge, obtain explicit user authorization to create the source merge commit(s) and one governance-reconciliation commit. If authorization is absent, stop after analysis/inventory and ask; do not enter a merge state. A skill invocation that explicitly asks to integrate/merge the named branches is sufficient commit authorization, but automatic skill matching or an analysis-only request is not. Never push unless explicitly requested. Preserve source histories with merge commits unless the repository's approved plan requires another strategy, and inspect each staged result before committing it.
- Do not allocate a canonical governance ID from filename order alone. Inspect the complete repository for the highest existing canonical ID and the semantic identity of each colliding entry.
- Do not promote stories, close a Gate, or overwrite authoritative current counts based only on branch-local evidence.
- Stop for human disposition when conflicts imply different requirements, architecture, scope, NFRs, or approved decisions. Invoke
up-change-request-impactbefore changing the baseline.
Procedure
1. Validate Invocation and Repository State
- Require at least one branch argument and reject duplicates.
- Record the checked-out target branch and target HEAD. Confirm it is not one of the sources.
- Confirm no merge, rebase, cherry-pick, or revert is in progress and the target is clean apart from the owned session transcript.
- Check the active iteration directory for an existing
integration_manifest.md. If one is present withmerge_state: in_progressorcandidate_commit: pending, this is a paused, not a failed, integration: read its recorded source order, captured SHAs, and already-created merge-commit SHAs, and resume from the next unmerged source instead of starting over. Never begin a second, overlapping integration attempt against the same target while one is already in progress. If the recorded state looks abandoned rather than paused (e.g. stale beyond this session's continuity, or the user disputes it), obtain explicit user disposition — resume or explicitly abandon/archive it — before superseding it. - Verify every source ref resolves to a commit. Fetch only when needed and permitted; do not pull or mutate branches.
- Compute a merge base between the target and every source. Stop if histories are unrelated.
- Read
parallel_work_plan.mdand compare supplied order with its approved merge order. If they differ, stop and request confirmation or correction. - Confirm explicit authorization for the required merge and governance-reconciliation commits. Without it, complete inventory only and stop before merging.
- Capture target/source SHAs, merge bases, existing untracked files, and pre-integration test baseline in the session transcript. Resolve and merge the captured source SHAs, not movable branch names.
2. Inventory Every Lane Before Merging
For each source, inspect the full diff from its merge base and its commits. Build a lane inventory containing:
- Product code, tests, migrations, configuration, contracts, and generated artifacts changed.
- Shared files changed by another source or the target.
- Governance entries added/changed:
CR-*,DEF-*,AMB-*,DEC-*,TC-*test-case IDs, assumptions, risks, Gate findings, checkpoint IDs/files/index rows, traceability rows, current-status summaries, and artifactlast_cr/version metadata. - Lane evidence: commands, pass/fail/skip counts, runtime identifiers, unresolved blockers, and requirement-rooted findings.
- Missing transcript/evidence or edits outside the approved lane boundary.
Classify overlaps before merge:
- Independent: no shared contract or file.
- Textual overlap: same file, compatible intent.
- Contract overlap: API/schema/configuration/security behavior changed by multiple lanes.
- Governance overlap: IDs, dispositions, status summaries, or checkpoints overlap.
- Baseline conflict: incompatible requirements/architecture decisions; requires human/CR disposition.
3. Establish the Canonical Governance Map
Use the target-at-start as the canonical pre-integration baseline. For every branch-local entry, compare ID, title, trigger/root cause, owning requirement/story, affected artifacts, disposition, and evidence.
Apply these rules:
| Collision | Canonical action |
|---|---|
| Same ID, same meaning | Keep one ID; merge complementary chronology/evidence without duplicating claims. |
| Different IDs, same meaning | Keep the earliest valid canonical ID unless an approved reference dictates otherwise; collapse the duplicate. |
| Same ID, different meaning | Preserve the target's valid existing meaning; allocate the next unused canonical ID to the distinct source entry. |
| Different IDs, related but distinct | Keep both and add explicit cross-references; do not collapse root cause and symptom unless the governing skill says they are one record. |
| Conflicting dispositions | Follow explicit approved human decisions and authoritative integrated evidence; otherwise leave open and request disposition. |
| Conflicting current counts/status | Recompute from story-level integrated evidence; never choose one branch's summary wholesale. |
| Checkpoint collision | Allocate the next canonical CKPT-NNN, rename the file, update index and references; preserve each lane transcript as historical evidence. Handle either lane-side convention encountered: a full branch-local checkpoint-NNN file marked provisional (current up-context-checkpoint guidance), or an older lane-scoped stub file a lane kept outside the global sequence per its own parallel_work_plan.md — both resolve to one allocated canonical CKPT-NNN. |
Gate finding ID collision (G141-YYYYMMDD-NN) |
The date segment is a namespace, not a global counter: before assigning the next NN, search all sources plus the target for existing findings on that same date. A same-date collision from two sources gets the next unused NN for that date, never a reused one. |
Prepare an old-to-canonical ID map per source before final governance edits. Search and update every semantic reference across registers, traceability, iteration artifacts, requirements/design metadata, tests/evidence documents, and checkpoints where a branch-local ID was intended as a durable repository reference. Session transcripts are append-only historical records: never rewrite prior entries; append a canonicalization note and mapping to the current integration transcript instead.
When more than one distinct entry of the same ID type needs a new canonical ID, allocate in a deterministic order — by source-argument order, then by ascending branch-local ID within a source, then by commit chronology — so re-running this step from the same captured SHAs (for example, after a paused integration resumes) reproduces the identical mapping rather than a different one.
4. Merge Sources Serially
For each source in supplied order:
- Merge the captured source SHA with
--no-ff --no-commitso even a fast-forward topology remains inspectable before any merge commit. - Resolve product conflicts using the approved contract, architecture, and smallest complete combined behavior. Preserve independent tests from both lanes.
- Resolve governance files semantically using the canonical map, not line selection.
- After conflicts are resolved and narrow checks pass, create the authorized non-interactive merge commit, then continue to the next source. Do not amend, squash, or push.
- Run the narrowest relevant static/unit tests after each materially overlapping source.
- If a source reveals an unapproved baseline conflict, stop. Preserve diagnostic state only if safe; otherwise abort the in-progress merge without changing pre-existing target work, record the blocker, and request disposition.
- After each source's merge commit is created, write or update an interim
integration_manifest.mdwithmerge_state: in_progress, the sources merged so far and their merge-commit SHAs, and the sources still pending — before moving to the next source. If this session must pause before every source is merged (context limit, handoff to another agent or machine), invokeup-context-checkpointrecording the manifest's path and state, so a resuming session continues from the next unmerged source instead of re-merging or restarting.
5. Reconcile the Integrated Governance State
After all product changes are combined:
- Apply the complete canonical ID map atomically.
- Preserve dated Gate snapshots and lane evidence as history.
- Recompute candidate current story statuses and counts from approved deferrals and story-level evidence already available; label any status awaiting integrated verification as pending rather than authoritative.
- Keep failed, skipped, or incompletely evidenced stories
PARTIAL/Blocked; do not silently convert them to Deferred. - Preserve Deferred scope only when an approved
CR-*/DEC-*supports it. - Update shared candidate current-status fields consistently across the traceability graph, surface matrix, iteration plan/backlog, work plan, registers, and checkpoint index. Do not commit yet and do not mark new scope Delivered here.
- Update
integration_manifest.mdin the active iteration directory tomerge_state: complete, superseding the interim per-source state from Step 4.7. Record target branch and starting SHA; ordered source names, captured SHAs, merge bases, and source merge commit SHAs; changed/shared artifacts; old-to-canonical governance ID map; conflict resolutions; planned verification commands; unresolved blockers; andcandidate_commit: pending. This is the durable input toup-traceability-gateafter finalization.
6. Verify the Integrated Result
Run, in order, against the fully merged and governance-reconciled candidate:
- Conflict-marker and repository-status checks.
- Duplicate canonical governance-ID scan by register/artifact type.
- Dangling-reference scan for every renumbered ID.
- Current-status consistency check across authoritative summary artifacts.
- Narrow tests for each lane and each conflict-resolved shared component.
- Broader integrated regression/build/runtime/browser evidence required by
parallel_work_plan.md. - If any required check fails, update the pending manifest with the failure, keep affected statuses non-Delivered, and do not create the reconciliation commit or invoke the Gate. Record the exact corrective next action.
- If all required checks pass, finalize previously pending current statuses from the completed integrated evidence without promoting scope that still requires Gate 14.1. Update the manifest with commands/results and
gate_ready: true; stage the canonical governance changes, manifest, and post-integration checkpoint together; inspect the staged diff; then create the authorized governance-reconciliation commit. - Resolve the resulting commit SHA, replace
candidate_commit: pendingwith that SHA, setmanifest_finalized_forto the same SHA, and create a small authorized manifest-finalization commit containing onlyintegration_manifest.md. Record both SHAs. Gate verification must confirm current history contains both commits and that no product/governance files changed after the reconciliation commit except this manifest-only finalization commit and subsequent Gate outputs. - Invoke
up-traceability-gateonly after integrated evidence is authoritative, or report the exact blockers preventing it.
Runtime evidence that uses shared host ports, fixed Compose projects, shared cloud fixtures, or destructive test identities must be serialized unless each lane has proven isolation. Integration on one master lane does not make concurrent runtime mutation safe.
7. Report and Handoff
Report:
- Target branch and pre/post integration SHAs or worktree state.
- Source branches and SHAs, in merge order.
- Product conflicts and their semantic resolution.
- Governance collisions and the old-to-canonical ID map.
- Files changed and tests/evidence run.
- Gate result or exact reason Gate execution remains pending.
- Open human decisions, CRs, ambiguities, skipped evidence, and residual risks.
Output Expected
- A coherent integrated worktree on the originally checked-out master lane branch.
- Canonical governance entries with no duplicate IDs or dangling rewritten references.
- Consistent current-status summaries derived from integrated evidence.
- Integrated verification results and a post-integration checkpoint.
- A durable active-iteration
integration_manifest.mdbound to the verified governance-reconciliation commit, auditable source merge commit(s), a canonical governance-reconciliation commit, and a manifest-finalization commit on the target; no push.
Exit Criteria
- Every named branch and SHA was integrated or explicitly reported blocked.
- No unresolved merge marker, shared-contract conflict, duplicate canonical governance ID, dangling rewritten reference, or contradictory authoritative current status remains.
- Lane and cross-lane tests required by the plan pass, or failures are recorded without false promotion.
- Historical evidence and approved deferrals are preserved.
- The finalized manifest names the verified governance-reconciliation commit, and current history contains that commit with no subsequent product/governance change before Gate execution except its manifest-only finalization commit.
- Gate 14.1 or the applicable gate has run, or its exact blocking prerequisite is recorded as the next action.
Sample Invocations
/up-parallel-work-integrate origin/lane-admin-governance origin/lane-account-settings
"With
iteration-01-v2checked out, integratedeveloper-a/admin-governanceanddeveloper-b/account-settingsin that order. Treat their governance IDs as provisional, reconcile all references, rerun both isolated evidence lanes serially, and leave final delivery promotion to Gate 14.1."
Related Skills
Consumes lanes planned by up-iteration-plan and implemented/repaired by up-code-generate, up-defect-fix, and up-test-model-generate (source of branch-local TC-* IDs). Invoke up-change-request-impact when integration exposes an unapproved requirements or architecture conflict. Feeds the coherent integrated result into up-traceability-gate, then up-context-checkpoint records the handoff — and should also be invoked mid-integration (Step 4.7) if a pause is needed before all sources are merged.