claim_bead: use $AGENT_ID instead of --assignee flag

The bot claiming a bead is always the bot working on it. Remove the
--assignee flag; AGENT_ID is required in the environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-14 16:02:42 +01:00
parent 9c5f98218c
commit 8ccd524f7d
2 changed files with 13 additions and 13 deletions

View File

@ -1,31 +1,30 @@
#!/bin/bash
# capabilities: beads
# description: Claim a bead for work
# Usage: claim_bead.sh --mount <mount> --id <bead-id> [--assignee <id>]
# description: Claim a bead for work. Assignee is taken from $AGENT_ID.
# Usage: claim_bead.sh --mount <mount> --id <bead-id>
set -euo pipefail
MOUNT=""
BEAD_ID=""
ASSIGNEE=""
while [[ $# -gt 0 ]]; do
case "$1" in
--mount) MOUNT="$2"; shift 2 ;;
--id) BEAD_ID="$2"; shift 2 ;;
--assignee) ASSIGNEE="$2"; shift 2 ;;
--mount) MOUNT="$2"; shift 2 ;;
--id) BEAD_ID="$2"; shift 2 ;;
*) echo "unknown argument: $1" >&2; exit 1 ;;
esac
done
if [ -z "$MOUNT" ] || [ -z "$BEAD_ID" ]; then
echo "usage: claim_bead.sh --mount <mount> --id <bead-id> [--assignee <id>]" >&2
echo "usage: claim_bead.sh --mount <mount> --id <bead-id>" >&2
exit 1
fi
if [ -n "$ASSIGNEE" ]; then
echo "claim $BEAD_ID $ASSIGNEE" | 9p write anvillm/beads/$MOUNT/ctl
else
echo "claim $BEAD_ID" | 9p write anvillm/beads/$MOUNT/ctl
if [ -z "${AGENT_ID:-}" ]; then
echo "error: AGENT_ID is not set" >&2
exit 1
fi
echo "claimed $BEAD_ID${ASSIGNEE:+ → $ASSIGNEE}"
echo "claim $BEAD_ID $AGENT_ID" | 9p write anvillm/beads/$MOUNT/ctl
echo "claimed $BEAD_ID → $AGENT_ID"

View File

@ -81,8 +81,9 @@ Claim bead:
```
Tool: execute_code
tool: claim_bead.sh
args: ["--mount", "<mount>", "--id", "<id>", "--assignee", "$AGENT_ID"]
args: ["--mount", "<mount>", "--id", "<id>"]
```
Assignee is taken automatically from `$AGENT_ID` in the environment.
Complete bead:
```