remove discover_tool.sh, one capability per tool, aggressive agent prompts

This allows me to assign a role via `context` to an agent, it discovers what that role means, then it can run the tools and load the skills required to do its work. In theory...
This commit is contained in:
Levi Neely 2026-03-05 23:35:15 +01:00
parent ec880544df
commit 391f773b2a
31 changed files with 58 additions and 116 deletions

View File

@ -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) <specific-keyword>`
2. Load role content: `9p read agent/roles/<focus-area>/<role-filename>.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) <specific-keyword>`
2. Load relevant skill files: `9p read agent/skills/<intent>/<skill-name>/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) <specific-keyword>`
Keep these tools and their usage in your memory for later use, when appropriate.

View File

@ -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) <specific-keyword>`
2. Load role content: `9p read agent/roles/<focus-area>/<role-filename>.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 <keyword>`. 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) <keyword>
9p read agent/roles/<focus>/<role>.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) <keyword>
9p read agent/skills/<intent>/<skill>/SKILL.md
```
1. Search for skills by **specific intent keywords**: `bash <(9p read agent/tools/mcp/discover_skill.sh) <specific-keyword>`
2. Load relevant skill files: `9p read agent/skills/<intent>/<skill-name>/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) <specific-keyword>`
## DISCOVERY IS ALWAYS FIRST
Before your first response, before checking inbox, before any tool call:
- Role assigned in the prompt? → `discover_role.sh <keyword>` MUST be your first tool call.
- User request received? → `discover_skill.sh <keyword>` 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.

View File

@ -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) <keyword> 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 <keyword>`. 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) <keyword>\n9p read agent/roles/<focus>/<role>.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) <keyword>\n9p read agent/skills/<intent>/<skill>/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 <keyword>` MUST be your first tool call.\n- User request received? → `discover_skill.sh <keyword>` 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,

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Batch create beads from JSON array
# Usage: batch_create_beads.sh <mount> <json-array>
set -euo pipefail

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Claim a bead for work
# Usage: claim_bead.sh <mount> <bead-id> [assignee]
set -euo pipefail

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Add a comment to a bead
# Usage: comment_bead.sh <mount> <bead-id> <text>
set -euo pipefail

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Complete a bead
# Usage: complete_bead.sh <mount> <bead-id>
set -euo pipefail

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Create a new bead
# Usage: create_bead.sh <mount> <title> [description] [parent-id] [--no-lint] [capability=low|standard|high]
set -euo pipefail

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: mcp
# capabilities: discovery
# description: Discover available roles by focus area and keyword
set -euo pipefail

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: List mounted beads projects
set -euo pipefail

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: roles
# capabilities: discovery
# description: List all available roles (JSON array)
set -euo pipefail

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: skills
# capabilities: discovery
# description: List all available skills (JSON array)
set -euo pipefail

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/bin/bash
# capabilities: beads, tasks
# capabilities: beads
# description: Unmount a beads project
# Usage: umount_beads.sh <name>
set -euo pipefail

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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