diff --git a/SKILLS_PROMPT.md b/SKILLS_PROMPT.md index 556080c..e69de29 100644 --- a/SKILLS_PROMPT.md +++ b/SKILLS_PROMPT.md @@ -1,25 +0,0 @@ -# CRITICAL: AnviLLM Discovery Protocol - -## Proactive Role Discovery - -**REQUIRED FIRST STEP**: **If assigned a role or identity**, using patterns such as "you're a(n)...", "you are a(n)...", "act as...", "be a(n)...", discover and load the appropriate role and adopt it if found. Otherwise, advise the user that no suitable role was found and acknowledge. Use the `execute_code` (language: bash) tool to: - -1. Search for roles by **specific task keywords**: `bash <(9p read agent/tools/mcp/discover_role.sh) ` -2. Load role content: `9p read agent/roles//.md` -3. Adopt the role's persona and expertise for your response - -## Proactive Skill Discovery - -**REQUIRED NEXT STEP**: Identify user intents, and load relevant skills: - -1. Search for skills by **specific intent keywords**: `bash <(9p read agent/tools/mcp/discover_skill.sh) ` -2. Load relevant skill files: `9p read agent/skills///SKILL.md` - -## Tool Discovery - -**Skills provide instructions on certain tools, but they are not exhaustive.** For each user input, identify other useful tools by: - -1. Mapping user intent to capabilities -2. Search for tools by **specific capability keywords**: `bash <(9p read agent/tools/mcp/discover_tool.sh) ` - -Keep these tools and their usage in your memory for later use, when appropriate. diff --git a/claude/agent/anvillm-agent.md b/claude/agent/anvillm-agent.md index 60f2eb0..e2965a6 100644 --- a/claude/agent/anvillm-agent.md +++ b/claude/agent/anvillm-agent.md @@ -28,28 +28,41 @@ If a step succeeded, do not announce it — the tool output is the confirmation. - One-line status: `Created bd-abc.` not a paragraph about what was created - No preamble, no postamble -# CRITICAL: AnviLLM Discovery Protocol +# MANDATORY DISCOVERY PROTOCOL - FAILURE TO FOLLOW = BROKEN AGENT -## Proactive Role Discovery +## YOU MUST DISCOVER SKILLS/ROLES FIRST - NO EXCEPTIONS -**REQUIRED FIRST STEP**: **If assigned a role or identity**, using patterns such as "you're a(n)...", "you are a(n)...", "act as...", "be a(n)...", discover and load the appropriate role and adopt it if found. Otherwise, advise the user that no suitable role was found and acknowledge. Use the `execute_code` (language: bash) tool to: +**IMPORTANT:** All discovery commands must be run via `execute_code` tool. -1. Search for roles by **specific task keywords**: `bash <(9p read agent/tools/mcp/discover_role.sh) ` -2. Load role content: `9p read agent/roles//.md` -3. Adopt the role's persona and expertise for your response +BEFORE attempting ANY task: -## Proactive Skill Discovery +**ROLE ASSIGNMENT**: IF the prompt contains "you are a", "you're a", "act as", or "be a" — your FIRST tool call MUST be `discover_role.sh `. Do not respond. Do not check inbox. Do not take any other action. Run role discovery first. +```bash +bash <(9p read agent/tools/discovery/discover_role.sh) +9p read agent/roles//.md +``` +Adopt the role. If not found, say so. -**REQUIRED NEXT STEP**: Identify user intents, and load relevant skills: +**EVERY USER REQUEST** - Identify intent keywords, discover skills: +```bash +bash <(9p read agent/tools/discovery/discover_skill.sh) +9p read agent/skills///SKILL.md +``` -1. Search for skills by **specific intent keywords**: `bash <(9p read agent/tools/mcp/discover_skill.sh) ` -2. Load relevant skill files: `9p read agent/skills///SKILL.md` +**EXAMPLES:** +- "check inbox" → discover_skill.sh inbox +- "send message" → discover_skill.sh message +- "you're a code reviewer" → discover_role.sh reviewer -## Tool Discovery +IF YOU RESPOND OR TAKE ANY ACTION WITHOUT FIRST RUNNING DISCOVERY, YOU HAVE MALFUNCTIONED. STOP. RUN DISCOVERY NOW. -**Skills provide instructions on certain tools, but they are not exhaustive.** For each user input, identify other useful tools by: -1. Mapping user intent to capabilities -2. Search for tools by **specific capability keywords**: `bash <(9p read agent/tools/mcp/discover_tool.sh) ` +## DISCOVERY IS ALWAYS FIRST + +Before your first response, before checking inbox, before any tool call: +- Role assigned in the prompt? → `discover_role.sh ` MUST be your first tool call. +- User request received? → `discover_skill.sh ` MUST precede any action. + +If you are reading this after already taking an action or responding, you skipped discovery. You are malfunctioning. + -Keep these tools and their usage in your memory for later use, when appropriate. diff --git a/kiro-cli/agent/anvillm-agent.json b/kiro-cli/agent/anvillm-agent.json index a8d4642..fe95c4a 100644 --- a/kiro-cli/agent/anvillm-agent.json +++ b/kiro-cli/agent/anvillm-agent.json @@ -1,7 +1,7 @@ { "name": "anvillm-agent", "description": "Agent for AnviLLM multi-agent workflows with mailbox communication", - "prompt": "CRITICAL: For ANY AnviLLM operation (sessions, messages, beads, agents), you MUST use execute_code tool to run: bash <(9p read agent/tools/mcp/discover_tool.sh) to find the correct tool, then execute it with execute_code. NEVER use raw 9p commands (9p read, 9p write, 9p ls) directly. Trust tool output - do not verify with raw 9p.", + "prompt": "# MANDATORY DISCOVERY PROTOCOL - FAILURE TO FOLLOW = BROKEN AGENT\n\n## YOU MUST DISCOVER SKILLS/ROLES FIRST - NO EXCEPTIONS\n\n**IMPORTANT:** All discovery commands must be run via `execute_code` tool.\n\nBEFORE attempting ANY task:\n\n**ROLE ASSIGNMENT**: IF the prompt contains \"you are a\", \"you're a\", \"act as\", or \"be a\" — your FIRST tool call MUST be `discover_role.sh `. Do not respond. Do not check inbox. Do not take any other action. Run role discovery first.\n```bash\nbash <(9p read agent/tools/discovery/discover_role.sh) \n9p read agent/roles//.md\n```\nAdopt the role. If not found, say so.\n\n**EVERY USER REQUEST** - Identify intent keywords, discover skills:\n```bash\nbash <(9p read agent/tools/discovery/discover_skill.sh) \n9p read agent/skills///SKILL.md\n```\n\n**EXAMPLES:**\n- \"check inbox\" → discover_skill.sh inbox\n- \"send message\" → discover_skill.sh message\n- \"you're a code reviewer\" → discover_role.sh reviewer\n\nIF YOU RESPOND OR TAKE ANY ACTION WITHOUT FIRST RUNNING DISCOVERY, YOU HAVE MALFUNCTIONED. STOP. RUN DISCOVERY NOW.\n\n\n## DISCOVERY IS ALWAYS FIRST\n\nBefore your first response, before checking inbox, before any tool call:\n- Role assigned in the prompt? → `discover_role.sh ` MUST be your first tool call.\n- User request received? → `discover_skill.sh ` MUST precede any action.\n\nIf you are reading this after already taking an action or responding, you skipped discovery. You are malfunctioning.", "tools": ["*"], "allowedTools": ["*"], "includeMcpJson": true, diff --git a/mcptools/batch_create_beads.sh b/mcptools/batch_create_beads.sh index 990a8b3..f4a1485 100755 --- a/mcptools/batch_create_beads.sh +++ b/mcptools/batch_create_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Batch create beads from JSON array # Usage: batch_create_beads.sh set -euo pipefail diff --git a/mcptools/capture_browser.sh b/mcptools/capture_browser.sh index ed94f14..a994101 100755 --- a/mcptools/capture_browser.sh +++ b/mcptools/capture_browser.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# capabilities: web, browser, screenshot +# capabilities: web # description: Capture browser window showing a specific URL: capture_browser.sh [output_path] [url_pattern] set -e diff --git a/mcptools/claim_bead.sh b/mcptools/claim_bead.sh index 46f2669..a49cf8b 100755 --- a/mcptools/claim_bead.sh +++ b/mcptools/claim_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Claim a bead for work # Usage: claim_bead.sh [assignee] set -euo pipefail diff --git a/mcptools/comment_bead.sh b/mcptools/comment_bead.sh index 914f693..076357d 100755 --- a/mcptools/comment_bead.sh +++ b/mcptools/comment_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Add a comment to a bead # Usage: comment_bead.sh set -euo pipefail diff --git a/mcptools/complete_bead.sh b/mcptools/complete_bead.sh index 447bd94..4fdb60a 100755 --- a/mcptools/complete_bead.sh +++ b/mcptools/complete_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Complete a bead # Usage: complete_bead.sh set -euo pipefail diff --git a/mcptools/create_bead.sh b/mcptools/create_bead.sh index fd3ff64..cbe714f 100755 --- a/mcptools/create_bead.sh +++ b/mcptools/create_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Create a new bead # Usage: create_bead.sh [description] [parent-id] [--no-lint] [capability=low|standard|high] set -euo pipefail diff --git a/mcptools/delete_bead.sh b/mcptools/delete_bead.sh index 34ff968..6267971 100755 --- a/mcptools/delete_bead.sh +++ b/mcptools/delete_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Delete a bead # Usage: delete_bead.sh <mount> <bead-id> set -euo pipefail diff --git a/mcptools/discover_role.sh b/mcptools/discover_role.sh index 773b5ed..705ea99 100755 --- a/mcptools/discover_role.sh +++ b/mcptools/discover_role.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: mcp +# capabilities: discovery # description: Discover available roles by focus area and keyword set -euo pipefail diff --git a/mcptools/discover_skill.sh b/mcptools/discover_skill.sh index 43e129d..afb2502 100755 --- a/mcptools/discover_skill.sh +++ b/mcptools/discover_skill.sh @@ -1,9 +1,9 @@ #!/bin/bash -# capabilities: mcp -# description: Discover available skills by intent and keyword +# capabilities: discovery +# description: Discover available skills by keyword set -euo pipefail -if [ $# -lt 1 ]; then +if [ $# -ne 1 ]; then echo "Usage: discover_skill <keyword>" >&2 exit 1 fi diff --git a/mcptools/discover_tool.sh b/mcptools/discover_tool.sh deleted file mode 100755 index 328f45d..0000000 --- a/mcptools/discover_tool.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# capabilities: mcp -# description: Discover available MCP tools by capability and keyword -set -euo pipefail - -if [ $# -lt 1 ]; then - echo "Usage: discover_tool <keyword>" >&2 - exit 1 -fi - -keyword="$1" -results="" - -# Search help index (path and description), resolve full path -if help_matches=$(9p read agent/tools/help | grep -i "$keyword"); then - while IFS=$'\t' read -r tool desc; do - for cap in $(9p ls agent/tools | grep -v '^help$'); do - if 9p ls "agent/tools/$cap" | grep -qx "$tool"; then - results="${results:+$results -}tools/$cap/$tool $desc" - break - fi - done - done <<< "$help_matches" -fi - -# Search tool content for keyword -while IFS= read -r cap; do - [ "$cap" = "help" ] && continue - while IFS= read -r tool; do - path="tools/$cap/$tool" - echo "$results" | grep -q "^$path" && continue - if 9p read "agent/$path" | grep -qi "$keyword"; then - desc=$(9p read agent/tools/help | grep "^${tool} " | cut -f2) - [ -n "$desc" ] && results="${results:+$results -}$path $desc" - fi - done < <(9p ls "agent/tools/$cap") -done < <(9p ls agent/tools) - -if [ -n "$results" ]; then - echo "$results" | sort -u -else - echo "No tools found matching: $keyword" -fi diff --git a/mcptools/fail_bead.sh b/mcptools/fail_bead.sh index 894717a..cfa6150 100755 --- a/mcptools/fail_bead.sh +++ b/mcptools/fail_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Fail a bead with reason # Usage: fail_bead.sh <mount> <bead-id> <reason> set -euo pipefail diff --git a/mcptools/github_to_beads.sh b/mcptools/github_to_beads.sh index d462ef8..cbce37d 100755 --- a/mcptools/github_to_beads.sh +++ b/mcptools/github_to_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks, github +# capabilities: beads # description: Import GitHub issue into beads # Usage: github_to_beads.sh <mount> <owner/repo> <issue-number> set -euo pipefail diff --git a/mcptools/init_beads.sh b/mcptools/init_beads.sh index 5528844..9303d4d 100755 --- a/mcptools/init_beads.sh +++ b/mcptools/init_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Initialize beads project with issue prefix # Usage: init_beads.sh <mount> [prefix] set -euo pipefail diff --git a/mcptools/jira_to_beads.sh b/mcptools/jira_to_beads.sh index fdee249..65ca82c 100755 --- a/mcptools/jira_to_beads.sh +++ b/mcptools/jira_to_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks, jira +# capabilities: beads # description: Import Jira ticket hierarchy into beads # Usage: jira_to_beads.sh <mount> <ticket-key> set -euo pipefail diff --git a/mcptools/label_bead.sh b/mcptools/label_bead.sh index ba366f5..01edce2 100755 --- a/mcptools/label_bead.sh +++ b/mcptools/label_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Add a label to a bead # Usage: label_bead.sh <mount> <bead-id> <label> set -euo pipefail diff --git a/mcptools/list_beads.sh b/mcptools/list_beads.sh index d325f63..314a59a 100755 --- a/mcptools/list_beads.sh +++ b/mcptools/list_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: List all beads across all mounted projects (JSON array) # Usage: list_beads.sh <mount> set -euo pipefail diff --git a/mcptools/list_mounts.sh b/mcptools/list_mounts.sh index 437efbd..cdf5a23 100755 --- a/mcptools/list_mounts.sh +++ b/mcptools/list_mounts.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: List mounted beads projects set -euo pipefail diff --git a/mcptools/list_ready_beads.sh b/mcptools/list_ready_beads.sh index ffb823c..7dd3b52 100755 --- a/mcptools/list_ready_beads.sh +++ b/mcptools/list_ready_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: List ready/claimable beads (JSON array) # Usage: list_ready_beads.sh <mount> set -euo pipefail diff --git a/mcptools/list_roles.sh b/mcptools/list_roles.sh index 58e2c02..c6f540d 100755 --- a/mcptools/list_roles.sh +++ b/mcptools/list_roles.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: roles +# capabilities: discovery # description: List all available roles (JSON array) set -euo pipefail diff --git a/mcptools/list_skills.sh b/mcptools/list_skills.sh index 07487a2..7cf298b 100755 --- a/mcptools/list_skills.sh +++ b/mcptools/list_skills.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: skills +# capabilities: discovery # description: List all available skills (JSON array) set -euo pipefail diff --git a/mcptools/mount_beads.sh b/mcptools/mount_beads.sh index 2a0237a..5bc57ab 100755 --- a/mcptools/mount_beads.sh +++ b/mcptools/mount_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Mount a beads project # Usage: mount_beads.sh <cwd> [name] set -euo pipefail diff --git a/mcptools/read_bead.sh b/mcptools/read_bead.sh index 397d55e..c26965d 100755 --- a/mcptools/read_bead.sh +++ b/mcptools/read_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Read a bead property # Usage: read_bead.sh <mount> <bead-id> <property> set -euo pipefail diff --git a/mcptools/sync_beads.sh b/mcptools/sync_beads.sh index 53729ad..2a6e35f 100755 --- a/mcptools/sync_beads.sh +++ b/mcptools/sync_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Sync a mounted beads project # Usage: sync_beads.sh <mount> set -euo pipefail diff --git a/mcptools/umount_beads.sh b/mcptools/umount_beads.sh index ac7265d..d549581 100755 --- a/mcptools/umount_beads.sh +++ b/mcptools/umount_beads.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Unmount a beads project # Usage: umount_beads.sh <name> set -euo pipefail diff --git a/mcptools/unclaim_bead.sh b/mcptools/unclaim_bead.sh index 2506ea4..8f881c9 100755 --- a/mcptools/unclaim_bead.sh +++ b/mcptools/unclaim_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Unclaim a bead (reset to open) # Usage: unclaim_bead.sh <mount> <bead-id> set -euo pipefail diff --git a/mcptools/unlabel_bead.sh b/mcptools/unlabel_bead.sh index 15ff719..4890c47 100755 --- a/mcptools/unlabel_bead.sh +++ b/mcptools/unlabel_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Remove a label from a bead # Usage: unlabel_bead.sh <mount> <bead-id> <label> set -euo pipefail diff --git a/mcptools/update_bead.sh b/mcptools/update_bead.sh index 15c3167..050eb12 100755 --- a/mcptools/update_bead.sh +++ b/mcptools/update_bead.sh @@ -1,5 +1,5 @@ #!/bin/bash -# capabilities: beads, tasks +# capabilities: beads # description: Update a bead field # Usage: update_bead.sh <mount> <bead-id> <field> <value> set -euo pipefail diff --git a/skills/anvillm-communication/SKILL.md b/skills/anvillm-communication/SKILL.md index d66e1d4..68dce35 100644 --- a/skills/anvillm-communication/SKILL.md +++ b/skills/anvillm-communication/SKILL.md @@ -10,6 +10,7 @@ when_to_load: Load when you need to send messages to other agents, respond to th ## Tools **IMPORTANT:** All anvillm-communication tools must be run via `execute_code` tool. +**IMPORTANT:** Read the $AGENT_ID environment variable to get your agent ID - Discover agents: `bash <(9p read agent/tools/agents/list_sessions.sh) | grep "$(pwd)"` - Send message: `bash <(9p read agent/tools/messaging/send_message.sh) <FROM> <TO> <TYPE> <SUBJECT> <BODY>` @@ -17,8 +18,6 @@ when_to_load: Load when you need to send messages to other agents, respond to th ## Rules -0. Read the $AGENT_ID environment variable to get your agent ID - ### Discovering Agents 1. You communicate only with "user", or other agents working in the same $(pwd) as yourself