Skip to content
load-resumption-state logo

Load Resumption State

load-resumption-state

Load conductor workflow state from previous session and determine resumption point by analyzing git state and saved JSON state file

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

Load Resumption State

Purpose

Analyze previous conductor workflow state from both .claude/​state/​conductor.json file and current git state to determine the correct resumption point, preventing duplicate work.

When to Use

  • At start of conductor workflow
  • When resuming interrupted workflow
  • Before Phase 1 (to check if already in progress)
  • When user explicitly requests resumption

Instructions

Step 1: Check for State File

STATE_FILE=".claude/​state/​conductor.json"

if [ -f "$STATE_FILE" ]; then
  echo "📋 Found previous conductor session"

  # Validate JSON
  if ! jq empty "$STATE_FILE" 2>/​dev/​null; then
    echo "⚠️ State file corrupted - using git-only resumption"
    STATE_FOUND=false
  else
    STATE_FOUND=true

    # Load state
    SAVED_ISSUE=$(jq -r '.issue.number' "$STATE_FILE")
    SAVED_PHASE=$(jq -r '.currentPhase' "$STATE_FILE")
    SAVED_BRANCH=$(jq -r '.context.branchName' "$STATE_FILE")
    SAVED_PR=$(jq -r '.context.prNumber' "$STATE_FILE")
    SAVED_TIMESTAMP=$(jq -r '.timestamp' "$STATE_FILE")

    echo "   Issue: #$SAVED_ISSUE"
    echo "   Phase: $SAVED_PHASE"
    echo "   Branch: $SAVED_BRANCH"
    echo "   Last updated: $SAVED_TIMESTAMP"
  fi
else
  echo "ℹ️ No previous state file found - checking git state only"
  STATE_FOUND=false
fi

Step 2: Analyze Git State

# Get current branch
CURRENT_BRANCH=$(git branch --show-current)

# Check if on feature branch
if [[ "$CURRENT_BRANCH" =~ ^feature/​issue-([0-9]+) ]]; then
  # Extract issue number from branch name
  BRANCH_ISSUE="${BASH_REMATCH[1]}"

  echo "🌿 Found feature branch: $CURRENT_BRANCH"
  echo "   Issue from branch: #$BRANCH_ISSUE"

  # Count commits on this branch
  COMMIT_COUNT=$(git rev-list --count development..HEAD 2>/​dev/​null || echo "0")
  echo "   Commits: $COMMIT_COUNT"

  # Check for uncommitted changes
  if [ -n "$(git status --porcelain)" ]; then
    HAS_CHANGES=true
    echo "   Uncommitted changes: Yes"
  else
    HAS_CHANGES=false
    echo "   Uncommitted changes: No"
  fi

  # Check if PR exists
  PR_NUMBER=$(gh pr list --head "$CURRENT_BRANCH" --json number --jq '.[0].number' 2>/​dev/​null)

  if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
    HAS_PR=true
    echo "   PR: #$PR_NUMBER"
  else
    HAS_PR=false
    echo "   PR: None"
  fi

  FEATURE_BRANCH_EXISTS=true
else
  echo "ℹ️ Not on feature branch (current: $CURRENT_BRANCH)"
  FEATURE_BRANCH_EXISTS=false
fi

Step 3: Determine Resumption Point

RESUME_PHASE=1
RESUME_STEP=""

if [ "$FEATURE_BRANCH_EXISTS" = true ]; then
  if [ "$HAS_PR" = true ]; then
    # PR exists → Resume from Phase 5 (Gemini Review)
    RESUME_PHASE=5
    RESUME_STEP="Monitor CI and Gemini review"
    SKIP_PHASES="1, 2, 3, 4"

  elif [ "$COMMIT_COUNT" -gt 0 ]; then
    # Commits exist but no PR → Resume from Phase 4 (PR Creation)
    # But first verify Phase 3 quality gates passed
    RESUME_PHASE=4
    RESUME_STEP="Create pull request"
    SKIP_PHASES="1, 2, 3"
    VERIFY_QUALITY=true

  elif [ "$HAS_CHANGES" = true ]; then
    # Uncommitted changes → Resume from Phase 3 (Quality Assurance)
    RESUME_PHASE=3
    RESUME_STEP="Run quality gates"
    SKIP_PHASES="1, 2 (partial)"

  else
    # Branch exists but no commits → Resume from Phase 2 Step 3 (Implementation)
    RESUME_PHASE=2
    RESUME_STEP="Implementation (branch already created)"
    SKIP_PHASES="1, 2 (steps 1-2)"
  fi
else
  # No feature branch → Start from Phase 1
  RESUME_PHASE=1
  RESUME_STEP="Issue discovery and planning"
  SKIP_PHASES="None"
fi

# Override with state file if more recent
if [ "$STATE_FOUND" = true ] && [ "$SAVED_PHASE" -gt "$RESUME_PHASE" ]; then
  RESUME_PHASE=$SAVED_PHASE
  echo "⚠️ State file indicates later phase - using Phase $SAVED_PHASE"
fi

Step 4: Validate Resumption

# If resuming from Phase 4+, verify quality gates passed
if [ "$RESUME_PHASE" -ge 4 ] && [ "$VERIFY_QUALITY" = true ]; then
  echo ""
  echo "⚠️ Resuming after implementation - validating quality gates..."

  # Quick validation checks
  VALIDATION_PASSED=true

  # Check if tests exist
  if ! npm run test --dry-run &>/​dev/​null; then
    echo "   ⚠️ Warning: No test script found"
  fi

  # Check for TypeScript errors
  if command -v tsc &>/​dev/​null; then
    if ! tsc --noEmit &>/​dev/​null; then
      echo "   ❌ TypeScript errors detected"
      VALIDATION_PASSED=false
    fi
  fi

  if [ "$VALIDATION_PASSED" = false ]; then
    echo ""
    echo "❌ Quality validation failed - resuming from Phase 3 instead"
    RESUME_PHASE=3
    RESUME_STEP="Re-run quality gates"
  fi
fi

Step 5: Return Resumption Data

{
  "resumption": {
    "detected": true,
    "phase": 4,
    "step": "Create pull request",
    "skipPhases": [1, 2, 3]
  },
  "state": {
    "source": "git+state_file",
    "stateFile": {
      "found": true,
      "issue": 137,
      "savedPhase": 3,
      "timestamp": "2025-10-21T..."
    },
    "git": {
      "branch": "feature/​issue-137-dark-mode",
      "issue": 137,
      "commits": 5,
      "hasChanges": false,
      "hasPR": false
    }
  },
  "recommendation": {
    "action": "resume",
    "phase": 4,
    "reason": "Branch exists with commits but no PR - ready for PR creation",
    "validation": {
      "qualityGates": "not_verified",
      "recommendation": "Run Phase 3 validation before proceeding"
    }
  }
}

Output Format

Resume from Phase 1 (Fresh Start)

{
  "resumption": {
    "detected": false,
    "phase": 1,
    "step": "Issue discovery and planning",
    "skipPhases": []
  },
  "state": {
    "source": "none",
    "branch": "development"
  }
}

Resume from Phase 3 (Quality Gates)

{
  "resumption": {
    "detected": true,
    "phase": 3,
    "step": "Run quality gates",
    "skipPhases": [1, 2]
  },
  "state": {
    "source": "git",
    "git": {
      "branch": "feature/​issue-137-dark-mode",
      "issue": 137,
      "commits": 0,
      "hasChanges": true
    }
  }
}

Resume from Phase 5 (Gemini Review)

{
  "resumption": {
    "detected": true,
    "phase": 5,
    "step": "Monitor CI and Gemini review",
    "skipPhases": [1, 2, 3, 4]
  },
  "state": {
    "source": "git+pr",
    "git": {
      "branch": "feature/​issue-137-dark-mode",
      "issue": 137,
      "commits": 5,
      "hasPR": true,
      "prNumber": 45
    }
  }
}

Integration with Conductor

Used at the start of conductor workflow:

### BEFORE STARTING ANY WORKFLOW:

**Step 1: Check for Resumption**

Use `load-resumption-state` skill to analyze previous work:

Result: {
  "resumption": {
    "detected": true,
    "phase": 3,
    "skipPhases": [1, 2]
  }
}

**OUTPUT TO USER:**

🔄 RESUMPTION DETECTED

Current State: Branch: feature/​issue-137-dark-mode Issue: #137 Commits: 5 PR: None

Detected Work: ✅ Phase 1: Planning ✅ Phase 2: Implementation → Phase 3: Quality Assurance

Resume from Phase 3? This will:

  • Skip completed phases
  • Continue with Quality Assurance
  • Preserve existing commits

**If user confirms**: Jump to Phase 3
**If user declines**: Start fresh from Phase 1

Resumption Decision Matrix

Git StateState FileResume PhaseSkip Phases
No feature branchNone1None
Feature branch, no commitsPhase 22 (Step 3)1, 2 (partial)
Feature branch + commitsPhase 331, 2
Feature branch + commits + changesNone31, 2
Feature branch + PRPhase 551, 2, 3, 4
Feature branch + PR + CI passedPhase 661, 2, 3, 4, 5

Related Skills

  • save-workflow-state - Save state after each phase
  • determine-resumption-phase - Advanced decision logic
  • clear-workflow-state - Clean up after workflow completion

Error Handling

Corrupted State File

{
  "resumption": {
    "detected": true,
    "phase": 2,
    "warning": "State file corrupted - using git-only resumption"
  }
}

Conflicting State

{
  "resumption": {
    "detected": true,
    "phase": 3,
    "warning": "State file (Phase 2) conflicts with git (Phase 3) - using git state"
  }
}

Best Practices

  1. Always check state before starting - Prevents duplicate work
  2. Trust git state over state file - More reliable source of truth
  3. Validate quality gates - When resuming Phase 4+
  4. Inform user of resumption - Let them confirm before skipping phases
  5. Log resumption decision - Include reasoning for debugging

Notes

  • State file is supplemental - git is source of truth
  • Resumption saves significant time on interrupted workflows
  • User should always confirm resumption point
  • Quality gates should be re-validated when resuming late phases

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View