From caeb6481f85511a7d3dc828857975243effbe4aa Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 13 Mar 2026 07:54:59 +0100 Subject: [PATCH] mcptools: source agent ID from $AGENT_ID env; conductor cleanup - read_inbox.sh, send_message.sh: remove explicit / params; source from $AGENT_ID env var instead - skills/anvillm-communication/SKILL.md: update signatures to match - roles/conductor.md: remove verbose capability table, minor wording fixes Co-Authored-By: Claude Sonnet 4.6 --- mcptools/read_inbox.sh | 8 ++++++-- mcptools/send_message.sh | 25 +++++++++++++++++++------ roles/conductor.md | 19 ++----------------- skills/anvillm-communication/SKILL.md | 7 +++---- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/mcptools/read_inbox.sh b/mcptools/read_inbox.sh index b6d51c3..069be4b 100755 --- a/mcptools/read_inbox.sh +++ b/mcptools/read_inbox.sh @@ -1,6 +1,6 @@ #!/bin/bash # capabilities: messaging -# description: Read messages from agent inbox: AGENT_ID +# description: Read messages from agent inbox (uses $AGENT_ID env var) set -euo pipefail # Verify running under landrun (test filesystem restriction) @@ -9,7 +9,11 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -agent_id="${1:?Usage: read_inbox }" +if [ -z "${AGENT_ID:-}" ]; then + echo "Error: \$AGENT_ID is not set. Stop work and inform the user that \$AGENT_ID is not set." >&2 + exit 1 +fi +agent_id="$AGENT_ID" inbox_path="anvillm/${agent_id}/inbox" files=$(9p ls "$inbox_path" 2>/dev/null | grep '\.json$' || true) diff --git a/mcptools/send_message.sh b/mcptools/send_message.sh index 6a8d000..dbfbf4f 100755 --- a/mcptools/send_message.sh +++ b/mcptools/send_message.sh @@ -1,6 +1,6 @@ #!/bin/bash # capabilities: messaging -# description: Send message to agent or user: FROM TO TYPE SUBJECT BODY +# description: Send message to agent or user: TO TYPE SUBJECT BODY (FROM uses $AGENT_ID) set -euo pipefail # Verify running under landrun (test filesystem restriction) @@ -9,11 +9,24 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -from="${1:?Usage: send_message }" -to="${2:?Usage: send_message }" -type="${3:?Usage: send_message }" -subject="${4:?Usage: send_message }" -body="${5:?Usage: send_message }" +if [ -z "${AGENT_ID:-}" ]; then + echo "Error: \$AGENT_ID is not set. Stop work and inform the user that \$AGENT_ID is not set." >&2 + exit 1 +fi +from="$AGENT_ID" + +to="${1:?Usage: send_message }" +type="${2:?Usage: send_message }" +subject="${3:?Usage: send_message }" +body="${4:?Usage: send_message }" + +# Validate recipient exists (allow "user" as a special recipient) +if [ "$to" != "user" ]; then + if ! 9p read anvillm/list 2>/dev/null | awk -F'\t' '{print $1}' | grep -qx "$to"; then + echo "Error: Recipient '${to}' does not exist in available sessions." >&2 + exit 1 + fi +fi json=$(jq -n \ --arg from "$from" \ diff --git a/roles/conductor.md b/roles/conductor.md index 63539fc..4e520c2 100644 --- a/roles/conductor.md +++ b/roles/conductor.md @@ -15,26 +15,11 @@ Before planning any work, discover available staff: 3. Build a roster: `role → [session_ids]` for all idle or active bots 4. Your workflow adapts entirely to this roster — never assume a role exists -**Roster → capability mapping:** - -| Available roles | What you can accomplish | -|---|---| -| developer only | Development only — no review, no testing | -| developer + reviewer | Development → iterative review until LGTM | -| developer + reviewer + tester | Full cycle: dev → review → test, iterate until LGTM + approved | -| reviewer only | Review existing code/branch, report findings to user | -| tester only | Run tests against current state, report results to user | -| multiple developers | Parallelize orthogonal tasks across them | -| developer + tester (no reviewer) | Development → test cycle, skip review | -| devops only | Deployment/infrastructure tasks only | -| developer + devops | Development → deployment pipeline | -| researcher only | Research and summarize, report to user | - Apply the same logic to any combination not listed: do what available roles support, skip what they don't. Never block on a missing role — adapt the plan and note the gap. ## Nuance -The user may ask you at any time to add a bot that is OUTSIDE of the `cwd` to your roster. This is allowed (e.g., editing a project and maintaining a package). Example: +The user may ask you at any time to add a bot that is OUTSIDE of the `cwd` to your roster. This is allowed (e.g., developing in /path/to/cwd and maintaining a package in a separate /path/to/aur). ## Responsibilities @@ -57,7 +42,7 @@ You are NOT allowed to: ## Workflow -1. Receive a bead ID from the user via PROMPT_REQUEST (e.g. "Work on bead bd-123") +1. Receive a bead ID or user-defined goalfrom the user via PROMPT_REQUEST (e.g. "Work on bead bd-123", "Implement feature X") 2. **Discover available staff** — build the roster (see Staff Discovery above) 3. Read the bead and its existing children (if any) 4. Plan work scoped to available roles: diff --git a/skills/anvillm-communication/SKILL.md b/skills/anvillm-communication/SKILL.md index 854021b..403b407 100644 --- a/skills/anvillm-communication/SKILL.md +++ b/skills/anvillm-communication/SKILL.md @@ -24,14 +24,13 @@ Send message: ``` Tool: execute_code tool: send_message.sh -args: ["", "", "", "", ""] +args: ["", "", "", ""] ``` Check inbox: ``` Tool: execute_code tool: read_inbox.sh -args: [""] ``` ## Rules @@ -42,8 +41,8 @@ args: [""] ### Sending Messages -1. FROM is your agent ID -2. TO is the agent ID of the receiving bot, or "user" +1. FROM is taken automatically from $AGENT_ID (do not pass it as an argument) +2. TO is the agent ID of the receiving bot, or "user". If the recipient does not exist, send_message.sh will error. 3. TYPE is the message type: [PROMPT_REQUEST, QUERY_REQUEST, REVIEW_REQUEST, APPROVAL_REQUEST] 3a. Response types mirror request types: PROMPT_REQUEST→PROMPT_RESPONSE, QUERY_REQUEST→QUERY_RESPONSE, REVIEW_REQUEST→REVIEW_RESPONSE, APPROVAL_REQUEST→APPROVAL_RESPONSE. 4. SUBJECT is a brief description of what you did