summaryrefslogtreecommitdiff
path: root/Omni/Agent/start-worker.sh
blob: 2c5eee448814b38d5c40ae34d1a6ea562ea56ea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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."