#!/bin/sh # dispatch_check.sh — the session agent's pre-spawn discipline. # # Run this before spawning ANY wave. It reads the brief file, asks the # dispatch-classifier for the verdict, and prints it. Follow it: # SOLO spawn one agent, full attention # PARALLEL spawn one lane per suggested split surface # QUEUE-BEHIND do NOT spawn onto those surfaces yet # PRIORITY-QUEUE owner wave: the lock-holder yields at its next # landing boundary; wait for it, then go # # Usage: # scripts/dispatch_check.sh [--paths p1,p2] [--owner-origin] # scripts/dispatch_check.sh --apply [--agent X] # # --apply takes the lock for you (fails loud if anything is locked or # stale — prune with `dispatch-classifier show --prune`). Every exit 0 # prints the verdict JSON on stdout; exit 1 means do not spawn. set -e repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) brief=$1 if [ -z "$brief" ]; then echo "usage: $0 [--paths p1,p2] [--owner-origin] [--apply]" >&2 exit 2 fi shift cd "$repo_root/src/go/dispatch-classifier" exec go run . classify --brief "$brief" "$@"