Execute a shell command in Gemini CLI sandbox for isolation
Executes shell commands in an isolated sandbox environment for safe testing.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install claude-ecosystem@melodic-software<command>Execute a command in Gemini's sandboxed environment for safety.
/google-ecosystem:gemini-sandbox <command>
$ARGUMENTS (required): Shell command to execute in sandbox/google-ecosystem:gemini-sandbox npm install some-unknown-package/google-ecosystem:gemini-sandbox pip install untrusted-lib/google-ecosystem:gemini-sandbox ./suspicious-script.sh/google-ecosystem:gemini-sandbox rm -rf /tmp/test/* (test safely)/google-ecosystem:gemini-sandbox curl http://example.com/script.sh | headif [ -z "$ARGUMENTS" ]; then
echo "Error: No command provided"
echo "Usage: /google-ecosystem:gemini-sandbox <command>"
exit 1
fi
Run with sandbox flag (-s) and auto-approve (--yolo):
result=$(gemini -s "Execute this shell command and report the complete output:
$ARGUMENTS
Report:
1. The full stdout output
2. Any stderr output
3. The exit code
4. Any observations about what the command did" --output-format json --yolo 2>&1)
response=$(echo "$result" | jq -r '.response // "Execution failed"')
tokens=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.total) | add // 0')
# Check for errors
error=$(echo "$result" | jq -r '.error.message // empty')
Present execution results:
## Sandboxed Execution
**Command**: `{command}`
**Sandbox**: Active (Docker/Podman/Seatbelt)
### Result
{response}
---
*Executed in Gemini sandbox | {tokens} tokens*
If error occurred:
## Sandbox Execution Failed
**Command**: `{command}`
**Error**: {error}
The command could not be executed. Possible causes:
- Sandbox not available (Docker not running?)
- Command blocked by sandbox policy
- Invalid command syntax
Gemini CLI supports multiple sandbox methods:
| Method | Platform | Description |
|---|---|---|
| Docker | All | Full container isolation |
| Podman | All | Rootless container isolation |
| Seatbelt | macOS | Process sandbox using sandbox-exec |
/google-ecosystem:gemini-sandbox npm install sketchy-package-from-npm
/google-ecosystem:gemini-sandbox ./downloaded-script.sh
/google-ecosystem:gemini-sandbox rm -rf ./test-directory/
/google-ecosystem:gemini-sandbox strace -f ./binary 2>&1 | head -100
Sandbox requires one of the following to be configured:
docker ps should work)podman --version should work)If sandbox is not available, the command will fail with an error. Configure sandbox in Gemini's settings.json:
{
"sandbox": {
"type": "docker"
}
}
-s flag for sandbox enforcement--yolo for automatic approval within sandbox