wait_for_bead: remove role filter — bot decides whether to claim

Role filtering was silently dropping events when $AGENT_ROLE didn't
match the default "developer". The bot already handles out-of-scope
work refusal — no need to filter here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-14 21:36:54 +01:00
parent 6ea87e1810
commit 07a7abb248
1 changed files with 4 additions and 17 deletions

View File

@ -1,22 +1,20 @@
#!/bin/bash
# capabilities: beads
# description: Block until a bead matching --mount and --role is ready, then print its full JSON (including comments) and exit. Uses the anvillm/events stream — no polling.
# Usage: wait_for_bead.sh --mount <mount> [--role <role>]
# description: Block until a bead is ready on the given mount, then print its full JSON (including comments) and exit. Uses the anvillm/events stream — no polling.
# Usage: wait_for_bead.sh --mount <mount>
set -euo pipefail
MOUNT=""
ROLE="${AGENT_ROLE:-developer}"
while [[ $# -gt 0 ]]; do
case "$1" in
--mount) MOUNT="$2"; shift 2 ;;
--role) ROLE="$2"; shift 2 ;;
*) echo "unknown argument: $1" >&2; exit 1 ;;
esac
done
if [ -z "$MOUNT" ]; then
echo "usage: wait_for_bead.sh --mount <mount> [--role <role>]" >&2
echo "usage: wait_for_bead.sh --mount <mount>" >&2
exit 1
fi
@ -29,18 +27,7 @@ while IFS= read -r line; do
source=$(echo "$line" | jq -r '.source // empty' 2>/dev/null)
[ "$source" = "$EXPECTED_SOURCE" ] || continue
# Check role label matches (format: "role:<role>")
bead_role=$(echo "$line" | jq -r '
.data.labels // [] |
map(select(startswith("role:"))) |
first // "" |
ltrimstr("role:")
' 2>/dev/null)
# Default to "developer" if no role label
[ -z "$bead_role" ] && bead_role="developer"
[ "$bead_role" = "$ROLE" ] || continue
# Emit full bead data and exit
# Emit full bead data and exit — bot decides whether to claim
echo "$line" | jq '.data'
exit 0
done < <(9p read anvillm/events)