From 17ec56fbdd91a78876a8782c1f8987eb3bb03c4f Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 27 Feb 2026 00:06:13 +0100 Subject: [PATCH] Update messaging skill and execute command --- cmd/anvilmcp/execute.go | 42 +++++++++++++++++++-------- skills/anvillm-communication/SKILL.md | 8 +++-- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/cmd/anvilmcp/execute.go b/cmd/anvilmcp/execute.go index b327a24..ba55fcf 100644 --- a/cmd/anvilmcp/execute.go +++ b/cmd/anvilmcp/execute.go @@ -168,16 +168,33 @@ func executeCode(code, language string, timeout int) (string, error) { case "bash", "": args := []string{ "--rwx", workDir, - "--rox", "/usr", - "--rox", "/lib", - "--rox", "/lib64", - "--rox", "/bin", - "--ro", "/etc/alternatives", - "--ro", "/etc/ld.so.cache", - "--rw", namespace, "--unrestricted-network", } + // Add common system paths if they exist + systemPaths := []struct { + flag string + path string + }{ + {"--rox", "/usr"}, + {"--rox", "/lib"}, + {"--rox", "/lib64"}, + {"--rox", "/bin"}, + {"--ro", "/etc/alternatives"}, + {"--ro", "/etc/ld.so.cache"}, + } + + for _, sp := range systemPaths { + if _, err := os.Stat(sp.path); err == nil { + args = append(args, sp.flag, sp.path) + } + } + + // Add namespace if set + if namespace != "" { + args = append(args, "--rw", namespace) + } + // Add common user binary directories userBinDirs := []string{ filepath.Join(homeDir, "bin"), @@ -198,12 +215,13 @@ func executeCode(code, language string, timeout int) (string, error) { } args = append(args, - "--env", "NAMESPACE=" + namespace, - "--env", "PATH=/usr/bin:/bin", - "--env", "HOME=" + homeDir, + "--env", "NAMESPACE", + "--env", "PATH", + "--env", "HOME", + "--env", "PLAN9", ) if agentID != "" { - args = append(args, "--env", "AGENT_ID="+agentID) + args = append(args, "--env", "AGENT_ID") } args = append(args, "--", "bash", "-c", code) @@ -252,7 +270,7 @@ func executeCode(code, language string, timeout int) (string, error) { if err != nil { execLog.Error = err.Error() logExecution(execLog) - return string(output), fmt.Errorf("execution failed: %v", err) + return string(output), fmt.Errorf("execution failed: %v\nOutput: %s", err, string(output)) } logExecution(execLog) diff --git a/skills/anvillm-communication/SKILL.md b/skills/anvillm-communication/SKILL.md index bc9c107..f0c35e2 100644 --- a/skills/anvillm-communication/SKILL.md +++ b/skills/anvillm-communication/SKILL.md @@ -9,9 +9,11 @@ when_to_load: Load when you need to send messages to other agents, respond to th ## Commands -- List agents: `bash <(9p read agent/tools/agents/list_sessions.sh)` -- Send message: `bash <(9p read agent/tools/messaging/send_message.sh) FROM TO TYPE SUBJECT BODY` -- Check inbox: `bash <(9p read agent/tools/messaging/read_inbox.sh) AGENT_ID` +Use `execute_code` tool with these commands: + +- List agents: `9p read agent/tools/agents/list_sessions.sh | bash` +- Send message: `9p read agent/tools/messaging/send_message.sh | bash -s FROM TO TYPE SUBJECT BODY` +- Check inbox: `9p read agent/tools/messaging/read_inbox.sh | bash -s AGENT_ID` ## Use Cases