feat(pi): add merge plan skill
ff709953f3e65558c2f63604d8df36585fb45917
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
- Parent 1: 5b9f75e218f4
bugabingas dorkfiles
ff709953f3e65558c2f63604d8df36585fb45917
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
+135 / −0 text lines
new file mode 100644+71 / −0 text lines
---name: merge-plandescription: "Use when planning or performing a pull, sync, merge, or rebase with upstream, especially in dirty repositories with conflicts, submodules, or worktrees."---# Merge PlanSynchronize local work with upstream safely.## Contract- A request to make a plan authorizes inspection only.- A request to pull, sync, merge, or rebase authorizes safe, reversible local execution.- Fetch only the required upstream state. Never push.- Preserve all local work. Unknown disposition blocks execution.- Decide obvious mechanics and conflict outcomes autonomously.- When intent, history, or a lossless path is unclear, ask one blocker at a time with evidence, consequences, and a recommendation; continue after the answer.- Use generic concepts in reasoning and reports. Use native terminology only for exact evidence or actions.Read [nested repository risks](references/nested-repositories.md) when submodules, nested repositories, or linked workspaces are present.## Workflow1. **Resolve intent** - Distinguish the configured tracking upstream from an integration target. - Explicit target wins. A plain pull uses the configured tracking upstream. - Derive integration strategy from explicit intent, repository policy, then effective configuration. Ask if still ambiguous.2. **Inspect before changing** - Discover the repository, related workspaces, and recursive submodules. - Read instructions for every affected scope. - Inspect active operations, conflicts, locks, workspace collisions, local work, recovery points, local history, and divergence. - Refresh only the required target state.3. **Design the integration** - Partition dirty work into logical chunks: intent first, dependency cohesion second, conflict isolation third. - Prefer coherent checkpoint commits. Recommend a temporary snapshot only when work cannot sensibly be committed. - Compare local and incoming intent. Forecast overlapping paths and semantic conflicts. - Order repositories and chunks by dependency. - Plan recovery, verification, and recovery-point cleanup.4. **Resolve blockers** - Resolve evident choices without interruption. - Ask only when plausible outcomes differ semantically or no lossless route is clear. - Tests validate a resolution; they do not decide intent.5. **Act when authorized** - Create the planned recovery points and dirty-work snapshots. - Apply checkpoint chunks and integrate in dependency order. - Resolve obvious conflicts, verify them, and continue. - Stop only for a blocker or unsafe state. Never push.6. **Verify and finish** - Run structural checks, targeted checks for each resolution, then repository-prescribed checks. - Repair clear integration mistakes. Report unrelated or pre-existing failures without expanding scope. - Keep rollback references until every repository matches the plan, local work is accounted for, verification passes, and the result is acknowledged. - Before cleanup, check final state once more.## OutputStay terse. Expand only blockers and predicted conflicts.1. Verdict2. Blockers, when present3. Repository graph4. Dirty-work chunks5. Conflict forecast6. Ordered actions7. Verification and rollbackA plan is complete when action requires following it, not redesigning intent, preservation, ordering, resolution, verification, or rollback.new file mode 100644+64 / −0 text lines
# Nested Repository Risks## Recursive submodulesTreat every submodule as an independent repository.For each one, distinguish:- dirty nested files;- the parent-recorded revision;- the checked-out revision;- local commits that record different nested revisions;- local and upstream divergence;- initialized versus unavailable worktree state.Inspect initialized submodules recursively.For uninitialized submodules, inventory metadata and the parent-recorded revision; initialize only when authorized execution requires it.Integrate and verify nested work before updating its parent pointer.Pushing is out of scope.Warn when the resulting parent pointer would reference a nested commit unavailable from its remote.Git subtrees receive ordinary tracked-file conflict analysis.Do not inspect subtree remotes, split history, pulls, or pushes.## Linked workspacesInspect shared topology, active operations, locks, and target branch occupancy.Do not inspect unrelated workspace contents unless they can block or alter this synchronization.A lock is active or stale only after ownership and operation state establish which.Never remove one merely because it exists.## Git worktrees with submodulesGit worktrees share refs and object storage while keeping worktree state such as HEAD and index separate.Git documents submodule support across multiple worktrees as incomplete.Do not assume nested checkout isolation.Before modifying a submodule in this topology, establish:- its worktree-specific Git directory;- its HEAD and branch ownership;- sibling worktrees using the same submodule repository;- active operations or locks in those worktrees.Conflict resolution is safe when the nested checkout has isolated worktree state, uses detached HEAD or a uniquely owned branch, and no sibling operation collides.Resolve mechanical collisions without changing work intent.Ask only when alternatives change work intent or no lossless route is clear.After resolution, verify the nested commit and update only the intended parent pointer.## Semantic conflictsFor every predicted or actual conflict, state both intents, dependency impact, proposed semantic result, validation, and confidence.Never use blanket side selection as a substitute for intent.A passing test validates a candidate result but cannot choose between plausible behaviors.## Recovery pointsUse a named rollback reference for history rewrites or complex multi-repository integration.A clean fast-forward needs its original revision recorded.Dirty content needs a checkpoint commit or temporary snapshot in addition to a revision anchor.Retain existing and new recovery points until all local work is accounted for, verification passes, and the result is acknowledged.Then check final state and remove only the recovery points created for this synchronization.