flow-abort

Abort the current FLOW feature. Closes the PR, deletes the remote branch, removes the worktree, and deletes the state file. Available from any phase. The confirmation prompt is governed by the skills.flow-abort config in the state file.

12 stars

Best use case

flow-abort is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Abort the current FLOW feature. Closes the PR, deletes the remote branch, removes the worktree, and deletes the state file. Available from any phase. The confirmation prompt is governed by the skills.flow-abort config in the state file.

Teams using flow-abort should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/flow-abort/SKILL.md --create-dirs "https://raw.githubusercontent.com/benkruger/flow/main/skills/flow-abort/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/flow-abort/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How flow-abort Compares

Feature / Agentflow-abortStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Abort the current FLOW feature. Closes the PR, deletes the remote branch, removes the worktree, and deletes the state file. Available from any phase. The confirmation prompt is governed by the skills.flow-abort config in the state file.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# FLOW Abort

Abandon the current feature completely. This is the escape hatch — available
from any phase, no prerequisites.

## Usage

```text
/flow:flow-abort
```

- `/flow:flow-abort` — uses the configured mode from the state file's `skills.flow-abort` config

## Concurrency

This flow is one of potentially many running simultaneously — on this
machine (multiple worktrees) and across machines (multiple engineers).
Your state file (`.flow-states/<branch>/state.json`) is yours alone. Never
read or write another branch's state. All local artifacts (logs, plan
files, temp files) are scoped by branch name. GitHub state (PRs, issues,
labels) is shared across all engineers — operations that create or modify
shared state must be idempotent.

## Mode Resolution

Resolve the mode as the first action on entry, after resolving the
current branch. `## Mode Resolution` is the single runnable home for
mode resolution — the same pattern `flow-complete` uses, so the two
terminal skills stay consistent. There are no `--auto`/`--manual`
flags — the state file's `skills.flow-abort` config is the single
source of truth for skill autonomy.

1. Resolve the current branch: run `git worktree list --porcelain`,
   note the project root (the path on the first `worktree` line),
   find the `worktree` entry whose path matches the current working
   directory, and take the `branch refs/heads/<name>` line from that
   entry (strip the `refs/heads/` prefix). Call this `<branch>`.
2. Run the resolver below and use the `continue` field from its JSON
   output as the abort-confirmation mode. It reads the
   `skills.flow-abort` entry in the state file, tolerating every
   object config shape, and falls back to **manual** when the config
   is missing or unparseable:

   ```bash
   ${CLAUDE_PLUGIN_ROOT}/bin/flow resolve-skill-mode --skill flow-abort --branch <branch>
   ```

## Entry Check

Run this entry check immediately after Mode Resolution.

1. Run `git worktree list --porcelain`. Note the path on the first
   `worktree` line (this is the project root). Find the `worktree` entry
   whose path matches your current working directory — the
   `branch refs/heads/<name>` line in that entry is the current branch
   (strip the `refs/heads/` prefix).
2. Use the Read tool to read `<project_root>/.flow-states/<branch>/state.json`.
   - If the file exists: extract `feature`, `branch`, `worktree`,
     `pr_number`, and `pr_url`. Print the feature name, branch, PR URL,
     and current phase.
   - If the file does not exist: infer what you can from git state:
     - `branch` from the porcelain output (already known)
     - Detect worktree path from the porcelain output
     - Use the branch name as the feature name
     - `pr_number` unknown — skip PR close step later
     - Print "WARNING: No state file found for branch '<branch>'. Will
       attempt best-effort cleanup using git state." and tell the user
       what was inferred. Continue — do not stop.

If the Read tool fails for any other reason, stop and show the error.

Use these values for all subsequent steps — do not re-read the state file
or re-run git commands to gather the same information.

## Announce

At the very start, output the following banner in your response (not via Bash) inside a fenced code block:

````markdown
```text
──────────────────────────────────────────────────
  FLOW v2.6.0 — Abort — STARTING
──────────────────────────────────────────────────
```
````

## Steps

### Step 1 — Confirm with user (manual mode only)

Skip this step if mode is **auto** — proceed directly to Steps 2–7.

If mode is **manual**, this is destructive and irreversible. Use AskUserQuestion.

If the entry check printed warnings, include them in the confirmation:

> "Abort feature '<feature>'?
> ⚠ <any warnings from the entry check>
> This will close the PR, delete the remote branch, remove the worktree, and delete the state file and log. All uncommitted work in the worktree will be lost."

- **Yes, abort everything** — proceed
- **No, keep going** — stop here

### Step 2 — Remove In-Progress labels

If a state file was found in the entry check, remove the "Flow In-Progress"
label from any issues referenced in the prompt. Best-effort — continue to
cleanup even if removal fails. Skip this step if no state file exists.

```bash
${CLAUDE_PLUGIN_ROOT}/bin/flow label-issues --state-file <project_root>/.flow-states/<branch>/state.json --remove
```

### Steps 3–8 — Run cleanup script

Run the cleanup script from the project root with abort flags:

```bash
${CLAUDE_PLUGIN_ROOT}/bin/flow cleanup <project_root> --branch <branch> --worktree <worktree_path> --pr <pr_number>
```

If `pr_number` is unknown, omit `--pr`. The cleanup script deletes local branches and attempts remote branch deletion when `--pr` is provided.

The script outputs JSON with a `steps` dict showing what happened to each resource: `pr_close`, `worktree`, `remote_branch`, `local_branch`, `branch_dir`, `queue_entry`. Each step reports `"closed"`/`"removed"`/`"deleted"`, `"skipped"`, or `"failed: <reason>"`. The `branch_dir` step recursively removes every per-branch artifact under `.flow-states/<branch>/` (state file, log, plan, frozen phases, CI sentinel, timings, closed-issues record, issues summary, scratch rule content, commit message, start prompt). The `queue_entry` step removes `.flow-states/start-queue/<branch>` if a start-lock entry remains.

### Done

Tell the user what was cleaned, what was already gone, and what failed.

Then output the following banner in your response (not via Bash) inside a fenced code block:

````markdown
```text
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✓ FLOW v2.6.0 — Abort — COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Feature '<feature>' has been abandoned.
  Cleanup complete — see results above for details.
```
````

Report which steps succeeded and which were already cleaned up.

## Rules

- Available from ANY phase — no phase gate
- Never run from inside the worktree — always navigate to project root first
- Confirm with the user only when mode is **manual**
- Every step after confirmation is best-effort — if one fails, continue to the next
- Never rebase, never force push — just close and delete

Related Skills

flow-triage-issue

12
from benkruger/flow

Triage a single open GitHub issue from a PM lens. Applies a 'Triage In-Progress' label during triage; reads code, checks for already-shipped work, returns a verdict in {close, decompose} with confidence and a flip-condition. Renders and stops — no other side effects.

flow-start

12
from benkruger/flow

Phase 1: Start — begin a new feature. Creates a worktree, upgrades dependencies, opens a PR, creates .flow-states/<branch>/state.json, and configures the workspace. Usage: /flow:flow-start <feature name words>

flow-skills

12
from benkruger/flow

Display the FLOW skill catalog grouped by user role. Maintainer and Private buckets render only when invoked inside the FLOW plugin repo.

flow-review

12
from benkruger/flow

Phase 3: Review — six tenants assessed by four cognitively isolated agents (reviewer, pre-mortem, adversarial, documentation) launched in parallel. Parent session gathers context, triages findings, and fixes.

flow-reset

12
from benkruger/flow

Wipe `.flow-states/` on this machine in one pass. PRs, worktrees, and branches are NOT touched — those require per-flow `/flow:flow-abort`.

flow-prime

12
from benkruger/flow

One-time project setup — configure and commit workspace permissions, install bin/* stubs, and write the version marker. Run once after installing or upgrading FLOW. Usage: /flow:flow-prime

flow-plan

12
from benkruger/flow

Decompose a problem statement into a pre-planned decomposed issue. Accepts either an issue reference (#N, re-plans in place) or a bare prompt (synthesizes What/Why/AC and files a new issue). Runs a Tech-Lead-default planning conversation, dispatches to PM/Tech Lead/CTO sub-agents on explicit user request, then files or edits the issue ready for /flow:flow-start. Usage: /flow:flow-plan #N or /flow:flow-plan <topic>

flow-orchestrate

12
from benkruger/flow

Process decomposed issues sequentially overnight via flow-start, tracking outcomes and generating a morning report.

flow-note

12
from benkruger/flow

Capture a correction or learning to the FLOW state file. Invoke explicitly with /flow:flow-note. Fast — captures and continues without interrupting flow.

flow-learn

12
from benkruger/flow

Phase 4: Learn — audit rule compliance and identify process gaps. Routes findings to CLAUDE.md, .claude/rules/, and plugin issues.

flow-issues

12
from benkruger/flow

Group open issues by label into four sections (Blocked, Other, Vanilla, Decomposed) with mechanical sort and a copy-pasteable command per row.

flow-hygiene

12
from benkruger/flow

Audit instruction corpus health — CLAUDE.md, rules, and memory for staleness, misplacement, duplication, and contradictions.