Skip to content
Agentmart
Submit a tool

finish

Post-merge cleanup.

Skill by MarcinSufa

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/marcinsufa-finish

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Post-merge cleanup. After the PR merges (typically via v0.4 automerge), runs /pr-autopilot:finish <id> to update the claim file to `merged`, mirror to ExoVault `done`, update `assignments.yaml` on `main` with merge metadata, and best-effort cleanup of the worktree + local branch. Lists dependent assignments that became READY. Idempotent. Use when - "close the assignment", "PR merged, clean up", "what's next ready".

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/finish

What's inside

Skill name
finish
Description
Post-merge cleanup. After the PR merges (typically via v0.4 automerge), runs /pr-autopilot:finish <id> to update the claim file to `merged`, mirror to ExoVault `done`, update `assignments.yaml` on `main` with merge metadata, and best-effort cleanup of the worktree + local branch. Lists dependent assignments that became READY. Idempotent. Use when - "close the assignment", "PR merged, clean up", "what's next ready".
License
MIT
Instructions
101 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# /pr-autopilot:finish <ASSIGNMENT_ID>

The closing skill of the pre-PR lifecycle — paired symmetrically with `/assign`.

## Pre-flight

- `gh pr view <claimFile.prNumber> --json mergedAt -q .mergedAt` returns non-null. (EVAL 46.)

## Steps

1. **Read claim file** for `<assignment-id>`. If already `merged` → skip mutations, proceed to step 5–7 for worktree cleanup. Verify PR merged via `gh`; capture `mergedAt`, `mergedCommit`.

2. **Update claim file on feature branch** (before checkout):
   ```json
   {
     "subStatus": "merged",
     "mergedAt": "<iso>",
     "mergedInPr": <PR#>
   }
   ```
   Commit on feature branch:
   ```bash
   git add .claude/assignment-claims/<id>.json
   git commit -m "chore(pr-autopilot): finish assignment <id> (merged in #<PR#>)"
   ```

3. **Mirror to ExoVault:**
   ```
   mcp__exo-vault__update_task(taskId, status='done')
   ```
   Append `mergedAt` + `mergedInPr` to description markdown.

4. **Update `assignments.yaml` on `main`** (P1-3 v2.1 fix + PR review P1-3 simplification):
   ```bash
   # Canonical main worktree resolution — first entry in `git worktree list --porcelain`
   # is always the primary worktree (where main lives). Works for multi-worktree setups,
   # symlinks, and paths with spaces.
   MAIN=$(git worktree list --porcelain | sed -n 's/^worktree //p' | head -1)
   cd "$MAIN"

   git fetch origin main
   git checkout main
   git pull --ff-only origin main   # defensive: abort if local main diverged

   # Edit assignments.yaml: locate the entry by id, set status: merged, add merged_at + merged_in_pr
   # Do NOT touch the excludes: array — that's for historical/external context only.
   # Use yq, jq, sed, or direct write depending on what's available.

   git add assignments.yaml
   git commit -m "chore(assignments): mark <id> merged in PR #<N>"
   git push origin main             # NO --no-verify (P1-8 fix)
   ```
   **If push fails (branch protection):** echo:
   ```
   main is push-protected. Open a cleanup PR with this commit:
       git checkout -b chore/finish-<id>-cleanup
       git push -u origin chore/finish-<id>-cleanup
       gh pr create --base main --title "chore(assignments): mark <id> merged" --body "Post-merge cleanup for #<N>"

   Steps 5–7 will continue once that PR merges. Re-run /pr-autopilot:finish <id> after.
   ```
   STOP gracefully (will retry on next invocation).

5. **Worktree cleanup (best-effort, non-blocking):**
   ```bash
   git worktree remove .claude/worktrees/<id> 2>&1 || \
     echo "⚠️ Could not remove worktree (uncommitted changes?). Inspect and remove manually."
   ```

6. **Local branch cleanup:**
   ```bash
   # If branch was deleted on remote (v0.4 automerge typically does this), local delete is safe.
   if ! git ls-remote --heads origin "<branch>" | grep -q .; then
     git branch -D <branch> 2>&1 || true
   else
     echo "Remote branch <branch> still exists. Delete manually if desired: git branch -D <branch>"
   fi
   ```

7. **List dependents newly READY** (informational, no auto-claim):
   ```
   📋 Newly READY after this merge:
     - admin-d2-agents (deps satisfied)
     - admin-d3-phone-numbers (deps satisfied)

   Claim any: /pr-autopilot:assign <id>
   ```

## Idempotency

- If claim file already `merged` AND main yaml already says `merged` → skip mutations.
- If main yaml says `merged` but claim file doesn't (e.g. previous run died at step 5) → run steps 2–3 + 5–7 only.
- If worktree already removed → skip step 5.
- If local branch already deleted → skip step 6.
- Always run step 7 (READY check is cheap and useful).

## Recovery

If `/finish` is run on a different machine (no worktree present): steps 2–3 use ExoVault as the truth source; steps 5–6 become no-ops; steps 4 + 7 still work.

From MarcinSufa/claude-pr-autopilot, MIT.

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
May 28, 2026 (5 months ago)
Last release
May 28, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from MarcinSufa

Cite this page

finish skill. Agent Mart. https://agentmart.dev/skills/marcinsufa-finish (last updated 2026-10-24)