| name | megacode-foldback |
| description | Produce a safe worktree foldback checklist before merging changes back. Explicit invocation only — the supervisor executes foldback, not this skill. |
| disable-model-invocation | true |
MegaCode Foldback Checklist
Explain foldback options and produce a checklist for the supervisor or human operator. This skill does not run git merge, git worktree remove, or push commands.
Foldback modes
| Mode | When to use |
|---|
pr | Default — open PR from worktree branch for human review |
squash | Single commit onto base branch via supervisor merge |
patch | Export and apply patch when branch history must not transfer |
cherry-pick | Selective commits only |
Preflight checklist (all must pass)
Execution owner
Supervisor code (or explicit human) performs:
- Merge / squash / patch apply / cherry-pick.
- Conflict capture with auditable logs.
- Post-foldback local verification on target branch.
- Worktree and branch cleanup only when safe.
Refusal conditions (stop and report path)
- Uncommitted changes the user did not acknowledge.
- Failed local verify on worktree.
- Main tree dirty in paths the foldback would touch.
- Active teammate still writing in the worktree.
- User requested
discard without explicit confirmation.
Output format
## Foldback plan
- Run ID: ...
- Worktree: ...
- Branch: ...
- Mode: pr | squash | patch | cherry-pick
- Base: main @ <sha>
## Checklist status
- [x] item ...
## Supervisor actions (ordered)
1. ...
2. ...
## Cleanup (only if safe)
- Remove worktree: ...
- Delete branch: ...
Never delete a worktree with unmerged or uncommitted changes unless the user explicitly requested discard.