complete

A command that finishes a task in a separate Git worktree, a second working directory linked to the same repository. It checks the work, commits code, merges the task branch, and cleans up the worktree and branch.

In plain words
What is it for?
Use it when a worktree task is complete and its code should be merged into a target branch.
Why use it?
It removes the repeated final steps of checking, committing, merging, and deleting temporary development files.

Command

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.

agentmods
npx agentmods add commands/taoidle/plan-cascade/complete
Clone the repo
git clone --depth 1 https://github.com/Taoidle/plan-cascade
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
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 $0.00051 $0.03435
Opus 5 $0.00026 $0.01717
Sonnet 5 $0.00010 $0.00687
Haiku 4.5 $0.00005 $0.00344

Measured 2d ago against content hash 68488663ef33, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

complete scanned grade C with 1 finding 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 2d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf ".state"
commands/complete.md · 461 lines

How it starts

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

Planning with Files - Complete Worktree Task

You are now completing a worktree task. This will:

  1. Verify all phases are complete
  2. CRITICAL: Commit code changes (planning files excluded)
  3. Delete planning files from the worktree
  4. Navigate to the root directory
  5. Merge the task branch to target branch
  6. Remove the worktree
  7. Delete the task branch

Path Storage Modes

This command works with both new and legacy path storage modes:

New Mode (Default)

  • Worktrees in: ~/.plan-cascade/<project-id>/.worktree/
  • State files in: ~/.plan-cascade/<project-id>/.state/
  • Cleanup removes files from user data directory

Legacy Mode

  • Worktrees in: <project-root>/.worktree/
  • State files in project root

The command auto-detects which mode is active based on .planning-config.json contents.

Step 1: Detect Current Location

Check if we're in a worktree or the root directory:

if [ -f ".planning-config.json" ]; then
    # We're in a worktree directory
    echo "Currently in worktree directory: $(pwd)"
    IN_WORKTREE=true
else
    # We're not in a worktree, check if there are any worktrees
    IN_WORKTREE=false

    # Check for worktrees
    WORKTREES=$(git worktree list 2>/dev/null | grep -v "\bare$" | wc -l)

    if [ "$WORKTREES" -eq 0 ]; then
        echo "ERROR: No worktrees found."
        echo "This command requires an existing worktree."
        echo ""
        echo "Create one first with:"
        echo "  /plan-cascade:worktree <task-name> <branch>"
        exit 1
    fi

    echo "Not in a worktree directory. Found $WORKTREES worktree(s):"
    echo ""
    git worktree list
    echo ""

    # Find all worktrees with .planning-config.json (check both new and legacy locations)
    echo "Scanning for planning worktrees..."
    WORKTREE_LIST=()

    # Get worktree base directory from PathResolver
    WORKTREE_BASE=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_worktree_dir())" 2>/dev/null || echo ".worktree")

    while IFS= read -r line; do
        worktree_path=$(echo "$line" | awk '{print $1}')
        worktree_branch=$(echo "$line" | awk '{print $2}')

        # Check if this is a planning worktree
        if [ -f "$worktree_path/.planning-config.json" ]; then
            # Exclude hybrid mode worktrees (those use /plan-cascade:hybrid-complete)
            mode=$(jq -r '.mode // empty' "$worktree_path/.planning-config.json" 2>/dev/null)
            if [ "$mode" != "hybrid" ]; then
                task_name=$(jq -r '.task_name // empty' "$worktree_path/.planning-config.json" 2>/dev/null)
                WORKTREE_LIST+=("$worktree_path|$task_name|$worktree_branch")
            fi
        fi
    done < <(git worktree list 2>/dev/null | grep -v "\bare$")

    if [ ${#WORKTREE_LIST[@]} -eq 0 ]; then
        echo "ERROR: No planning worktrees found."
        echo "Found worktrees but none are in planning mode."
        echo ""
        echo "Note: Hybrid mode worktrees should use /plan-cascade:hybrid-complete"
        exit 1
    fi

    echo "Found ${#WORKTREE_LIST[@]} planning worktree(s):"
    echo ""

    # Display options
    for i in "${!WORKTREE_LIST[@]}"; do
        IFS='|' read -r path name branch <<< "${WORKTREE_LIST[$i]}"
        echo "  [$((i+1))] $name"
        echo "      Path: $path"
        echo "      Branch: $branch"
        echo ""
    done

    # Ask user to select
    echo "Which worktree would you like to complete?"
    read -p "Enter number (or 0 to cancel): " selection

    if [ "$selection" = "0" ]; then
        echo "Cancelled."
        exit 0
    fi

    if [ "$selection" -lt 1 ] || [ "$selection" -gt ${#WORKTREE_LIST[@]} ]; then
        echo "Invalid selection."
        exit 1
    fi

    # Get the selected worktree
    selected="${WORKTREE_LIST[$((selection-1))]}"
    IFS='|' read -r WORKTREE_PATH TASK_NAME TASK_BRANCH <<< "$selected"

    echo ""
    echo "Selected: $TASK_NAME"
    echo "Navigating to worktree: $WORKTREE_PATH"

    # Change to worktree directory
    cd "$WORKTREE_PATH" || {
        echo "ERROR: Failed to navigate to worktree: $WORKTREE_PATH"
        exit 1
    }

    echo "✓ Now in worktree: $(pwd)"
    IN_WORKTREE=true
fi

Read the full file on GitHub · 461 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. 2d ago First seen · 461 lines · 51 tokens per session scan C 68488663ef33

Subscribe to this mod's changes

complete is a command published in the GitHub repository Taoidle/plan-cascade (124 stars, last pushed 5mo ago), licensed MIT. It adds 51 tokens to every session and 3,435 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.