Skip to content
Development
Command

/mega-resume

Resume an interrupted mega-plan execution. Detects current state from existing files and continues automatically. Usage: /plan-cascade:mega-resume [--auto-prd]

BOOST
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/mega-resume

Context preview

What this command does when you run it.

Resume an interrupted mega-plan execution. Detects current state from existing files and continues automatically. Usage: /plan-cascade:mega-resume [--auto-prd]

Command definition

mega-resume.md
description: "Resume an interrupted mega-plan execution. Detects current state from existing files and continues automatically. Usage: /plan-cascade:mega-resume [--auto-prd]"

Resume Interrupted Mega Plan

Resume execution of an interrupted mega-plan by detecting the current state from existing files.

Path Storage Modes

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

New Mode (Default)

Files are stored in user data directory:

  • **Windows**: `%APPDATA%/plan-cascade/<project-id>/`
  • **Unix/macOS**: `~/.plan-cascade/<project-id>/`

File locations:

  • `mega-plan.json`: `<user-dir>/mega-plan.json`
  • `.mega-status.json`: `<user-dir>/.state/.mega-status.json`
  • Worktrees: `<user-dir>/.worktree/<feature-name>/`

Legacy Mode

All files in project root:

  • `mega-plan.json`: `<project-root>/mega-plan.json`
  • `.mega-status.json`: `<project-root>/.mega-status.json`
  • Worktrees: `<project-root>/.worktree/<feature-name>/`

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("mega-plan.json")`, `Read(".mega-status.json")`, `Read(".worktree/x/progress.txt")`
  • ❌ `Bash("cat mega-plan.json")`

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

  • ✅ `Glob(".worktree/*/prd.json")`
  • ❌ `Bash("ls .worktree/")`

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

  • ✅ `Grep("[PRD_COMPLETE]", path=".worktree/x/progress.txt")`
  • ❌ `Bash("grep '[PRD_COMPLETE]' ...")`

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

  • Git operations: `git worktree add`, `git merge`
  • Directory creation: `mkdir -p`
  • File writing: `echo "..." >> progress.txt`

**Compatibility**: Works with both old-style (pre-4.1.1) and new-style mega-plan executions.

Arguments

  • `--auto-prd`: Continue in fully automatic mode (no manual intervention)

Step 1: Verify Mega Plan Exists

# Get mega-plan path from PathResolver
MEGA_PLAN_PATH=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_mega_plan_path())" 2>/dev/null || echo "mega-plan.json")

if [ ! -f "$MEGA_PLAN_PATH" ]; then
    echo "============================================"
    echo "ERROR: No mega-plan.json found"
    echo "============================================"
    echo "Searched at: $MEGA_PLAN_PATH"
    echo "Nothing to resume."
    echo "Use /plan-cascade:mega-plan <description> to create a new plan."
    exit 1
fi

Step 2: Detect Current State

Read all available state information:

2.1: Read Mega Plan

cat mega-plan.json

Extract:

  • `goal`: Project goal
  • `target_branch`: Target branch for merging
  • `features[]`: All features with their dependencies
  • `execution_mode`: auto or manual

2.2: Read Status File (if exists)

cat .mega-status.json 2>/dev/null || echo "{}"

Extract:

  • `current_batch`: Current batch number (0 = not started)
  • `completed_batches[]`: List of completed batch numbers
  • `features{}`: Feature status map

2.3: Scan Worktrees

For each feature in mega-plan.json:

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

FEATURE_NAME="<feature-name>"
WORKTREE_PATH="$WORKTREE_BASE/$FEATURE_NAME"

# Also check legacy location if worktree not found in new location
if [ ! -d "$WORKTREE_PATH" ] && [ -d ".worktree/$FEATURE_NAME" ]; then
    WORKTREE_PATH=".worktree/$FEATURE_NAME"
fi

# Check worktree existence
if [ -d "$WORKTREE_PATH" ]; then
    WORKTREE_EXISTS=true

    # Check for PRD
    if [ -f "$WORKTREE_PATH/prd.json" ]; then
        PRD_EXISTS=true
        # Count stories
        TOTAL_STORIES=$(jq '.stories | length' "$WORKTREE_PATH/prd.json")
    fi

    # Check progress.txt for markers
    if [ -f "$WORKTREE_PATH/progress.txt" ]; then
        # New-style markers
        PRD_COMPLETE=$(grep -c "\[PRD_COMPLETE\]" "$WORKTREE_PATH/progress.txt" 2>/dev/null || echo "0")
        STORIES_COMPLETE=$(grep -c "\[STORY_COMPLETE\]" "$WORKTREE_PATH/progress.txt" 2>/dev/null || echo "0")
        FEATURE_COMPLETE=$(grep -c "\[FEATURE_COMPLETE\]" "$WORKTREE_PATH/progress.txt" 2>/dev/null || echo "0")

        # Old-style markers (compatibility)
        OLD_COMPLETE=$(grep -c "\[COMPLETE\]" "$WORKTREE_PATH/progress.txt" 2>/dev/null || echo "0")
    fi
fi

Step 3: Determine Feature States

For each feature, determine its state based on available evidence:

Feature State Detection Logic:

1. NO WORKTREE EXISTS:
   → State: "pending"
   → Action: Create worktree, generate PRD, execute stories

2. WORKTREE EXISTS, NO prd.json:
   → State: "worktree_created"
   → Action: Generate PRD, execute stories

3. WORKTREE EXISTS, prd.json EXISTS but EMPTY (no stories):
   → State: "prd_incomplete"
   → Action: Regenerate PRD, execute stories

4. WORKTREE EXISTS, prd.json HAS STORIES, NO completion markers:
   → State: "prd_generated"
   → Action: Execute stories (PRD might be from old version)

5. [PRD_COMPLETE] marker exists, NO [FEATURE_COMPLETE]:
   → State: "executing"
   → Action: Continue/resume story execution

6. [FEATURE_COMPLETE] marker exists:
   → State: "complete"
   → Action: Ready for merge

7. Status in .mega-status.json says "merged":
   → State: "merged"
   → Action: Skip (already done)

COMPATIBILITY: Old-style detection
- If prd.json has stories with status="complete", count them
- If all stories complete but no [FEATURE_COMPLETE] marker:
   → State: "complete" (old-style completion)
   → Action: Ready for merge

Step 4: Display Detected State

===============================================
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.