close-workspacelisted
Install: claude install-skill LandonSchropp/agent-toolkit
# Close Workspace
This skill destroys a checkout, so every step must succeed first. If the merge cannot complete — uncommitted or unreviewed changes, a conflict, or a diverged or unpushed default branch — **STOP** and leave the workspace intact.
`herdr worktree remove` refuses only a dirty working tree. It does not check for unpushed commits, unmerged branches, or stashes, so every one of those checks belongs to this skill.
## Process
Herdr injects `$HERDR_WORKSPACE_ID` into every managed pane. If it is empty you are not inside a herdr workspace — **STOP**.
1. **Identify the workspace.** Run `herdr workspace get "$HERDR_WORKSPACE_ID"` and read `result.workspace.worktree`. When it is absent, or `is_linked_worktree` is `false`, this is a plain workspace on the main checkout: skip to step 4. When it is present with `is_linked_worktree` set to `true`, this is a herdr-managed worktree; take the checkout from `worktree.checkout_path` and continue.
2. **Merge the branch.** Read the branch with `git -C <checkout_path> rev-parse --abbrev-ref HEAD`; herdr injects no variable for it. Skip this step when that branch is already the default branch. Otherwise, **REQUIRED:** use the `git-merge-into-main` skill. It enforces the committed-and-reviewed preconditions, rebases onto the default branch, fast-forwards, pushes, and deletes the branch. **STOP** if it cannot complete the merge.
3. **Verify origin is in sync.** From the default branch's worktree, `git fetch`, then confirm the loc