Skip to content
Development
Command

/start

Intelligent workflow orchestration with state management, error recovery, and sub-agent coordination

From plugin
claude-cmd
313180 skills180 commands

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/start

Context preview

What this command does when you run it.

Intelligent workflow orchestration with state management, error recovery, and sub-agent coordination

Command definition

start.md
allowed-tools: TodoWrite, TodoRead, Bash(git:*), Bash(deno:task:*), Bash(jq:*), Bash(gdate:*), Read, Write, Task, Grep, Glob, Edit, MultiEdit
name: "Start"
description: "Intelligent workflow orchestration with state management, error recovery, and sub-agent coordination"
author: "wcygan"
tags: ["workflow","start"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
  • Target task: $ARGUMENTS
  • Current git status: !`git status --porcelain 2>/dev/null || echo "No git repository"`
  • Current branch: !`git branch --show-current 2>/dev/null || echo "unknown"`
  • Active todos: !`jq -r '.[] | select(.status == "in_progress") | "\(.id): \(.content)"' ~/.claude/todos.json 2>/dev/null | head -5 || echo "No active todos"`
  • Available todos: !`jq -r '.[] | select(.status == "pending") | "\(.priority): \(.content)"' ~/.claude/todos.json 2>/dev/null | head -3 || echo "No pending todos"`
  • Project environment: !`deno task --quiet 2>/dev/null | head -5 || echo "No deno.json tasks found"`
  • Recent commits: !`git log --oneline -3 2>/dev/null || echo "No git history"`
  • Uncommitted changes: !`git diff --name-only HEAD 2>/dev/null | wc -l | tr -d ' '` files

Your Task

STEP 1: Initialize intelligent workflow session and analyze project state

  • CREATE session state file: `/tmp/start-session-$SESSION_ID.json`
  • ANALYZE current project state from Context section
  • DETERMINE workflow complexity (simple task vs. complex feature implementation)
  • VALIDATE environment and dependencies
# Initialize workflow session state
echo '{
  "sessionId": "'$SESSION_ID'",
  "targetTask": "'$ARGUMENTS'",
  "state": "initializing",
  "startTime": "'$(gdate -Iseconds 2>/dev/null || date -Iseconds)'",
  "checkpoints": [],
  "filesModified": [],
  "commitsCreated": 0,
  "testsStatus": "unknown",
  "priority": "auto-detect",
  "blockers": []
}' > /tmp/start-session-$SESSION_ID.json

STEP 2: Intelligent task selection and priority analysis

CASE task_specification: WHEN "user_specified":

  • PARSE $ARGUMENTS for specific task details
  • VALIDATE task exists in TodoWrite system
  • UPDATE session state with task details

WHEN "auto_select":

IF available_todos > 0:

LAUNCH parallel sub-agents for comprehensive task analysis:

  • **Agent 1: Priority Analysis**: Analyze all pending todos for priority, dependencies, and effort estimation
  • Focus: Task dependencies, blocking relationships, effort vs. impact scoring
  • Tools: TodoRead for task analysis, project file analysis for context
  • Output: Prioritized task list with detailed scoring and reasoning
  • **Agent 2: Environment Assessment**: Evaluate current project state and readiness for work
  • Focus: Git status, test state, dependency health, development environment
  • Tools: git commands, project-specific build tools, test runners
  • Output: Environment readiness report with any setup requirements
  • **Agent 3: Code Analysis**: Analyze codebase for related work and potential conflicts
  • Focus: Recent changes, related files, potential merge conflicts, ongoing work
  • Tools: Grep, git log analysis, file dependency mapping
  • Output: Code context report with conflict warnings and related work identification

ELSE:

  • EXECUTE intelligent project discovery to identify potential tasks
  • CREATE new todo items based on code analysis findings
  • SUGGEST task creation workflow

STEP 3: Pre-work setup with checkpoint creation

TRY:

**Environment Validation and Setup:**

# Validate clean working state
echo "๐Ÿ” Validating development environment..."

# Check for uncommitted changes
uncommitted_files=$(git diff --name-only HEAD 2>/dev/null | wc -l | tr -d ' ')
if [ "$uncommitted_files" -gt 0 ]; then
  echo "โš ๏ธ Found $uncommitted_files uncommitted files"
  echo "๐Ÿ“‹ Uncommitted files:"
  git diff --name-only HEAD | head -5
  echo "๐Ÿ’พ Creating pre-work checkpoint..."
  git stash push -m "Pre-work checkpoint for session $SESSION_ID"
fi

# Validate test state
echo "๐Ÿงช Checking current test status..."
if command -v deno >/dev/null && [ -f "deno.json" ]; then
  deno task test >/tmp/pre-work-tests-$SESSION_ID.log 2>&1
  test_exit_code=$?
elif command -v cargo >/dev/null && [ -f "Cargo.toml" ]; then
  cargo test >/tmp/pre-work-tests-$SESSION_ID.log 2>&1
  test_exit_code=$?
elif command -v go >/dev/null && [ -f "go.mod" ]; then
  go test ./... >/tmp/pre-work-tests-$SESSION_ID.log 2>&1
  test_exit_code=$?
else
  echo "No recognized test framework found"
  test_exit_code=0
fi

# Update session state with test results
jq --arg status "$([ $test_exit_code -eq 0 ] && echo 'passing' || echo 'failing')" \
   '.testsStatus = $status | .state = "setup_complete"' \
   /tmp/start-session-$SESSION_ID.json > /tmp/start-session-$SESSION_ID.tmp && \
mv /tmp/start-session-$SESSION_ID.tmp /tmp/start-session-$SESSION_ID.json

**TodoWrite Integration and Task Activation:**

# Load and activate selected task
selected_task="$ARGUMENTS"
if [ -z "$selected_task" ]; then
  # Auto-select highest priority task from TodoRead
  TodoRead
  # Parse TodoRead output to get highest priority pending task
  # This would be implemented based on TodoRead output format
fi

# Mark task as in-progress
TodoWrite --update-task "$selected_task" --status "in_progress" --session-id "$SESSION_ID"

# Create progress subtasks for complex work
if [[ "$selected_task" == *"implement"* ]] || [[ "$selected_task" == *"add"* ]]; then
  TodoWrite --create-subtask "$selected_task" "Planning and design" --priority "high"
  TodoWrite --create-subtask "$selected_task" "Implementation" --priority "high"
  TodoWrite --create-subtask "$selected_task" "Testing and validation" --priority "high"
  TodoWrite --create-subtask "$selected_task" "Documentation" --priority "medium"
fi

CATCH

Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin