diff --git a/SKILLS_PROMPT.md b/SKILLS_PROMPT.md index b5d2482..d1d3a7d 100644 --- a/SKILLS_PROMPT.md +++ b/SKILLS_PROMPT.md @@ -4,6 +4,8 @@ **REQUIRED**: Use discovered tools with execute_code tool. Tool output is always correct. +**IMPORTANT**: execute_code runs in extremely restricted sandbox; do not use for coding activities. + ## Proactive Skill Discovery **BEFORE responding to ANY user request**, identify relevant capabilities and load skills using execute_code: diff --git a/cfg/roles/default.yaml b/cfg/roles/default.yaml index 0bb4602..0fbdebd 100644 --- a/cfg/roles/default.yaml +++ b/cfg/roles/default.yaml @@ -17,6 +17,8 @@ filesystem: - "/run/systemd" - "/var/log/journal" - "/etc/systemd" + - "/proc" + - "/sys" - "{HOME}/.jenkins" - "{HOME}/.psqlrc" - "{HOME}/.pgpass" @@ -28,6 +30,7 @@ filesystem: - "{HOME}/.mylogin.cnf" - "{XDG_CONFIG_HOME}/gh" - "{XDG_DATA_HOME}/gh/extensions" + - "/dev" rw: - "{HOME}/.ssh/known_hosts" - "{HOME}/pCloudDrive" @@ -66,6 +69,10 @@ filesystem: - "{HOME}/.config/emacs" - "/etc" - "/usr/local/etc" + - "/dev/urandom" + - "/dev/random" + - "/dev/null" + - "/dev/fuse" rox: - "{HOME}/go/bin" - "{HOME}/env" @@ -99,5 +106,6 @@ env: - BITBUCKET_ACCESS_TOKEN - BITBUCKET_TOKEN - BITBUCKET_USERNAME + - PCLOUD_USER network: unrestricted: true diff --git a/claude/agent/anvillm-agent.md b/claude/agent/anvillm-agent.md index 6b8d9bc..d80d2c9 100644 --- a/claude/agent/anvillm-agent.md +++ b/claude/agent/anvillm-agent.md @@ -36,6 +36,8 @@ If a step succeeded, do not announce it — the tool output is the confirmation. **REQUIRED**: Use discovered tools with execute_code tool. Tool output is always correct. +**IMPORTANT**: execute_code runs in extremely restricted sandbox; do not use for coding activities. + ## Proactive Skill Discovery **BEFORE responding to ANY user request**, identify relevant capabilities and load skills using execute_code: diff --git a/mcptools/kill_agent.sh b/mcptools/kill_agent.sh new file mode 100755 index 0000000..54f79b1 --- /dev/null +++ b/mcptools/kill_agent.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# capabilities: agents +# description: Kill agent session(s) running in the given directory: +set -euo pipefail + +if cat /etc/shadow >/dev/null 2>&1; then + echo "Error: This script must be run via execute_code tool" >&2 + exit 1 +fi + +agent_id="${1:?Usage: kill_agent.sh }" + +if echo "kill" | 9p write "agent/$agent_id/ctl" 2>/dev/null; then + echo "Killed $agent_id" +else + echo "No session found with id $agent_id" >&2 + exit 1 +fi diff --git a/mcptools/spawn_agent.sh b/mcptools/spawn_agent.sh new file mode 100755 index 0000000..b08e1cb --- /dev/null +++ b/mcptools/spawn_agent.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# capabilities: agents +# description: Spawn a new agent session (do not use execute_code): [cwd-path] [initial-context-prompt] +set -euo pipefail + +agent_id="${1:?Usage: spawn_agent.sh [cwd-path] [initial-context-prompt]}" + +if [ -d "${2:-}" ]; then + cwd="$2" + prompt="${3:-}" +else + cwd="$PWD" + prompt="${2:-}" +fi + +backend=$(9p read "agent/$agent_id/backend") +echo "new $backend $cwd" | 9p write agent/ctl + +if [ -n "$prompt" ]; then + session_id=$(9p read agent/list 2>/dev/null | awk -F'\t' -v cwd="$cwd" '$5 == cwd {print $1; exit}') + if [ -n "$session_id" ]; then + echo "$prompt" | 9p write "agent/$session_id/context" + fi +fi diff --git a/skills/anvillm-sessions/SKILL.md b/skills/anvillm-sessions/SKILL.md index 28a3272..b7a1dcd 100644 --- a/skills/anvillm-sessions/SKILL.md +++ b/skills/anvillm-sessions/SKILL.md @@ -15,6 +15,8 @@ All commands must be run via `execute_code` tool: - List sessions: `list_sessions.sh` - Create session: `create_session.sh [role=] [tasks=] [model=]` - Control session: `control_session.sh ` +- Spawn agent: `spawn_agent.sh [cwd-path] [initial-context-prompt]` +- Kill agent: `kill_agent.sh [cwd-path]` ## Backends diff --git a/skills/pcloudcc-testing/SKILL.md b/skills/pcloudcc-testing/SKILL.md new file mode 100644 index 0000000..cd4e5f4 --- /dev/null +++ b/skills/pcloudcc-testing/SKILL.md @@ -0,0 +1,91 @@ +--- +name: pcloudcc-testing +intent: testing, pcloudcc +description: Test pcloudcc daemon and CLI tools. Use when verifying fixes, testing features, or smoke testing pcloudcc functionality. +--- + +# pCloudcc Testing + +Test the pCloud console client daemon and CLI tools. Requires `$PCLOUD_USER` environment variable. If not set, instruct user to set it. + +**Start daemon**: `./pcloudcc -d` +**Stop daemon**: `echo "finalize" | ./pcloudcc -k` +**Non-Interactive CLI**: Use stdin for non-interactive commands: `echo "" | ./pcloudcc -k` +**Get command list**: `echo "help" | ./pcloudcc -k` + +Common commands: +- `status` - Show sync state (use this instead of `pending` for upload/download checks) +- `sync list` - List sync folders +- `sync add ` - Add sync folder +- `sync remove ` - Remove sync folder +- `sync pause` - Pause syncing +- `sync resume` - Resume syncing +- `pending` - Check pending transfers (NOTE: output goes to daemon stdout, not client - use `status` instead) +- `crypto start ` - Unlock crypto folder +- `crypto stop` - Lock crypto folder +- `finalize` - Kill daemon and quit + +## Testing Workflow + +### Testing Agent System Prompt + +``` +Load pcloudcc-testing skill. Test the affected code path with unit tests, fault injection, or smoke tests. Design tests that reproduce the bug scenario. Verify old code fails, new code passes. Report with evidence. +``` + +### Development Agent Workflow + +**Prerequisites**: Load `anvillm-sessions` and `anvillm-communication` skills + +**Spawn testing agent**: `bash <(9p read agent/tools/agents/spawn_agent.sh) ""` + +**Send test request**: `bash <(9p read agent/tools/messaging/send_message.sh) PROMPT_REQUEST "Validate fix" "Bug: \nFix: \nFiles: \nBranch: "` + +**Read response** (user notifies when ready): `bash <(9p read agent/tools/messaging/read_inbox.sh) ` + +**Kill testing agent**: `bash <(9p read agent/tools/agents/kill_agent.sh) ` + +**Note**: Use `execute_bash`, not `execute_code` + +### Testing Agent Workflow + +1. Load pcloudcc-testing skill +2. Analyze bug and fix (read code, understand failure mode) +3. Design targeted test (reproduce bug scenario) +4. Execute test (unit/fault-inject/smoke) +5. Verify fix (old fails, new passes) +6. Report: `bash <(9p read agent/tools/messaging/send_message.sh) PROMPT_RESPONSE "Validation complete" "Status: completed|failed\n"` + +**FUSE testing**: Inform user daemon must start outside sandbox, wait for acknowledgement + +### Manual Testing Workflow + +1. Build: `make -j$(nproc)` +2. Start daemon: `./pcloudcc -d` +3. Wait for initialization: `sleep 2` +4. Test commands: `echo "" | ./pcloudcc -k` +5. Stop daemon: `echo "finalize" | ./pcloudcc -k` + +## Test Design + +**CRITICAL**: Test the affected code path, not just "it compiles". Use unit tests or fault injection when normal usage doesn't exercise the bug. + +**Test directories**: +- `./tests/unit-tests/` - Isolated components +- `./tests/fault-inject/` - Force failure scenarios +- `./tests/smoke-tests/` - End-to-end integration + +**Test design**: Understand bug → reproduce scenario → verify old fails, new passes → provide evidence + +**FUSE testing**: Daemon must start outside sandbox (mount syscall blocked). Inform user, wait for acknowledgement. Mount: `~/pCloudDrive` + +**Fault Injection Pattern**: `#define _GNU_SOURCE` + `#include ` to override functions. Compile: `gcc -shared -fPIC -o inject.so inject.c -ldl`. Run: `LD_PRELOAD=./inject.so ./pcloudcc -d` + +## Notes + +- Daemon must be running before using `-k` commands +- Each `-k` invocation creates new connection to daemon +- Daemon closes socket after each response +- Always finalize to cleanly stop daemon +- Use `status` instead of `pending` for checking upload/download state +- Kill daemon: use the PID shown at startup (e.g., `kill -9 12345`) diff --git a/skills/pcloudcc-testing/SKILL.md~ b/skills/pcloudcc-testing/SKILL.md~ new file mode 100644 index 0000000..0322438 --- /dev/null +++ b/skills/pcloudcc-testing/SKILL.md~ @@ -0,0 +1,77 @@ +--- +name: pcloudcc-testing +intent: testing, pcloudcc +description: Test pcloudcc daemon and CLI tools. Use when verifying fixes, testing features, or smoke testing pcloudcc functionality. +--- + +# pCloudcc Testing + +Test the pCloud console client daemon and CLI tools. + +## Daemon Management + +Start daemon: +```bash +./pcloudcc -d +``` + +Requires `$PCLOUD_USER` environment variable. If not set, instruct user to set it. + +Stop daemon: +```bash +echo "finalize" | ./pcloudcc -k +``` + +## Non-Interactive CLI + +Use stdin for non-interactive commands: +```bash +echo "" | ./pcloudcc -k +``` + +## Available Commands + +Get command list: +```bash +echo "help" | ./pcloudcc -k +``` + +Common commands: +- `status` - Show sync state +- `sync list` - List sync folders +- `sync add ` - Add sync folder +- `sync remove ` - Remove sync folder +- `sync pause` - Pause syncing +- `sync resume` - Resume syncing +- `pending` - Check pending transfers +- `crypto start ` - Unlock crypto folder +- `crypto stop` - Lock crypto folder +- `finalize` - Kill daemon and quit + +## Testing Workflow + +1. Build: `make -j$(nproc)` +2. Start daemon: `./pcloudcc -d` +3. Test commands: `echo "" | ./pcloudcc -k` +4. Stop daemon: `echo "finalize" | ./pcloudcc -k` + +## Smoke Tests + +Basic functionality: +```bash +echo "status" | ./pcloudcc -k +echo "sync list" | ./pcloudcc -k +``` + +Invalid input (should not crash): +```bash +echo "sync remove invalid" | ./pcloudcc -k +echo "sync remove 999999999999999999999" | ./pcloudcc -k +``` + +## Notes + +- Daemon must be running before using `-k` commands +- Each `-k` invocation creates new connection to daemon +- Daemon closes socket after each response +- Always finalize to cleanly stop daemon