perms, prompts

This commit is contained in:
Levi Neely 2026-03-04 08:05:22 +01:00
parent 12d446d748
commit c93bd19487
8 changed files with 224 additions and 0 deletions

View File

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

View File

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

View File

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

18
mcptools/kill_agent.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# capabilities: agents
# description: Kill agent session(s) running in the given directory: <agent-id>
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 <agent-id>}"
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

24
mcptools/spawn_agent.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# capabilities: agents
# description: Spawn a new agent session (do not use execute_code): <agent-id> [cwd-path] [initial-context-prompt]
set -euo pipefail
agent_id="${1:?Usage: spawn_agent.sh <agent-id> [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

View File

@ -15,6 +15,8 @@ All commands must be run via `execute_code` tool:
- List sessions: `list_sessions.sh`
- Create session: `create_session.sh <backend> <cwd> [role=<role>] [tasks=<task1,task2>] [model=<model>]`
- Control session: `control_session.sh <session-id> <command>`
- Spawn agent: `spawn_agent.sh <agent-id> [cwd-path] [initial-context-prompt]`
- Kill agent: `kill_agent.sh [cwd-path]`
## Backends

View File

@ -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 "<command>" | ./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 <localpath> <remotepath>` - Add sync folder
- `sync remove <folderid>` - 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 <pass>` - 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) <your-id> "<system-prompt-above>"`
**Send test request**: `bash <(9p read agent/tools/messaging/send_message.sh) <your-id> <testing-agent-id> PROMPT_REQUEST "Validate fix" "Bug: <desc>\nFix: <changes>\nFiles: <list>\nBranch: <name>"`
**Read response** (user notifies when ready): `bash <(9p read agent/tools/messaging/read_inbox.sh) <your-id>`
**Kill testing agent**: `bash <(9p read agent/tools/agents/kill_agent.sh) <testing-agent-id>`
**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) <your-id> <requester-id> PROMPT_RESPONSE "Validation complete" "Status: completed|failed\n<evidence>"`
**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 "<command>" | ./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 <dlfcn.h>` 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`)

View File

@ -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 "<command>" | ./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 <localpath> <remotepath>` - Add sync folder
- `sync remove <folderid>` - Remove sync folder
- `sync pause` - Pause syncing
- `sync resume` - Resume syncing
- `pending` - Check pending transfers
- `crypto start <pass>` - 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 "<command>" | ./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