Skip to main content

Ward - The Universal Safety Layer for AI Agents. Cross-platform sandbox protection for any AI agent.

Project description

Ward - The Universal Safety Layer for AI Agents

Your AI's safety net โ€” Universal sandbox protection for any AI agent on any platform.

Python 3.10+ License: MIT Windows Support Cross Platform

๐Ÿš€ Quick Start

Installation

pip install ward-ai

Universal AI Agent Protection

Ward works as a CLI wrapper around any AI agent command:

# Protect Claude Desktop
ward run "claude code 'Fix the login bug'"

# Protect Ollama
ward run "ollama run codellama 'Refactor this function'"

# Protect any Python AI agent
ward run "python my_agent.py --task 'Add tests'"

# Protect shell commands
ward run "npm run build"

Quick Commands

# Start a protected session
ward start "Fix payment processing bug"

# Check what's happening
ward status

# Approve changes (promote to main codebase)
ward approve

# Emergency stop
ward kill

The Problem

AI agents are powerful but dangerous:

  • No isolation โ€” AI writes directly to your files
  • Platform limitations โ€” Anthropic's sandbox only works on Mac/Linux
  • No universal protection โ€” Each AI tool has different safety mechanisms
  • Windows gap โ€” 60% of developers use Windows but lack AI sandbox protection

The Solution

Ward is the universal safety layer that works with ANY AI agent on ANY platform:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Any AI    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Ward Wrapper    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Container  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Validation โ”‚
โ”‚   Agent     โ”‚     โ”‚   (CLI Layer)    โ”‚     โ”‚ Sandbox     โ”‚     โ”‚    Gate    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                                        โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
                    โ”‚   Main Codebase  โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚   Promote   โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚   (Protected)    โ”‚     โ”‚  (if safe)  โ”‚     
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฏ Key Differentiators

vs. Native Solutions: Works on Windows (Docker/venv fallback)
vs. Vibe Kanban: We focus on Security, they focus on Speed
vs. Ralph: Ralph manages workflows, Ward provides safety brakes

โœจ Features

๐Ÿ›ก๏ธ Universal Protection

  • Any AI Agent: Claude, Ollama, OpenAI, custom Python agents
  • Any Platform: Windows (Docker/venv), macOS (native), Linux (native)
  • Any Command: Wrap shell commands, scripts, or AI tools
  • Container Isolation: Docker-first with intelligent fallbacks

๏ฟฝ AWindows-First Design

  • Docker Desktop Integration: Seamless Windows container support
  • Fallback Modes: Python venv + tempfile when Docker unavailable
  • Path Handling: Robust Windows path resolution and security
  • Performance Optimized: Fast file sync and minimal overhead

๐Ÿค– AI Integration

  • CLI Wrapper: ward run "any command here"
  • Session Management: Track and control AI work sessions
  • Real-time Monitoring: See what AI is doing in real-time
  • Emergency Controls: ward kill for immediate shutdown

๏ฟฝ Enterprise Ready

  • Audit Logging: Complete trail of all AI actions
  • Validation Pipeline: Syntax, tests, security, scope checks
  • Modular Architecture: Plugin system for custom validators
  • Open Core Model: Free core + enterprise plugins

๐Ÿ“– Usage Examples

Universal Command Wrapping

# Protect any AI agent
ward run "claude code 'Fix the authentication system'"
ward run "ollama run codellama 'Add comprehensive tests'"
ward run "python my_agent.py --task 'Refactor for performance'"

# Protect development commands
ward run "npm run build"
ward run "python manage.py migrate"
ward run "cargo build --release"

# Stream output in real-time
ward run --stream "pytest tests/ -v"

Session Management

# Start a protected session for AI work
ward start "Implement user authentication"

# Check what's happening
ward status

# Approve changes (promote to main codebase)
ward approve

# Emergency stop everything
ward kill --all

Platform-Specific Features

# Force Docker isolation (Windows/macOS/Linux)
ward run --isolation docker "python train_model.py"

# Use venv fallback (when Docker unavailable)
ward run --isolation venv "pip install -r requirements.txt"

# Auto-detect best method (default)
ward run "make test"

๐Ÿ”ง Configuration

Basic Configuration

from ward import SandboxConfig, AutonomyLevel, ValidationMode

config = SandboxConfig(
    main_codebase="/path/to/your/project",
    autonomy_level=AutonomyLevel.VALIDATED,  # supervised, validated, autonomous
    validation_mode=ValidationMode.STRICT,   # strict, permissive, audit_only
    max_files_per_session=50,
    max_lines_changed=2000,
    session_timeout_minutes=120
)

Windows-Specific Setup

# Install Docker Desktop (recommended)
# Download from: https://www.docker.com/products/docker-desktop

# Verify Docker is running
docker --version

# Install Ward
pip install ward-ai

# Test Ward with Docker
ward run "echo 'Hello from Ward on Windows!'"

Enterprise Configuration

# Enterprise features (coming soon)
config = SandboxConfig(
    # ... basic config ...
    audit_logging=True,
    remote_execution=True,
    team_permissions=True,
    compliance_mode="SOC2"
)

๐Ÿ—๏ธ Architecture

Universal Wrapper Design

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   ward run      โ”‚  โ† CLI Command
โ”‚   "any command" โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Universal       โ”‚  โ† Command Parser & Router
โ”‚ Wrapper         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Platform  โ”‚  โ† Windows/macOS/Linux Detection
    โ”‚ Detection โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Isolation       โ”‚  โ† Docker โ†’ venv โ†’ native
โ”‚ Method          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Sandbox         โ”‚  โ† Container/venv/directory
โ”‚ Environment     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Command         โ”‚  โ† Execute with monitoring
โ”‚ Execution       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Validation      โ”‚  โ† Syntax, tests, security
โ”‚ Pipeline        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Approval        โ”‚  โ† Manual or auto-promote
โ”‚ Gate            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Windows Integration

Ward provides first-class Windows support through:

  1. Docker Desktop Integration: Seamless Windows container support
  2. Intelligent Fallbacks: Python venv when Docker unavailable
  3. Path Handling: Robust Windows path resolution and security
  4. Performance: Optimized file sync and minimal overhead

๐Ÿš€ Advanced Usage

Custom Validators

from ward.validators import BaseValidator, ValidationResult

class MyCustomValidator(BaseValidator):
    async def validate(self, changes: list[FileChange]) -> ValidationResult:
        # Your custom validation logic
        return ValidationResult(
            passed=True,
            message="Custom validation passed",
            details={}
        )

# Register validator
ward.add_validator(MyCustomValidator())

Programmatic Usage

import asyncio
from ward import get_wrapper, SandboxConfig

async def main():
    config = SandboxConfig(main_codebase="./my-project")
    wrapper = await get_wrapper(config)
    
    # Execute command safely
    result = await wrapper.wrap_command("python train.py")
    
    if result.validation_passed:
        await wrapper.approve_session(result.session_id)
    else:
        print("Validation failed:", result.validation_results)

asyncio.run(main())

CI/CD Integration

# GitHub Actions example
- name: Run tests with Ward protection
  run: |
    pip install ward-ai
    ward run "pytest tests/ --cov=src/"
    ward approve  # Auto-approve if tests pass

๐Ÿ”’ Security Features

Isolation Levels

  • Container Isolation: Full OS-level isolation via Docker
  • Process Isolation: Python venv with restricted filesystem access
  • Network Isolation: No network access by default in containers
  • Resource Limits: CPU, memory, and disk usage constraints

Validation Pipeline

  • Syntax Validation: AST parsing for code correctness
  • Test Validation: Automated test execution
  • Security Scanning: Detect secrets, vulnerabilities
  • Scope Validation: Ensure changes within allowed paths
  • Custom Rules: Project-specific validation logic

Audit Trail

# View complete audit log
ward report --output audit.json

# Session-specific logs
ward status --session abc123 --verbose

๐Ÿ”ง Development

Installation from Source

git clone https://github.com/nashihamm/ward.git
cd ward
pip install -e .

Running Tests

pytest tests/ -v --cov=ward

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“‹ Requirements

  • Python 3.10+
  • Docker Desktop (recommended for Windows)
  • Git (for worktree sandbox mode)

Platform Support

Platform Docker Venv Fallback Status
Windows 10/11 โœ… Docker Desktop โœ… Python venv Full Support
macOS โœ… Docker Desktop โœ… Python venv Full Support
Linux โœ… Docker Engine โœ… Python venv Full Support

๐Ÿค Contributing

Ward is open source and welcomes contributions! We're especially interested in:

  • Windows-specific improvements and testing
  • Additional AI agent integrations
  • Custom validator implementations
  • Performance optimizations
  • Documentation improvements

๏ฟฝ Liccense

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support & Community

๐Ÿš€ Roadmap

Phase 1: Universal Core (Current)

  • โœ… CLI wrapper for any command
  • โœ… Windows Docker Desktop integration
  • โœ… Venv fallback isolation
  • โœ… Basic validation pipeline

Phase 2: AI Agent Integration

  • ๐Ÿ”„ Enhanced Claude Desktop integration
  • ๐Ÿ”„ Native Ollama support
  • ๐Ÿ”„ OpenAI API integration
  • ๐Ÿ”„ Custom agent templates

Phase 3: Enterprise Features

  • ๐Ÿ“‹ Team management and permissions
  • ๐Ÿ“‹ Centralized audit logging
  • ๐Ÿ“‹ Remote cloud execution
  • ๐Ÿ“‹ Compliance frameworks (SOC2, GDPR)

Phase 4: Ecosystem

  • ๐Ÿ“‹ VS Code extension
  • ๐Ÿ“‹ Plugin marketplace
  • ๐Ÿ“‹ Community validators
  • ๐Ÿ“‹ Integration templates

Ward - Because every AI agent needs a safety net. ๐Ÿ›ก๏ธ

Made with โค๏ธ for safer AI development on every platform

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ward_ai-0.1.0.tar.gz (59.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ward_ai-0.1.0-py3-none-any.whl (61.6 kB view details)

Uploaded Python 3

File details

Details for the file ward_ai-0.1.0.tar.gz.

File metadata

  • Download URL: ward_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 59.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ward_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c388eabfa57d1f570f170c2a27a86b7893ddf79251cc53f70f132106cc1a8ae3
MD5 f39074420873ab8136167faadabdf229
BLAKE2b-256 df2e8a204f1bd204abdcafb712155364512d4d2630a76de114bf8604edc07bcf

See more details on using hashes here.

File details

Details for the file ward_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ward_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 61.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ward_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca5522bed2bddd77d3113c8055b360cc7ee79cdb6967693602e5185acc0dc05
MD5 ed3bc82e2772a5cf86372e2d997c658b
BLAKE2b-256 7d4f1e77a2a5c31d9c3548194aab9e313f2a0c0eb1b8d07603534061516e2788

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page