Bridge isolated AI agents to Linux host operationsβsecurely, asynchronously, and without direct access.
A battle-tested signaling framework that enables AI agents (like OpenClaw) operating inside sandboxed containers to safely trigger host-level operations. Designed for remote DevOps productivity while maintaining zero-trust security principles.
- Why This Exists
- Architecture
- Security Model
- Key Features
- Installation
- Usage
- Real-World Case Study
- Technical Stack
- Contributing
Modern AI coding assistants are powerful but operate in sandboxed environments for security. This creates a fundamental challenge: How can an AI agent perform legitimate host operations (Git pushes, queue restarts) without compromising security?
Traditional approaches fail:
- β Granting SSH access exposes the host to arbitrary commands
- β Running AI agents with root privileges is a critical vulnerability
- β Direct Docker socket access enables container escape attacks
This system solves it by implementing an asynchronous signaling protocol where:
- β The AI can only request pre-approved operations
- β A trusted host-side executor validates and runs commands
- β Complete audit trail of all operations
- β Zero direct access to host systems
This system implements a Waiter/Chef pattern for secure command execution:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SANDBOXED CONTAINER β
β βββββββββββββββββ β
β β AI Agent β "I need to push to Git" β
β β (OpenClaw) β ββββββββββββββββββββββββββ β
β βββββββββββββββββ β β
β β βΌ β
β β ββββββββββββββββ β
β β β git_push.flagβ β
β β β (main) β β
β β ββββββββββββββββ β
β β β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SHARED VOLUME β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β LINUX HOST β β
β β βΌ β
β β βββββββββββββββββββββββββββββββββββββββββββ β
β β β CRON (every minute) β β
β β β worker_manager.sh executor β β
β β β βββββββββββββββββββββββββββββββββββ β β
β β β β Detects flag β Validates β β β β
β β β β Executes: git push origin main β β β
β β β β Logs β Removes flag β β β
β β β βββββββββββββββββββββββββββββββββββ β β
β β βββββββββββββββββββββββββββββββββββββββββββ β
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Role | Analogy |
|---|---|---|
| AI Agent | Requesterβwrites .flag files with operation parameters |
π§βπ³ Waiter takes the order |
| Shared Volume | Communication channelβmounted in both container and host | π Order ticket board |
| worker_manager.sh | Executorβprocesses flags and runs whitelisted commands | π¨βπ³ Chef prepares the dish |
| Crontab | Schedulerβtriggers the executor every minute | β° Kitchen timer |
- AI writes a flag file to the shared volume (e.g.,
git_push.flagcontainingmain) - Cron triggers
worker_manager.shevery minute - Executor detects the flag, validates the operation
- Command executes on the host with proper permissions
- Flag is removed and operation is logged
- AI can read the log or result files for confirmation
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SECURITY LAYERS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Layer 1: Container Sandboxing β
β ββ AI runs in isolated Docker container β
β ββ No network access to host services β
β ββ Limited filesystem visibility β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Layer 2: Command Whitelisting β
β ββ Only pre-defined operations can be triggered β
β ββ Each flag maps to ONE specific command pattern β
β ββ No arbitrary command execution (except audit flag) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Layer 3: Input Validation β
β ββ Flag contents are sanitized (xargs, cut) β
β ββ Paths are constrained to REPO_DIR β
β ββ Empty inputs have safe defaults β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Layer 4: Audit Logging β
β ββ Every operation is timestamped in commands.log β
β ββ Full command output captured β
β ββ Immutable record for forensic analysis β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Action | Status | Reason |
|---|---|---|
| SSH into host | π« Blocked | No credentials or network path |
| Execute arbitrary binaries | π« Blocked | Only whitelisted commands |
| Modify system files | π« Blocked | Operations scoped to $REPO_DIR |
| Access other containers | π« Blocked | Network isolation |
| Escalate privileges | π« Blocked | Executor runs as unprivileged user |
| Action | Status | Implementation |
|---|---|---|
| Request Git operations | β Allowed | Via git_*.flag files |
| Trigger queue restart | β Allowed | Via restart_queue.flag |
| Check Git status | β Allowed | Output to git_status.txt |
| Run diagnostic commands | Via git_cmd.flag (audited) |
Complete Git workflow support through flag-based signaling:
# Stage changes
echo "." > /shared/git_add.flag
# Commit with message
echo "feat: add user authentication" > /shared/git_commit.flag
# Push to remote
echo "main" > /shared/git_push.flag
# Check repository status
touch /shared/git_status.flag
# Result appears in git_status.txtSeamless integration with Laravel Horizon/Queue workers:
# Restart queue workers (e.g., after deployment)
touch /shared/restart_queue.flagThe monitor_worker.sh daemon provides:
- Automatic queue health monitoring
- Business-hours aware operation (09:00-18:00 BRT, weekdays)
- Configurable pending job thresholds
- Auto-restart on queue congestion
Configure Git credentials remotely:
# Set Git user identity
echo "Hugo Developer | hugo@example.com" > /shared/git_set_config.flagFor troubleshooting scenarios requiring flexibility:
# Execute a whitelisted diagnostic command
echo "git log --oneline -5" > /shared/git_cmd.flag
β οΈ Note: This flag is for emergency troubleshooting. All commands are logged and audited.
- Linux host with Bash 5.0+
- Docker (for containerized AI agent)
- Git configured with SSH keys for remote operations
- Cron daemon running
1. Clone the repository:
git clone https://github.com/your-org/basis-scripts.git /home/hugo/basis/scripts
cd /home/hugo/basis/scripts
chmod +x *.sh2. Configure paths in worker_manager.sh:
# Edit to match your environment
BASIS_DIR="/home/hugo/basis"
REPO_DIR="$BASIS_DIR/eventos" # Your target repository
LOG_FILE="$BASIS_DIR/scripts/commands.log"3. Set up the Crontab trigger:
crontab -eAdd the following line:
* * * * * /home/hugo/basis/scripts/worker_manager.sh >> /home/hugo/basis/scripts/cron.log 2>&14. Create shared volume mount in Docker:
# docker-compose.yml
services:
ai-agent:
volumes:
- /home/hugo/basis:/shared/basis5. Verify installation:
# Create a test flag
touch /home/hugo/basis/git_status.flag
# Wait 1 minute, then check
cat /home/hugo/basis/git_status.txt# Python example for AI agent
import pathlib
SHARED_DIR = pathlib.Path("/shared/basis")
def request_git_push(branch: str = "main"):
"""Request a Git push operation."""
flag = SHARED_DIR / "git_push.flag"
flag.write_text(branch)
def request_git_commit(message: str):
"""Request a Git commit."""
flag = SHARED_DIR / "git_commit.flag"
flag.write_text(message)
def check_git_status() -> str:
"""Request and read Git status."""
flag = SHARED_DIR / "git_status.flag"
flag.touch()
# Wait for processing, then read result
result = SHARED_DIR / "git_status.txt"
return result.read_text() if result.exists() else "Pending..."| Flag File | Parameter | Action |
|---|---|---|
git_status.flag |
None | Writes status to git_status.txt |
git_add.flag |
File path or . |
Stages changes |
git_commit.flag |
Commit message | Creates commit |
git_push.flag |
Branch name (optional) | Pushes to remote |
git_check.flag |
None | Outputs Git config to git_check.txt |
git_set_config.flag |
Name | email |
Sets Git identity |
git_cmd.flag |
Command string | Executes arbitrary Git command |
restart_queue.flag |
None | Restarts Laravel queue workers |
Scenario: During a remote debugging session via Telegram, an AI agent encountered a Git repository in a corrupted stateβstuck in detached HEAD with no upstream configured.
The Problem:
fatal: You are not currently on a branch.
fatal: The current branch main has no upstream branch.
Traditional Fix: Would require SSH access, manual intervention, and potential security exposure.
Solution via Signaling System:
# Step 1: AI diagnosed the issue by requesting status
touch /shared/git_status.flag
# Read git_status.txt β Confirmed detached HEAD
# Step 2: AI requested branch checkout
echo "git checkout main" > /shared/git_cmd.flag
# Step 3: AI set upstream
echo "git branch --set-upstream-to=origin/main main" > /shared/git_cmd.flag
# Step 4: AI verified fix
touch /shared/git_status.flag
# Read git_status.txt β On branch main, tracking origin/mainResult: Complex Git recovery completed remotely without granting SSH access, with full audit trail, in under 5 minutes.
| Component | Technology | Purpose |
|---|---|---|
| Executor | Bash 5.0+ | Cross-platform scripting, native Linux integration |
| Scheduler | Cron | Reliable, battle-tested job scheduling |
| Containerization | Docker | AI agent isolation, shared volume mounts |
| Version Control | Git | Repository operations |
| Application Framework | Laravel | Queue worker management, Artisan commands |
| Monitoring | Custom Bash | health-check.sh, monitor_worker.sh |
| Audit | Plain text logs | commands.log with timestamps |
scripts/
βββ worker_manager.sh # Main executor (Cron-triggered)
βββ monitor_worker.sh # Queue health monitor daemon
βββ health-check.sh # Docker/worker diagnostics
βββ audit_log.sh # Logging utility
βββ commands.log # Audit trail (generated)
βββ README.md # This file
Contributions are welcome! Please ensure:
- All new operations are whitelisted explicitly
- Input validation is applied to flag contents
- Operations are logged with timestamps
- Security implications are documented
MIT License - See LICENSE for details.
Built for secure AI-to-host operations in production environments.
Because giving AI agents SSH access is not an option.