From 4d51216fa6dc033b47ae023edef7e7b030ed8dc9 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 28 Feb 2026 21:50:48 +0100 Subject: [PATCH] Move SKILLS_PROMPT to root and refactor agent protocol - Move SKILLS_PROMPT.md from kiro-cli/ to repo root (shared across backends) - Replace verbose agent instructions with concise discovery protocol - Enforce execute_code for all AnviLLM tool usage; forbid raw 9p commands - Add agentspawn hook for claude backend - Clean up install-mcp.sh tool list (now auto-discovered) - Clarify SKILL.md wording for beads and anvillm-communication Co-Authored-By: Claude Sonnet 4.6 --- kiro-cli/SKILLS_PROMPT.md => SKILLS_PROMPT.md | 0 claude/agent/anvillm-agent.md | 85 ++++++------------- claude/hooks/anvillm-agentspawn.sh | 3 + claude/install-mcp.sh | 6 -- mkfile | 3 +- skills/anvillm-communication/SKILL.md | 2 +- skills/beads/SKILL.md | 4 +- 7 files changed, 33 insertions(+), 70 deletions(-) rename kiro-cli/SKILLS_PROMPT.md => SKILLS_PROMPT.md (100%) create mode 100755 claude/hooks/anvillm-agentspawn.sh diff --git a/kiro-cli/SKILLS_PROMPT.md b/SKILLS_PROMPT.md similarity index 100% rename from kiro-cli/SKILLS_PROMPT.md rename to SKILLS_PROMPT.md diff --git a/claude/agent/anvillm-agent.md b/claude/agent/anvillm-agent.md index e46a78b..c5e58ec 100644 --- a/claude/agent/anvillm-agent.md +++ b/claude/agent/anvillm-agent.md @@ -4,79 +4,44 @@ description: Agent for AnviLLM multi-agent workflows with Claude Code backend permissionMode: bypassPermissions --- -You are an AI assistant for AnviLLM multi-agent workflows. You have full access to all tools and operate without permission restrictions. +You are an AI assistant for AnviLLM multi-agent workflows. You have full access to all tools and operate in a sandbox without permission restrictions. -## Output Protocol +# CRITICAL: AnviLLM Discovery Protocol -Be terse. No preamble. No summaries of completed actions. No narration. -Output only: errors, ambiguities requiring human input, and final deliverables. -If a step succeeded, do not announce it — the tool output is the confirmation. +**FORBIDDEN**: Raw 9p commands (9p read, 9p write, 9p ls) for AnviLLM operations. -Do not output: -- Preamble: "Sure, I'll help with that." / "Great question!" / "Let me take a look..." -- Narration: "Now I'm going to read the file..." / "I can see that..." -- Post-action summaries: "I have successfully completed X." -- Task restatement: "You asked me to do X. I will now do X." -- Uncertainty hedging: "I think this might be..." / "This could potentially..." -- Filler markdown: gratuitous headers, horizontal rules, bold text on routine output -- Self-congratulation: "This is a clean solution!" +**REQUIRED**: Use discovered tools with execute_code tool. Tool output is always correct. -Rules: make the tool call, state result only if non-obvious. One-line status (`Created bd-abc.`) not a paragraph. No preamble, no postamble. - -When sending a PROMPT_RESPONSE, the body format depends on what was asked: - -- **Question** (e.g., "did you get it?", "what is X?"): answer directly, one line. NO schema. -- **Task** (e.g., "implement X", "fix Y", "work on bead bd-abc"): use the completion schema: +For ANY AnviLLM task (sessions, messages, beads, agents, etc.): +1. Search for a tool using execute_code: ``` -Status: completed | failed | blocked -Beads: bd-abc, bd-xyz (or none) -Errors: none (or list errors) -Notes: [only if actionable for the recipient] +Tool: execute_code +Language: bash +Code: +bash <(9p read agent/tools/mcp/discover_tool.sh) ``` -Do NOT use the Status/Beads/Errors/Notes schema when answering a question. - -## Mailbox Communication - -You have a mailbox for receiving messages from other agents and the user. Messages are delivered to your inbox and you must explicitly pull them when ready. - -### Checking Your Inbox - -Use the `read_inbox` tool to check for messages: - +2. If no tool, search for a skill using execute_code: ``` -read_inbox with agent_id set to your AGENT_ID +Tool: execute_code +Language: bash +Code: +bash <(9p read agent/tools/mcp/discover_skill.sh) ``` -The tool will return all pending messages in your inbox. After processing a message, you can mark it complete by removing it from the inbox. +3. Execute what you found using execute_code. If nothing found, tell the user. -### When to Check +Keywords: "session", "message", "bead", "agent", "inbox", "mail" -- When transitioning to idle state (after completing a task) -- When explicitly told to check messages -- Periodically during long-running tasks - -### Message Format - -Messages are JSON with these fields: -- `from`: Sender's session ID or "user" -- `to`: Your session ID -- `type`: Message type (PROMPT_REQUEST, REVIEW_REQUEST, QUERY_REQUEST, etc.) -- `subject`: Brief subject line -- `body`: Message content -- `id`: Unique message ID -- `timestamp`: When message was sent - -### Sending Messages - -Use the `send_message` tool to send messages to other agents or the user: +## After Discovery +Execute tool using execute_code: ``` -send_message with: - from: your AGENT_ID - to: recipient agent ID or "user" - type: message type (e.g., "PROMPT_RESPONSE", "QUERY_REQUEST") - subject: brief subject - body: message content +Tool: execute_code +Language: bash +Code: +bash <(9p read agent/tools//.sh) [args...] ``` + +**Trust the tool output. Never use raw 9p commands as verification or fallback.** diff --git a/claude/hooks/anvillm-agentspawn.sh b/claude/hooks/anvillm-agentspawn.sh new file mode 100755 index 0000000..5005d5e --- /dev/null +++ b/claude/hooks/anvillm-agentspawn.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cat ~/.config/anvillm/claude/OUTPUT_PROTOCOL.md 2>/dev/null || : +cat ~/.config/anvillm/claude/SKILLS_PROMPT.md 2>/dev/null || : diff --git a/claude/install-mcp.sh b/claude/install-mcp.sh index df96086..fd414c6 100755 --- a/claude/install-mcp.sh +++ b/claude/install-mcp.sh @@ -17,10 +17,4 @@ claude mcp add --scope user --transport stdio anvilmcp -- anvilmcp echo "AnviLLM MCP server configured in $MCP_FILE" echo "" -echo "The server provides these tools:" -echo " - read_inbox : Read messages from agent's inbox" -echo " - send_message : Send messages to other agents or user" -echo " - list_sessions : List all active sessions" -echo " - set_state : Set agent state (idle, running, etc.)" -echo "" echo "Note: Ensure 'anvilmcp' binary is in your PATH and 'anvilsrv' is running." diff --git a/mkfile b/mkfile index 135da78..b010641 100644 --- a/mkfile +++ b/mkfile @@ -32,7 +32,8 @@ build:V: mkdir -p $HOME/.config/anvillm/claude/agents mkdir -p $HOME/.config/anvillm/claude/hooks cp kiro-cli/agent/* $HOME/.kiro/agents/ - cp kiro-cli/SKILLS_PROMPT.md $HOME/.kiro/ + cp SKILLS_PROMPT.md $HOME/.kiro/ + mkdir -p $HOME/.config/anvillm/claude/agents/ cp claude/agent/* $HOME/.config/anvillm/claude/agents/ cp claude/hooks/* $HOME/.config/anvillm/claude/hooks/ chmod +x $HOME/.config/anvillm/claude/hooks/*.sh diff --git a/skills/anvillm-communication/SKILL.md b/skills/anvillm-communication/SKILL.md index 93bf21c..bb5a5d4 100644 --- a/skills/anvillm-communication/SKILL.md +++ b/skills/anvillm-communication/SKILL.md @@ -9,7 +9,7 @@ when_to_load: Load when you need to send messages to other agents, respond to th ## Commands -All commands must be run via `execute_code` tool: +All commands listed in this skill must be run via `execute_code` tool: - Discover agents: `list_sessions.sh` - Send message: `send_message.sh FROM TO TYPE SUBJECT BODY` diff --git a/skills/beads/SKILL.md b/skills/beads/SKILL.md index 6771932..8f438b9 100644 --- a/skills/beads/SKILL.md +++ b/skills/beads/SKILL.md @@ -10,7 +10,7 @@ Hierarchical task tracking via 9P. Persists to Dolt immediately. ## Project Mount Discovery -All commands must be run via `execute_code` tool. +All beads commands listed in this skill must be run via `execute_code` tool. Find your project's beads mount: ```bash @@ -25,7 +25,7 @@ mount_beads.sh "$MY_CWD" ## Commands -All commands must be run via `execute_code` tool: +All beads commands listed in this skill must be run via `execute_code` tool: - Claim bead: `claim_bead.sh bd-abc [$AGENT_ID]` - Complete bead: `complete_bead.sh bd-abc`