#!/usr/bin/env bash set -e # Omni/Agent/start-worker.sh # Launches an Amp worker agent in the specified worktree. # Usage: ./Omni/Agent/start-worker.sh [worker-directory-name] # Example: ./Omni/Agent/start-worker.sh omni-worker-1 WORKER_NAME="${1:-omni-worker-1}" REPO_ROOT="$(git rev-parse --show-toplevel)" WORKER_PATH="$REPO_ROOT/../$WORKER_NAME" AMP_BIN="$REPO_ROOT/node_modules/.bin/amp" if [ ! -d "$WORKER_PATH" ]; then echo "Error: Worker directory '$WORKER_PATH' does not exist." echo "Please run './Omni/Agent/setup-worker.sh $WORKER_NAME' first." exit 1 fi if [ ! -x "$AMP_BIN" ]; then echo "Error: Amp binary not found at '$AMP_BIN'." echo "Please ensure npm dependencies are installed in the main repository." exit 1 fi echo "Starting Worker Agent in '$WORKER_PATH'..." echo "Using Amp binary: $AMP_BIN" cd "$WORKER_PATH" # Launch Amp with the worker persona and instructions "$AMP_BIN" -- "You are a Worker Agent. Your goal is to process tasks from the task manager. Please read Omni/Agent/WORKER_AGENT_GUIDE.md and follow the 'Worker Loop' instructions exactly. Start by syncing tasks and checking for ready work."