finish-branch-execute

finish-branch-execute is a command for Claude Code from axiomantic/spellbook. It costs 28 tokens per session (808 once invoked), scanned A, original, MIT.

A command for applying the selected way of integrating a development branch, such as merging it locally, opening a pull request, keeping it, or discarding it. A development branch is a separate line of Git work used to isolate changes.

In plain words
What is it for?
Use it to merge a branch, push it for a pull request, preserve it as-is, or discard it according to a previously chosen option.
Why use it?
It ensures the chosen integration option is followed explicitly and that the latest base branch is used before merging. Discarding work requires confirmation because it cannot be undone through this workflow.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md). Also seen: mentions subagents.

Good fit Use it to merge a branch, push it for a pull request…

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/axiomantic/spellbook/finish-branch-execute
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/axiomantic/spellbook

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for finish-branch-execute

README.md
[![agentmods](https://agentmods.dev/badge/commands/axiomantic/spellbook/finish-branch-execute.svg)](https://agentmods.dev/commands/axiomantic/spellbook/finish-branch-execute)
Your own site
<a href="https://agentmods.dev/commands/axiomantic/spellbook/finish-branch-execute"><img src="https://agentmods.dev/badge/commands/axiomantic/spellbook/finish-branch-execute.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00808
Opus 5 $0.00014 $0.00404
Sonnet 5 $0.00006 $0.00162
Haiku 4.5 $0.00003 $0.00081

Measured 3d ago against content hash 1afad8531b31, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

finish-branch-execute scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/finish-branch-execute.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Step 4: Execute Choice

Invariant Principles

  1. Execute exactly the chosen strategy — never silently switch options
  2. Discard requires explicit confirmation — Option 5 is irreversible; re-confirm before executing
  3. Pull before merge — always pull the latest base branch to avoid stale-base conflicts

Context: Steps 1-3 complete. You have: chosen option number (1-5), feature branch name, base branch name, worktree path (if applicable).


Option 1: Merge Locally

git checkout <base-branch>
git pull
git merge <feature-branch>
<test-command>          # use test command from Step 1 context; ask if unknown
git branch -d <feature-branch>   # only on test pass

After success: invoke finish-branch-cleanup.


Option 2: Push and Create PR

git push -u origin <feature-branch>

Then invoke the creating-issues-and-pull-requests skill via the Skill tool to create the PR. That skill discovers and applies the repository's own PR template; never call gh pr create directly from here.

Provide context:

mode: "pr"
branch: <feature-branch>
base: <base-branch>
diff_summary: <merge-base diff summary>

If push or PR creation fails: STOP. Report the error.

Report the PR URL to the user. Do NOT cleanup worktree. Do NOT invoke finish-branch-cleanup.


Option 3: Push, Create PR, and Do the PR Dance

Execute Option 2 steps first (push + create PR). Then dispatch a subagent with command: pr-dance

Read the full file on GitHub · 117 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 117 lines · 28 tokens per session scan A 1afad8531b31

Subscribe to this mod's changes

finish-branch-execute is a command published in the GitHub repository axiomantic/spellbook (10 stars, last pushed 2d ago), licensed MIT. It adds 28 tokens to every session and 808 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.