Skip to content
Development
Command

/hybrid-resume

Resume an interrupted hybrid task (worktree or regular). Auto-detects state from files and continues execution. Usage: /plan-cascade:hybrid-resume [--auto]

From plugin
plan-cascade
14030 skills30 commands
Install
> /plugin marketplace add Taoidle/plan-cascade
> /plugin install plan-cascade@plan-cascade

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/hybrid-resume

Context preview

What this command does when you run it.

Resume an interrupted hybrid task (worktree or regular). Auto-detects state from files and continues execution. Usage: /plan-cascade:hybrid-resume [--auto]

Command definition

hybrid-resume.md
description: "Resume an interrupted hybrid task (worktree or regular). Auto-detects state from files and continues execution. Usage: /plan-cascade:hybrid-resume [--auto]"

Resume Interrupted Hybrid Task

Resume execution of an interrupted hybrid task by detecting current state from existing files.

Path Storage Modes

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

New Mode (Default)

  • Worktrees in: `~/.plan-cascade/<project-id>/.worktree/` (Unix) or `%APPDATA%/plan-cascade/<project-id>/.worktree/` (Windows)
  • State files in: `~/.plan-cascade/<project-id>/.state/`
  • PRD files in worktree directory

Legacy Mode

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

The command auto-detects which mode is active and scans the appropriate directories.

Tool Usage Policy (CRITICAL)

**To avoid command confirmation prompts during automatic execution:**

1. **Use Read tool for file reading** - NEVER use `cat` via Bash

  • ✅ `Read("prd.json")`, `Read("progress.txt")`, `Read(".planning-config.json")`
  • ❌ `Bash("cat prd.json")`

2. **Use Glob tool for finding files** - NEVER use `ls` or `find` via Bash

  • ✅ `Glob(".worktree/*/.planning-config.json")`
  • ❌ `Bash("ls .worktree/")`

3. **Use Grep tool for content search** - NEVER use `grep` via Bash

  • ✅ `Grep("[COMPLETE]", path="progress.txt")`
  • ❌ `Bash("grep '[COMPLETE]' progress.txt")`

4. **Only use Bash for actual system commands:**

  • Git operations: `git status`, `git checkout`
  • Directory navigation: `cd` (only when necessary)
  • File writing: `echo "..." >> progress.txt`

**Works with both:**

  • `hybrid-worktree` tasks (in `.worktree/` directories)
  • `hybrid-auto` tasks (in regular directories)

Arguments

  • `--auto`: Continue in fully automatic mode (no confirmation prompts)

Step 1: Detect Context

**IMPORTANT: Use Read/Glob tools for file detection, NOT Bash**

1.1: Check if in Worktree

**Use Read tool (NOT Bash) to check for worktree config:**

Read(".planning-config.json")

If Read succeeds:

  • Parse the JSON content
  • Check if `mode` equals "hybrid"
  • If yes: `CONTEXT="worktree"`, extract `task_name`, `target_branch`
  • Log "✓ Detected hybrid worktree: {task_name}"

1.2: Check for Regular Hybrid Task

If CONTEXT is not set yet:

**Use Read tool to check for PRD:**

Read("prd.json")

If Read succeeds:

  • `CONTEXT="regular"`
  • Log "✓ Detected regular hybrid task (prd.json found)"

1.3: Scan for Worktrees (if not in one)

If CONTEXT is still not set:

**Use Glob tool (NOT Bash `ls`) to find worktrees in both new and legacy locations:**

# 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())"

# Scan for worktrees (path depends on mode)
Glob("{WORKTREE_BASE}/*/.planning-config.json")
Glob("{WORKTREE_BASE}/*/prd.json")

# Also check legacy location if different
Glob(".worktree/*/.planning-config.json")
Glob(".worktree/*/prd.json")

Execute these Glob calls in parallel.

For each found file:

  • **Use Read tool** to read the config/prd content
  • Parse to get task info (mode, task_name, etc.)
  • Build list of HYBRID_TASKS

If no tasks found:

============================================
No interrupted hybrid tasks found
============================================

To start a new task:
  /plan-cascade:hybrid-auto <description>
  /plan-cascade:hybrid-worktree <name> <branch> <description>

If tasks found, display them and use **AskUserQuestion** to let user select:

Found {count} interrupted hybrid task(s):

  [1] {task_name_1}
      Path: {path_1}
      PRD: {story_count} stories
      Progress: {complete_count} complete

  [2] {task_name_2}
      ...

After user selection, navigate to the selected worktree directory.

Step 2: Analyze Current State

**IMPORTANT: Use Read/Grep tools for state analysis, NOT Bash**

2.1: Check PRD Status

**Use Read tool to get PRD content:**

Read("prd.json")

Based on result:

  • If Read fails → `PRD_STATUS="missing"`
  • If Read succeeds:
  • Parse JSON in the response
  • If JSON invalid → `PRD_STATUS="corrupted"`
  • If `stories` array is empty → `PRD_STATUS="empty"`
  • If `stories` array has items → `PRD_STATUS="valid"`, `TOTAL_STORIES=len(stories)`

Display: `PRD Status: {PRD_STATUS}` and `Stories: {TOTAL_STORIES}` if valid

2.2: Check Progress Status

**Use Read tool to get progress content:**

Read("progress.txt")

**Use Grep tool to count markers (NOT Bash grep):**

Grep("[COMPLETE]", path="progress.txt", output_mode="count")
Grep("[FAILED]", path="progress.txt", output_mode="count")
Grep("Batch [0-9]+", path="progress.txt", output_mode="content")

From results:

  • `STORIES_COMPLETE` = count of [COMPLETE] or [STORY_COMPLETE] markers
  • `STORIES_FAILED` = count of [FAILED] or [ERROR] markers
  • `CURRENT_BATCH` = extract batch number from last "Batch N" line

Display progress status summary.

2.3: Check Story Statuses in PRD

If PRD is valid (from 2.1), analyze the prd.json content that was already read:

  • Count stories with `status == "pending"` or no status
  • Count stories with `status == "complete"`
  • Count stories with `status == "in_progress"`

Display:

PRD Story Statuses:
  Pending: {PENDING_IN_PRD}
  In Progress: {IN_PROGRESS_IN_PRD}
  Complete: {COMPLETE_IN_PRD}

Step 3: Determine Task State

Based on the analysis, determine the current state:

State Detection Logic:

1. NO prd.json OR corrupted:
   → State: "needs_prd"
   → Action: Generate PRD first

2. prd.json empty (no stories):
   → State: "needs_prd"
   → Action: Regenerate PRD

3. prd.json valid, 0 stories complete, no progress markers:
   → State: "needs_approval"
   → Action: Start story execution from beginning

4. prd.json valid, some stories complete (in PRD or progress.txt):
   →
Read more
Ships withplan-cascade

AI-Powered Cascading Development Framework Transform complex projects into parallel executable tasks with intelligent decomposition and multi-provider execution Why Plan Cascade? • Product Editions • Quick Start • Architecture

Get the whole plugin
Stats
141
Stars
12
Forks
Quiet
Maintenance
Rust
Language
MIT
License
6mo ago
Last commit
8mo ago
Created

Repo: Taoidle/plan-cascade

Other commands on plan-cascade.