name: minion-apply description: > Apply generated patches safely. Preview diffs, dry-run to check, then apply. Always review patches before applying - minions make mistakes! allowed-tools: Bash, Read, Glob
Minion Apply
Apply patches generated by minions. Always preview and dry-run before applying.
Workflow
- Preview - See what the patch contains
- Dry-run - Test without making changes
- Apply - Make the changes
- Verify - Run tests
Usage
Step 1: List available patches
ls -la sessions/*.patch
Step 2: Preview a patch
cat sessions/20250112-patch.patch
Or for colored diff:
cat sessions/20250112-patch.patch | diff-so-fancy 2>/dev/null || cat sessions/20250112-patch.patch
Step 3: Dry-run (test without applying)
patch -p1 --dry-run < sessions/20250112-patch.patch
If successful, shows what would change. If errors, shows conflicts.
Step 4: Apply the patch
patch -p1 < sessions/20250112-patch.patch
Step 5: Verify changes
# Check git diff
git diff
# Run tests
source .venv/bin/activate && pytest
Apply multiple patches
# Apply all patches in order
for p in sessions/*.patch; do
echo "Applying $p..."
patch -p1 < "$p"
done
Handling conflicts
If dry-run shows conflicts:
Hunk #1 FAILED at 42.
Options:
- Regenerate patch - Run minion-patch again with more context
- Manual edit - Edit the .patch file to fix offsets
- Force with fuzz -
patch -p1 --fuzz=3 < file.patch(risky)
Reverting a patch
patch -p1 -R < sessions/20250112-patch.patch
Clean up after applying
# Remove applied patches
rm sessions/*.patch
# Or archive them
mkdir -p sessions/applied
mv sessions/*.patch sessions/applied/
Safety tips
- Always dry-run first - Catches most issues
- Review every patch - Minions make mistakes
- Commit before applying - Easy to revert
- Run tests after - Verify nothing broke
- One patch at a time - Easier to debug