diff --git a/.agents/scripts/launch.sh b/.agents/scripts/launch.sh index 61612da..caab4a4 100755 --- a/.agents/scripts/launch.sh +++ b/.agents/scripts/launch.sh @@ -47,8 +47,10 @@ log="$(pwd)/.agents/logs/task-${number}-${slug}.log" mkdir -p .agents/logs # The brief names its own agent; pull it out so the prompt can point at the file. -agent=$(sed -n 's/.*\*\*Agent\*\*: `\([a-z-]*\)`.*/\1/p' "$plan" | head -1) -: "${agent:=astro-architect}" +# [a-z0-9-] not [a-z-]: content-i18n-migrator has digits in it. +agent=$(sed -n 's/.*\*\*Agent\*\*: `\([a-z0-9-]*\)`.*/\1/p' "$plan" | head -1) +[ -n "$agent" ] || { echo "could not read the agent name out of $plan" >&2; exit 1; } +[ -f ".agents/agents/${agent}.md" ] || { echo "no such agent: .agents/agents/${agent}.md" >&2; exit 1; } if [ -d "$dir" ]; then echo "worktree $dir already exists — reusing it"