Skip to content

Instantly share code, notes, and snippets.

@asachs01
Created January 19, 2026 20:18
Show Gist options
  • Select an option

  • Save asachs01/ba717790ae3fe1b214a6086e7ff796fb to your computer and use it in GitHub Desktop.

Select an option

Save asachs01/ba717790ae3fe1b214a6086e7ff796fb to your computer and use it in GitHub Desktop.
Chaining Taskmaster + Zeroshot for Autonomous Development
description allowed-tools argument-hint
Execute all pending Taskmaster tasks via Zeroshot (sequentially or parallel)
Bash(zeroshot:*), Bash(mcp-cli:*)
--parallel | --ship | --max N

You are the batch task executor. Execute multiple pending tasks from Taskmaster via Zeroshot.

Arguments

$ARGUMENTS

  • --parallel: Run independent tasks (no dependencies on each other) in parallel
  • --ship: Use full automation mode (auto-merge PRs)
  • --max N: Limit to N tasks (default: all pending)

Workflow

Step 1: Get All Pending Tasks

Fetch all tasks from Taskmaster:

mcp-cli call taskmaster-ai/get_tasks '{"projectRoot": ".", "withSubtasks": true}'

Filter to only pending status tasks.

Step 2: Analyze Dependencies

For each pending task:

  1. Check its dependencies array
  2. Identify which tasks can run immediately (all dependencies satisfied)
  3. Group tasks by dependency level for parallel execution

Step 3: Execute Tasks

Sequential Mode (default): For each task in priority order:

  1. Get task details
  2. Mark as in-progress
  3. Run zeroshot "[prompt]" --worktree --pr -d
  4. Wait for completion (poll zeroshot status)
  5. Update Taskmaster status
  6. Continue to next task

Parallel Mode (--parallel):

  1. Identify all independent tasks (no pending dependencies)
  2. Launch all in parallel: zeroshot "[prompt]" --worktree --pr -d
  3. Monitor with zeroshot watch
  4. As each completes, update Taskmaster
  5. Check for newly unblocked tasks
  6. Repeat until all tasks complete

Step 4: Report Summary

After all tasks complete, report:

  • Total tasks attempted
  • Successful completions
  • Failures (with task IDs)
  • Any remaining blocked tasks

Prompt Template for Each Task

## Task: [title]

[description]

### Implementation Details
[details]

### Test Strategy
[testStrategy]

### Acceptance Criteria
- All tests pass
- Code follows project conventions
- Atomic, well-messaged commits

Notes

  • Each task runs in its own git worktree (isolated branch)
  • Use zeroshot watch in another terminal to monitor all running tasks
  • If a task fails, it's marked as blocked and execution continues to next task
  • The --ship flag enables auto-merge on validation success
description allowed-tools argument-hint
Get next task from Taskmaster and execute it via Zeroshot
Bash(zeroshot:*), Bash(mcp-cli:*)
--ship | --pr | --attach | task-id

You are the Taskmaster-Zeroshot orchestrator. Your job is to get a task and execute it autonomously.

Your Workflow

Step 1: Get the Task

$ARGUMENTS

If a task ID was provided above, fetch that specific task:

  • Use mcp-cli call taskmaster-ai/get_task '{"id": "<task-id>", "projectRoot": "."}'

Otherwise, get the next priority task:

  • Use mcp-cli call taskmaster-ai/next_task '{"projectRoot": "."}'

Step 2: Validate the Task

Check that the task has:

  • A clear title and description
  • Implementation details (if complex)
  • A test strategy (CRITICAL for Zeroshot validators)

If testStrategy is missing or vague, warn the user and suggest expanding the task first.

Step 3: Update Status to In-Progress

Before executing, mark the task as in-progress:

  • Use mcp-cli call taskmaster-ai/set_task_status '{"id": "<task-id>", "status": "in-progress", "projectRoot": "."}'

Step 4: Build the Zeroshot Prompt

Create a well-structured prompt from the task data:

## Task: [title]

[description]

### Implementation Details
[details field - or summarize if missing]

### Test Strategy
[testStrategy field]

### Acceptance Criteria
- All tests must pass
- Code follows project conventions
- Changes are atomic and well-committed

Step 5: Execute with Zeroshot

Run the task with appropriate flags based on user arguments:

  • Default: zeroshot "[prompt]" --worktree
  • With --pr: zeroshot "[prompt]" --worktree --pr
  • With --ship: zeroshot "[prompt]" --ship
  • With --attach: zeroshot "[prompt]" --worktree (stay attached)

Use daemon mode (-d) unless --attach was specified.

Step 6: Report Status

After launching Zeroshot:

  1. Report the cluster ID for monitoring
  2. Remind user they can run zeroshot watch to monitor
  3. Remind user to update Taskmaster status when complete:
    • Success: mcp-cli call taskmaster-ai/set_task_status '{"id": "<id>", "status": "done", "projectRoot": "."}'
    • Failure: mcp-cli call taskmaster-ai/set_task_status '{"id": "<id>", "status": "blocked", "projectRoot": "."}'

Important Notes

  • Always use --worktree for git isolation unless user specifies otherwise
  • The testStrategy is CRITICAL - Zeroshot validators use it to verify work
  • If task lacks detail, consider using taskmaster-ai/expand_task first
description allowed-tools argument-hint
Sync Zeroshot completion status back to Taskmaster
Bash(zeroshot:*), Bash(mcp-cli:*)
task-id

Synchronize Zeroshot execution results back to Taskmaster task status.

Arguments

$ARGUMENTS

If a task ID is provided, sync that specific task. Otherwise, sync all in-progress tasks.

Workflow

Step 1: Get In-Progress Tasks from Taskmaster

mcp-cli call taskmaster-ai/get_tasks '{"projectRoot": "."}'

Filter to tasks with status in-progress.

Step 2: Check Zeroshot Status

For each in-progress task:

  1. Run zeroshot list to find matching cluster
  2. Check cluster status

Step 3: Update Taskmaster Based on Zeroshot Results

For each matched task:

If Zeroshot shows completed:

mcp-cli call taskmaster-ai/set_task_status '{"id": "<task-id>", "status": "done", "projectRoot": "."}'

If Zeroshot shows failed or stopped:

mcp-cli call taskmaster-ai/set_task_status '{"id": "<task-id>", "status": "blocked", "projectRoot": "."}'

If Zeroshot shows running:

  • No change needed
  • Report that task is still in progress

Step 4: Report Sync Results

Show what was updated:

=== SYNC RESULTS ===
Task #5: in-progress → done (Zeroshot completed)
Task #7: in-progress → blocked (Zeroshot failed: validation error)
Task #9: still running (no change)

Notes

  • This command is useful after running tasks in daemon mode
  • Run this periodically or after zeroshot watch shows completions
  • For continuous sync, consider running this in a loop or setting up a cron job
#!/usr/bin/env python3
"""
Claude Code PostToolUse Hook: Task Execution Monitor
This hook monitors Bash tool calls for Zeroshot executions and logs them.
It also provides reminders to sync status back to Taskmaster.
Hook events it handles:
- PostToolUse (Bash): Logs zeroshot commands and extracts task info
"""
import json
import sys
import os
import re
from datetime import datetime
from pathlib import Path
# Log file location
LOG_DIR = Path.home() / ".zeromaster"
LOG_FILE = LOG_DIR / "executions.log"
STATE_FILE = LOG_DIR / "active-tasks.json"
def ensure_log_dir():
"""Create log directory if it doesn't exist."""
LOG_DIR.mkdir(parents=True, exist_ok=True)
def log_execution(task_info: dict):
"""Log a task execution to file."""
ensure_log_dir()
timestamp = datetime.now().isoformat()
log_entry = f"[{timestamp}] {json.dumps(task_info)}\n"
with open(LOG_FILE, "a") as f:
f.write(log_entry)
def update_active_tasks(task_id: str, cluster_id: str = None, status: str = "running"):
"""Track active task executions."""
ensure_log_dir()
# Load existing state
active_tasks = {}
if STATE_FILE.exists():
try:
with open(STATE_FILE) as f:
active_tasks = json.load(f)
except (json.JSONDecodeError, IOError):
active_tasks = {}
# Update state
if status == "completed" and task_id in active_tasks:
del active_tasks[task_id]
else:
active_tasks[task_id] = {
"cluster_id": cluster_id,
"status": status,
"started_at": datetime.now().isoformat()
}
# Save state
with open(STATE_FILE, "w") as f:
json.dump(active_tasks, f, indent=2)
def extract_task_id_from_command(command: str) -> str:
"""Try to extract task ID from zeroshot command."""
# Look for patterns like "Task #5" or "Task: 5" in the command
patterns = [
r"Task #(\d+)",
r"Task:\s*#?(\d+)",
r'"id":\s*"?(\d+)"?',
]
for pattern in patterns:
match = re.search(pattern, command, re.IGNORECASE)
if match:
return match.group(1)
return None
def extract_cluster_id_from_output(output: str) -> str:
"""Try to extract Zeroshot cluster ID from output."""
# Zeroshot outputs cluster IDs like "cluster-abc123" or task IDs
patterns = [
r"cluster[_-]([a-zA-Z0-9]+)",
r"task[_-]([a-zA-Z0-9-]+)",
r"Started:\s*([a-zA-Z0-9-]+)",
]
for pattern in patterns:
match = re.search(pattern, output, re.IGNORECASE)
if match:
return match.group(0)
return None
def handle_post_tool_use(input_data: dict) -> dict:
"""Handle PostToolUse event for Bash tool."""
tool_name = input_data.get("tool_name", "")
if tool_name != "Bash":
return {}
tool_input = input_data.get("tool_input", {})
tool_response = input_data.get("tool_response", {})
command = tool_input.get("command", "")
output = str(tool_response.get("stdout", ""))
# Check if this is a zeroshot command
if "zeroshot" not in command.lower():
return {}
# Log the execution
task_id = extract_task_id_from_command(command)
cluster_id = extract_cluster_id_from_output(output)
task_info = {
"command": command[:200], # Truncate long commands
"task_id": task_id,
"cluster_id": cluster_id,
"cwd": input_data.get("cwd", ""),
"success": tool_response.get("exitCode", 1) == 0
}
log_execution(task_info)
# Track active task if we found a task ID
if task_id:
update_active_tasks(task_id, cluster_id, "running")
# Return a reminder message if this was a task execution
if "run" in command.lower() or command.strip().startswith("zeroshot \""):
return {
"systemMessage": f"Task execution started. Monitor with `zeroshot watch`. Remember to sync status back to Taskmaster when complete using `/sync-status`."
}
return {}
def main():
"""Main entry point."""
try:
input_data = json.load(sys.stdin)
except json.JSONDecodeError:
sys.exit(1)
hook_event = input_data.get("hook_event_name", "")
if hook_event == "PostToolUse":
result = handle_post_tool_use(input_data)
if result:
print(json.dumps(result))
sys.exit(0)
if __name__ == "__main__":
main()
description allowed-tools
Show combined Taskmaster + Zeroshot status
Bash(zeroshot:*), Bash(mcp-cli:*)

Show the current status of both Taskmaster tasks and Zeroshot executions.

Gather Status

Taskmaster Status

Run: mcp-cli call taskmaster-ai/get_tasks '{"projectRoot": "."}'

Summarize:

  • Total tasks
  • Pending (ready to execute)
  • In-progress (currently running)
  • Blocked (failed or needs attention)
  • Done (completed)

Show the next priority task if any are pending.

Zeroshot Status

Run: zeroshot list to see all tracked tasks/clusters.

For any running clusters, show:

  • Cluster ID
  • Status (running, stopped, completed, failed)
  • Associated task (if identifiable from prompt)

Output Format

=== TASKMASTER STATUS ===
Total: X tasks
  Pending:     X (ready to execute)
  In-Progress: X (currently running)
  Blocked:     X (needs attention)
  Done:        X (completed)

Next Task: #ID - Title (priority)

=== ZEROSHOT STATUS ===
Active Clusters: X
  [cluster-id] - status - "task title snippet..."

=== QUICK ACTIONS ===
- Execute next task: /execute-task
- Execute all tasks: /execute-all
- Monitor running: zeroshot watch

Taskmaster + Zeroshot Integration Workflow Guide

Overview

A practical guide for chaining Taskmaster (task planning) with Zeroshot (autonomous execution) in your daily development workflow.

Philosophy: Taskmaster is the "brain" (source of truth for what to do), Zeroshot is the "hands" (executes tasks autonomously).


The Integration Pattern

┌──────────────────────────────────────────────────────────────────┐
│                        YOUR WORKFLOW                              │
├──────────────────────────────────────────────────────────────────┤
│                                                                   │
│   1. PLAN (Taskmaster)          2. EXECUTE (Zeroshot)            │
│   ────────────────────          ─────────────────────            │
│   • Parse PRD → tasks           • Pick task from Taskmaster      │
│   • Expand into subtasks        • Run autonomously               │
│   • Track status & deps         • Validators check work          │
│   • Prioritize work             • Create PR on success           │
│                                                                   │
│                    ↓ task details ↓                               │
│                                                                   │
│   .taskmaster/tasks.json  ──────────►  zeroshot "task prompt"    │
│                                                                   │
│                    ↓ status update ↓                              │
│                                                                   │
│   set_task_status(done)  ◄──────────  CLUSTER_COMPLETE           │
│                                                                   │
└──────────────────────────────────────────────────────────────────┘

Workflow Steps

Step 1: Initialize Project with Taskmaster

# In your project directory
cd ~/workspace/my-project

# Initialize Taskmaster (creates .taskmaster/ directory)
npx task-master-ai init

# Or if using Claude Code, the MCP tools handle this automatically

Step 2: Plan with Taskmaster

Option A: Parse a PRD document

# Via MCP (in Claude Code)
# Use: taskmaster-ai/parse_prd with your PRD file

# Via CLI
npx task-master-ai parse-prd --input docs/my-feature.md

Option B: Add tasks manually

# Via MCP
# Use: taskmaster-ai/add_task

# The task should include:
# - Clear title
# - Detailed description
# - Implementation details
# - Test strategy (critical for Zeroshot validation!)

Step 3: Review and Expand Tasks

# List all tasks
# MCP: taskmaster-ai/get_tasks

# Expand complex tasks into subtasks
# MCP: taskmaster-ai/expand_task with id and num_subtasks

# Check task dependencies
# MCP: taskmaster-ai/validate_dependencies

Step 4: Get Next Task for Execution

# MCP: taskmaster-ai/next_task
# Returns the highest priority task with all dependencies satisfied

# The response includes:
# - id, title, description
# - details (implementation guidance)
# - testStrategy (Zeroshot will use this for validation!)
# - subtasks (if any)

Step 5: Execute with Zeroshot

Build the prompt from Taskmaster task:

## Task: [title from Taskmaster]

[description from Taskmaster]

### Implementation Details
[details from Taskmaster]

### Test Strategy
[testStrategy from Taskmaster - CRITICAL for validators]

### Acceptance Criteria
- All tests pass
- Code follows project conventions
- PR ready for review

Run Zeroshot:

# Basic execution (uses git worktree isolation)
zeroshot "## Task: Implement user auth..." --worktree

# With PR creation
zeroshot "## Task: Implement user auth..." --worktree --pr

# Full automation (auto-merge on success)
zeroshot "## Task: Implement user auth..." --ship

# Background execution (daemon mode)
zeroshot "## Task: Implement user auth..." --worktree --pr -d

Step 6: Monitor Execution

# Real-time TUI dashboard
zeroshot watch

# Check specific task status
zeroshot status <task-id>

# List all running clusters
zeroshot list

Step 7: Update Taskmaster on Completion

On Success (CLUSTER_COMPLETE):

# MCP: taskmaster-ai/set_task_status
# id: "5" (the task ID)
# status: "done"

On Failure (CLUSTER_FAILED or validation failure):

# MCP: taskmaster-ai/set_task_status
# id: "5"
# status: "blocked"

# Optionally add notes about what failed
# MCP: taskmaster-ai/update_task with notes

Step 8: Resume or Retry

# If Zeroshot crashed or was interrupted
zeroshot resume <cluster-id>

# If task failed validation, you can:
# 1. Fix issues manually and re-run
# 2. Update task details in Taskmaster with more guidance
# 3. Re-run with adjusted prompt

Practical Shell Workflow

Here's a practical shell script pattern you can use:

#!/bin/bash
# zeromaster-workflow.sh - Run next Taskmaster task via Zeroshot

PROJECT_ROOT=$(pwd)

# 1. Get next task from Taskmaster
echo "Fetching next task from Taskmaster..."
TASK_JSON=$(mcp-cli call taskmaster-ai/next_task "{\"projectRoot\": \"$PROJECT_ROOT\"}")

# Check if we got a task
if echo "$TASK_JSON" | grep -q '"id"'; then
  TASK_ID=$(echo "$TASK_JSON" | jq -r '.id')
  TASK_TITLE=$(echo "$TASK_JSON" | jq -r '.title')
  TASK_DESC=$(echo "$TASK_JSON" | jq -r '.description')
  TASK_DETAILS=$(echo "$TASK_JSON" | jq -r '.details // ""')
  TASK_TEST=$(echo "$TASK_JSON" | jq -r '.testStrategy // ""')

  echo "Found task #$TASK_ID: $TASK_TITLE"

  # 2. Build Zeroshot prompt
  PROMPT="## Task: $TASK_TITLE

$TASK_DESC

### Implementation Details
$TASK_DETAILS

### Test Strategy
$TASK_TEST

### Instructions
1. Implement this task following the details above
2. Write/update tests as specified
3. Ensure all tests pass before completing
4. Create atomic, well-messaged commits"

  # 3. Update Taskmaster status to in-progress
  echo "Marking task as in-progress..."
  mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"in-progress\", \"projectRoot\": \"$PROJECT_ROOT\"}"

  # 4. Execute with Zeroshot
  echo "Executing with Zeroshot..."
  zeroshot "$PROMPT" --worktree --pr

  # 5. Check result and update Taskmaster
  # (In practice, you'd poll zeroshot status or check exit code)
  read -p "Did the task complete successfully? (y/n) " RESULT
  if [ "$RESULT" = "y" ]; then
    mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"done\", \"projectRoot\": \"$PROJECT_ROOT\"}"
    echo "Task marked as done!"
  else
    mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"blocked\", \"projectRoot\": \"$PROJECT_ROOT\"}"
    echo "Task marked as blocked. Review and retry."
  fi
else
  echo "No pending tasks found!"
fi

Key Integration Points

Taskmaster Task → Zeroshot Prompt

The testStrategy field is critical! Zeroshot's validators will use this to verify the implementation:

# Good testStrategy (Zeroshot can validate)
testStrategy: |
  - Unit tests for auth middleware in tests/auth.test.ts
  - Integration test for login flow
  - Run: npm test -- --grep "auth"
  - Verify JWT token generation and validation

# Bad testStrategy (vague, hard to validate)
testStrategy: "Make sure it works"

Status Mapping

Taskmaster Status When to Set Zeroshot Event
pending Initial state -
in-progress Before running Zeroshot Task started
done After successful completion CLUSTER_COMPLETE
blocked On failure or need intervention CLUSTER_FAILED
review PR created, awaiting human review Validators passed

Zeroshot Complexity → Taskmaster Priority

Zeroshot's Conductor classifies tasks as:

  • TRIVIAL: Single agent, no validation (use for low-priority tasks)
  • SIMPLE: 2 agents, 1 validator
  • STANDARD: 3 agents, 2 validators
  • CRITICAL: Opus planner, 5+ validators (use for high-priority tasks)

This aligns naturally with Taskmaster's priority field.


Best Practices

1. Write Detailed Test Strategies

Zeroshot validators need clear, executable success criteria:

- Run `npm test` - all tests must pass
- Run `npm run lint` - no errors
- Run `npm run typecheck` - no type errors
- Manually verify: login page renders correctly

2. Use Subtasks for Complex Features

Break large tasks into smaller, independently executable subtasks:

# Expand a complex task
mcp-cli call taskmaster-ai/expand_task '{"id": "5", "num": 4, "projectRoot": "."}'

3. Leverage Git Worktree Isolation

Always use --worktree flag to keep work isolated:

zeroshot "Task..." --worktree  # Creates isolated branch

4. Monitor Long-Running Tasks

# In another terminal
zeroshot watch

# Or check specific cluster
zeroshot status <cluster-id> --json

5. Batch Independent Tasks

If you have multiple independent tasks (no dependencies), you can run them in parallel using Zeroshot's daemon mode:

# Get all pending independent tasks
# Run each in background
zeroshot "Task 1..." --worktree --pr -d
zeroshot "Task 2..." --worktree --pr -d
zeroshot "Task 3..." --worktree --pr -d

# Monitor all
zeroshot watch

Troubleshooting

Zeroshot validation failures

  1. Check testStrategy in Taskmaster task - is it specific enough?
  2. Review validator output in Zeroshot logs
  3. Update task with more detailed implementation guidance
  4. Re-run with zeroshot resume <id>

Task stuck in-progress

  1. Check zeroshot list for cluster status
  2. If zombie/stopped: zeroshot resume <id> or kill and retry
  3. Update Taskmaster status manually if needed

Dependency issues

  1. Run taskmaster-ai/validate_dependencies to check
  2. Use taskmaster-ai/fix_dependencies to auto-fix

Quick Reference

# === TASKMASTER (Planning) ===
mcp-cli call taskmaster-ai/parse_prd '{"input":"prd.md","projectRoot":"."}'
mcp-cli call taskmaster-ai/get_tasks '{"projectRoot":"."}'
mcp-cli call taskmaster-ai/next_task '{"projectRoot":"."}'
mcp-cli call taskmaster-ai/get_task '{"id":"5","projectRoot":"."}'
mcp-cli call taskmaster-ai/set_task_status '{"id":"5","status":"done","projectRoot":"."}'
mcp-cli call taskmaster-ai/expand_task '{"id":"5","num":4,"projectRoot":"."}'

# === ZEROSHOT (Execution) ===
zeroshot "Task prompt..."              # Basic run
zeroshot "Task..." --worktree          # Git isolation
zeroshot "Task..." --worktree --pr     # Create PR
zeroshot "Task..." --ship              # Full automation
zeroshot "Task..." -d                  # Daemon mode
zeroshot watch                         # Monitor
zeroshot status <id>                   # Check status
zeroshot resume <id>                   # Resume crashed
zeroshot list                          # List all


Claude Code Commands

Copy the .claude/ directory from this project to use these commands in any project:

cp -r ~/workspace/zeroMaster/.claude ~/workspace/my-project/

Available Commands

Command Description
/execute-task Get next task from Taskmaster, execute via Zeroshot
/execute-task 5 Execute specific task #5
/execute-task --ship Full automation with auto-merge
/execute-task --pr Create PR on completion
/execute-all Execute all pending tasks sequentially
/execute-all --parallel Execute independent tasks in parallel
/task-status Show combined Taskmaster + Zeroshot status
/sync-status Sync Zeroshot results back to Taskmaster

Example Usage

# In Claude Code, just type:
/execute-task

# Or with options:
/execute-task --pr

# Check status:
/task-status

# After tasks complete:
/sync-status

Hook: Task Monitor

The included PostToolUse hook (task-monitor.py) automatically:

  • Logs all Zeroshot executions to ~/.zeromaster/executions.log
  • Tracks active tasks in ~/.zeromaster/active-tasks.json
  • Reminds you to sync status back to Taskmaster

Summary

The integration workflow is:

  1. Plan in Taskmaster: PRD → tasks with detailed testStrategy
  2. Select task: next_task → get highest priority ready task
  3. Build prompt: Include title, description, details, testStrategy
  4. Execute in Zeroshot: Run with appropriate isolation/PR options
  5. Update Taskmaster: Set status based on Zeroshot result
  6. Repeat: Get next task, execute, update

With Claude Code commands, this simplifies to:

  1. /execute-task (or /execute-all --parallel)
  2. zeroshot watch to monitor
  3. /sync-status when complete

This keeps Taskmaster as your single source of truth while leveraging Zeroshot's multi-agent validation for autonomous execution.

#!/bin/bash
# zeromaster-workflow.sh - Run next Taskmaster task via Zeroshot
#
# Usage:
# ./zeromaster-workflow.sh # Run next task interactively
# ./zeromaster-workflow.sh --auto # Run next task, auto-mark status
# ./zeromaster-workflow.sh --ship # Full automation mode
#
# Prerequisites:
# - task-master-ai installed (npm i -g task-master-ai)
# - zeroshot installed (npm i -g @covibes/zeroshot)
# - mcp-cli available in PATH
# - jq installed for JSON parsing
# - Project initialized with Taskmaster (.taskmaster/ exists)
set -e
PROJECT_ROOT=$(pwd)
AUTO_MODE=false
SHIP_MODE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--auto)
AUTO_MODE=true
shift
;;
--ship)
SHIP_MODE=true
AUTO_MODE=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Check prerequisites
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed. Install with: brew install jq"
exit 1
fi
if ! command -v mcp-cli &> /dev/null; then
echo "Error: mcp-cli is required but not installed."
exit 1
fi
if ! command -v zeroshot &> /dev/null; then
echo "Error: zeroshot is required but not installed. Install with: npm i -g @covibes/zeroshot"
exit 1
fi
if [ ! -d ".taskmaster" ]; then
echo "Error: .taskmaster directory not found. Initialize with: npx task-master-ai init"
exit 1
fi
echo "=========================================="
echo " Taskmaster + Zeroshot Workflow Runner"
echo "=========================================="
echo ""
# 1. Get next task from Taskmaster
echo "Fetching next task from Taskmaster..."
TASK_JSON=$(mcp-cli call taskmaster-ai/next_task "{\"projectRoot\": \"$PROJECT_ROOT\"}" 2>/dev/null || echo "{}")
# Check if we got a task
if ! echo "$TASK_JSON" | jq -e '.id' > /dev/null 2>&1; then
echo "No pending tasks found!"
echo ""
echo "Tip: Create tasks with:"
echo " mcp-cli call taskmaster-ai/parse_prd '{\"input\":\"prd.md\",\"projectRoot\":\".\"}'"
exit 0
fi
TASK_ID=$(echo "$TASK_JSON" | jq -r '.id')
TASK_TITLE=$(echo "$TASK_JSON" | jq -r '.title')
TASK_DESC=$(echo "$TASK_JSON" | jq -r '.description')
TASK_DETAILS=$(echo "$TASK_JSON" | jq -r '.details // ""')
TASK_TEST=$(echo "$TASK_JSON" | jq -r '.testStrategy // ""')
TASK_PRIORITY=$(echo "$TASK_JSON" | jq -r '.priority // "medium"')
echo ""
echo "Found task #$TASK_ID: $TASK_TITLE"
echo "Priority: $TASK_PRIORITY"
echo "-------------------------------------------"
echo "$TASK_DESC"
echo "-------------------------------------------"
echo ""
# 2. Confirm execution (unless in auto mode)
if [ "$AUTO_MODE" = false ]; then
read -p "Execute this task with Zeroshot? (y/n) " CONFIRM
if [ "$CONFIRM" != "y" ]; then
echo "Aborted."
exit 0
fi
fi
# 3. Build Zeroshot prompt
PROMPT="## Task: $TASK_TITLE
$TASK_DESC
### Implementation Details
$TASK_DETAILS
### Test Strategy
$TASK_TEST
### Instructions
1. Implement this task following the details above
2. Write/update tests as specified in the test strategy
3. Ensure all tests pass before completing
4. Create atomic, well-messaged commits
5. Follow project conventions and code style"
# 4. Update Taskmaster status to in-progress
echo "Marking task #$TASK_ID as in-progress..."
mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"in-progress\", \"projectRoot\": \"$PROJECT_ROOT\"}" > /dev/null 2>&1
# 5. Execute with Zeroshot
echo ""
echo "Starting Zeroshot execution..."
echo "=========================================="
if [ "$SHIP_MODE" = true ]; then
# Full automation - ship mode
zeroshot "$PROMPT" --ship
ZEROSHOT_EXIT=$?
else
# Standard execution with worktree + PR
zeroshot "$PROMPT" --worktree --pr
ZEROSHOT_EXIT=$?
fi
echo "=========================================="
echo ""
# 6. Check result and update Taskmaster
if [ "$AUTO_MODE" = true ]; then
if [ $ZEROSHOT_EXIT -eq 0 ]; then
echo "Zeroshot completed successfully!"
mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"done\", \"projectRoot\": \"$PROJECT_ROOT\"}" > /dev/null 2>&1
echo "Task #$TASK_ID marked as done."
else
echo "Zeroshot failed with exit code $ZEROSHOT_EXIT"
mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"blocked\", \"projectRoot\": \"$PROJECT_ROOT\"}" > /dev/null 2>&1
echo "Task #$TASK_ID marked as blocked."
fi
else
read -p "Did the task complete successfully? (y/n) " RESULT
if [ "$RESULT" = "y" ]; then
mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"done\", \"projectRoot\": \"$PROJECT_ROOT\"}" > /dev/null 2>&1
echo "Task #$TASK_ID marked as done!"
else
mcp-cli call taskmaster-ai/set_task_status "{\"id\": \"$TASK_ID\", \"status\": \"blocked\", \"projectRoot\": \"$PROJECT_ROOT\"}" > /dev/null 2>&1
echo "Task #$TASK_ID marked as blocked. Review and retry with:"
echo " zeroshot resume <cluster-id>"
fi
fi
echo ""
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment