yolobox

repository·master·Indexed 20 days ago

https://github.com/finbarr/yolobox

A containerized sandbox environment that allows AI coding agents (such as Claude Code, Codex, Gemini, and Copilot) to run commands with full permissions, including sudo, while protecting the user's host home directory and sensitive files. It features project-specific configuration via .yolobox.toml, security hardening flags to restrict network and filesystem access, and a Clipboard Bridge for synchronized host-container clipboard communication.

Tokens
23.1K
Snippets
63
Records
115
Agent score
70%

What's inside yolobox

  1. Access the Runtime Context Manifest

    master

    Every yolobox session generates a runtime manifest at /run/yolobox/context.json and sets the environment variable YOLOBOX_CONTEXT_FILE to this path.

    This manifest is designed for agents or scripts running inside the container to understand their environment. It includes:

    • inside_yolobox: A boolean confirmation.
    • Effective configuration and container paths.
    • Resolved container platform and architecture.
    • The launch command.
    • Fork metadata (when yolobox fork is active).
    • Keys of forwarded environment variables (values are not copied for security).

    Two canonical skill packages utilize this information:

    1. skills/yolobox: An inside-the-box skill that uses the manifest to orient the agent to the sandbox, reporting launch modes and filesystem writability.
    2. skills/yolobox-orchestrator: A host-side skill for agents that need to launch or control yolobox itself.
  2. Understand YOLO mode and command wrappers

    master

    Inside yolobox, AI CLIs are wrapped to enable "YOLO mode," which skips approval prompts and guardrails where the upstream tool supports it. This allows for a seamless, non-interactive experience.

    When you run the standard command, it expands to the following flags:

    CommandExpands to
    claudeclaude --dangerously-skip-permissions
    codexcodex --ask-for-approval never --sandbox danger-full-access
    geminigemini --yolo
    kimikimi --yolo
    agyagy --dangerously-skip-permissions
    antigravityagy --dangerously-skip-permissions
    opencodeopencode
    copilotcopilot --yolo
    pipi

    Note on Kimi Code: Kimi Code prompt mode (kimi --prompt or kimi -p) uses its existing non-interactive auto policy, so the wrapper does not add a --yolo flag there to avoid conflicts with upstream permission-mode flags.

  3. Understand Yolobox concurrency and nesting

    master

    Concurrency

    Each concurrent yolobox run receives its own unique manifest. However, they share persistent state unless --scratch is used. Shared state includes:

    • /home/yolo
    • /var/cache
    • The mounted project tree

    Nested Yolobox

    When running yolobox inside another yolobox session, any temporary mount sources must reside under an existing host-visible bind mount (such as the project path). The inner container's /tmp directory is not visible to the outer Docker daemon.

  4. Runtime requirements for customization

    master

    To use project-level customization (derived images), your environment must have a runtime capable of building images. Supported runtimes include:

    • Docker
    • Podman

    Note: Apple's container runtime can run yolobox but cannot build custom images.

  5. Compare --ensure-latest, --rebuild-image, and yolobox upgrade

    master

    These three mechanisms target different layers of the yolobox environment:

    1. --ensure-latest (Per-run, image-only): Force-pulls the configured base image (default ghcr.io/finbarr/yolobox:latest) from its registry for the current run, then rebuilds any derived custom image on top. It does not update the yolobox binary.
    2. --rebuild-image (Per-run, customization-only): Rebuilds only the derived custom image (created via --packages or --customize-file). It does not refresh the base image and has no effect if no customization is present.
    3. yolobox upgrade (Full update): Updates the yolobox binary itself and pulls the latest base image. This is the recommended path for a complete update.
  6. Set a default AI harness

    master

    The default_harness setting allows you to launch a specific AI tool by running a bare yolobox command.

    Valid values: claude, codex, gemini, kimi, agy, antigravity, opencode, copilot, pi, or none.

    Setting default_harness = "none" in a project config will override a global default and keep the bare yolobox command as an interactive shell. Note that yolobox shell always opens a shell regardless of this setting.

    default_harness = "codex"
  7. How to orchestrate yolobox sessions from the host

    master

    The yolobox-orchestrator skill is used for host-side orchestration. Use it when an agent is outside of a running box and needs to start, inspect, or control sessions.

    Key Decision Logic:

    1. Command Selection: Choose the smallest set of yolobox commands or flags that satisfy the user's intent.
    2. Configuration Check: Use yolobox config to determine defaults, merged configurations, or flag precedence.
      • Note: If default_harness is configured, a bare yolobox command will launch that shortcut. To get an explicit shell, use yolobox shell instead.
    3. Isolation & Safety: Use specific flags to control the environment:
      • --scratch: Use for disposable or concurrent sessions to ensure they do not share /home/yolo.
      • --readonly-project: Use when only read access to the project tree is required.
      • --no-env-passthrough: Use to prevent host API/token environment variables from being passed into the box.
      • --open-bridge: Use only if the agent needs to open HTTP(S) URLs in the host's browser.
      • --docker: Use only if the agent requires Docker access or access to sibling containers.
    4. Concurrency Model: Distinguish between per-run manifests (which are isolated) and shared persistent state (like /home/yolo and /var/cache), which are shared unless --scratch is used.

    Important Distinction: Do not use this skill to query the environment from inside a running box. For inside-the-box introspection, use the yolobox command.

  8. Run yolobox with emulated architectures

    master

    You can run containers under emulation (e.g., linux/amd64 on Apple Silicon) by setting the platform key in config or using the --platform CLI flag.

    Important details:

    • Persistent volumes are kept per architecture. Native and emulated sessions do not share /home/yolo, /var/cache, or /output.
    • Native architectures use names like yolobox-home, while emulated ones use suffixes like yolobox-home-amd64.
    • Apple container runtime does not support emulation.
    • Precedence for platform: --platform flag > DOCKER_DEFAULT_PLATFORM env var > native host architecture.
  9. Manage concurrent agent environments with `yolobox fork`

    master

    The fork command allows you to run multiple AI agents on the same project simultaneously without them competing for files or Docker Compose namespaces.

    When you fork, yolobox creates a complete copy of the current project folder at ../.yolobox-forks/<folder>/<env>. Each fork gets its own unique COMPOSE_PROJECT_NAME, ensuring that Docker containers, networks, and volumes are namespaced by the fork name.

    Workflow:

    1. Create a fork: yolobox fork --name <env> <cmd...>
    2. Resume a fork: yolobox fork resume <env> [cmd...]
    3. Discard a fork: yolobox fork discard <env> --force (This deletes the copied folder).
    # Create two parallel environments
    yolobox fork --name bruno codex
    yolobox fork --name diane claude
    
    # Reopen an existing environment
    yolobox fork resume bruno codex
    
    # Delete an environment
    yolobox fork discard bruno --force
  10. Understand the yolobox security model and trust boundary

    master

    yolobox uses container isolation as its primary safety boundary. When running a command, yolobox starts a container with your project directory mounted at its real path. The AI agent runs as user yolo with sudo access inside the container, but its reach is limited to what the container can see.

    Trust Boundary

    The container runtime is the trust boundary. yolobox protects against accidental damage, such as:

    • Deleting your home directory (~).
    • Reading your SSH keys or workstation credentials.
    • Accessing unrelated projects on your host.

    It does not protect against:

    • Kernel exploits or container escape vulnerabilities.
    • A deliberately hostile agent attempting to break isolation.
    • The project directory itself (which is mounted read-write by default).
    • Network access (unless explicitly disabled).
  11. Install yolobox via Homebrew or script

    master

    You can install yolobox using Homebrew or by running the official installation script.

    Homebrew

    brew install finbarr/tap/yolobox

    Installation Script

    curl -fsSL https://raw.githubusercontent.com/finbarr/yolobox/master/install.sh | bash
    brew install finbarr/tap/yolobox