repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(pi): add merge plan skill

ff709953f3e65558c2f63604d8df36585fb45917

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

+135 / −0 text lines

pi/agent/skills/merge-plan/SKILL.md

Added
new file mode 100644

+71 / −0 text lines

1 +---
2 +name: merge-plan
3 +description: "Use when planning or performing a pull, sync, merge, or rebase with upstream, especially in dirty repositories with conflicts, submodules, or worktrees."
4 +---
6 +# Merge Plan
8 +Synchronize local work with upstream safely.
10 +## Contract
12 +- A request to make a plan authorizes inspection only.
13 +- A request to pull, sync, merge, or rebase authorizes safe, reversible local execution.
14 +- Fetch only the required upstream state. Never push.
15 +- Preserve all local work. Unknown disposition blocks execution.
16 +- Decide obvious mechanics and conflict outcomes autonomously.
17 +- 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.
18 +- Use generic concepts in reasoning and reports. Use native terminology only for exact evidence or actions.
20 +Read [nested repository risks](references/nested-repositories.md) when submodules, nested repositories, or linked workspaces are present.
22 +## Workflow
24 +1. **Resolve intent**
25 + - Distinguish the configured tracking upstream from an integration target.
26 + - Explicit target wins. A plain pull uses the configured tracking upstream.
27 + - Derive integration strategy from explicit intent, repository policy, then effective configuration. Ask if still ambiguous.
29 +2. **Inspect before changing**
30 + - Discover the repository, related workspaces, and recursive submodules.
31 + - Read instructions for every affected scope.
32 + - Inspect active operations, conflicts, locks, workspace collisions, local work, recovery points, local history, and divergence.
33 + - Refresh only the required target state.
35 +3. **Design the integration**
36 + - Partition dirty work into logical chunks: intent first, dependency cohesion second, conflict isolation third.
37 + - Prefer coherent checkpoint commits. Recommend a temporary snapshot only when work cannot sensibly be committed.
38 + - Compare local and incoming intent. Forecast overlapping paths and semantic conflicts.
39 + - Order repositories and chunks by dependency.
40 + - Plan recovery, verification, and recovery-point cleanup.
42 +4. **Resolve blockers**
43 + - Resolve evident choices without interruption.
44 + - Ask only when plausible outcomes differ semantically or no lossless route is clear.
45 + - Tests validate a resolution; they do not decide intent.
47 +5. **Act when authorized**
48 + - Create the planned recovery points and dirty-work snapshots.
49 + - Apply checkpoint chunks and integrate in dependency order.
50 + - Resolve obvious conflicts, verify them, and continue.
51 + - Stop only for a blocker or unsafe state. Never push.
53 +6. **Verify and finish**
54 + - Run structural checks, targeted checks for each resolution, then repository-prescribed checks.
55 + - Repair clear integration mistakes. Report unrelated or pre-existing failures without expanding scope.
56 + - Keep rollback references until every repository matches the plan, local work is accounted for, verification passes, and the result is acknowledged.
57 + - Before cleanup, check final state once more.
59 +## Output
61 +Stay terse. Expand only blockers and predicted conflicts.
63 +1. Verdict
64 +2. Blockers, when present
65 +3. Repository graph
66 +4. Dirty-work chunks
67 +5. Conflict forecast
68 +6. Ordered actions
69 +7. Verification and rollback
71 +A plan is complete when action requires following it, not redesigning intent, preservation, ordering, resolution, verification, or rollback.

pi/agent/skills/merge-plan/references/nested-repositories.md

Added
new file mode 100644

+64 / −0 text lines

1 +# Nested Repository Risks
3 +## Recursive submodules
5 +Treat every submodule as an independent repository.
6 +For each one, distinguish:
8 +- dirty nested files;
9 +- the parent-recorded revision;
10 +- the checked-out revision;
11 +- local commits that record different nested revisions;
12 +- local and upstream divergence;
13 +- initialized versus unavailable worktree state.
15 +Inspect initialized submodules recursively.
16 +For uninitialized submodules, inventory metadata and the parent-recorded revision; initialize only when authorized execution requires it.
18 +Integrate and verify nested work before updating its parent pointer.
19 +Pushing is out of scope.
20 +Warn when the resulting parent pointer would reference a nested commit unavailable from its remote.
22 +Git subtrees receive ordinary tracked-file conflict analysis.
23 +Do not inspect subtree remotes, split history, pulls, or pushes.
25 +## Linked workspaces
27 +Inspect shared topology, active operations, locks, and target branch occupancy.
28 +Do not inspect unrelated workspace contents unless they can block or alter this synchronization.
30 +A lock is active or stale only after ownership and operation state establish which.
31 +Never remove one merely because it exists.
33 +## Git worktrees with submodules
35 +Git worktrees share refs and object storage while keeping worktree state such as HEAD and index separate.
36 +Git documents submodule support across multiple worktrees as incomplete.
37 +Do not assume nested checkout isolation.
39 +Before modifying a submodule in this topology, establish:
41 +- its worktree-specific Git directory;
42 +- its HEAD and branch ownership;
43 +- sibling worktrees using the same submodule repository;
44 +- active operations or locks in those worktrees.
46 +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.
47 +Resolve mechanical collisions without changing work intent.
48 +Ask only when alternatives change work intent or no lossless route is clear.
49 +After resolution, verify the nested commit and update only the intended parent pointer.
51 +## Semantic conflicts
53 +For every predicted or actual conflict, state both intents, dependency impact, proposed semantic result, validation, and confidence.
54 +Never use blanket side selection as a substitute for intent.
55 +A passing test validates a candidate result but cannot choose between plausible behaviors.
57 +## Recovery points
59 +Use a named rollback reference for history rewrites or complex multi-repository integration.
60 +A clean fast-forward needs its original revision recorded.
61 +Dirty content needs a checkpoint commit or temporary snapshot in addition to a revision anchor.
63 +Retain existing and new recovery points until all local work is accounted for, verification passes, and the result is acknowledged.
64 +Then check final state and remove only the recovery points created for this synchronization.