Codex sandbox

From DNYoussef/context-cascade · View interactive version

Codex sandbox is an AI agent skill from the GitHub repository DNYoussef/context-cascade. Run code in Codex fully isolated sandbox - network disabled, CWD only, Seatbelt/Docker isolation

How to use this skill

Skill file

Codex Sandbox Skill


LIBRARY-FIRST PROTOCOL (MANDATORY)

Before writing ANY code, you MUST check:

Step 1: Library Catalog

Step 2: Patterns Guide

Step 3: Existing Projects

Decision Matrix

| Match | Action |

|-------|--------|

| Library >90% | REUSE directly |

| Library 70-90% | ADAPT minimally |

| Pattern exists | FOLLOW pattern |

| In project | EXTRACT |

| No match | BUILD (add to library after) |


Purpose

Execute code in Codex's fully isolated sandbox environment for safe experimentation with untrusted or risky code.

Unique Capability

What Claude Can't Do: Claude runs in your environment. Codex sandbox provides:

When to Use

Perfect For:

Don't Use When:

Usage

# Basic sandbox execution
/codex-sandbox "Refactor auth system and run tests"

# With iteration limit
/codex-sandbox "Fix all tests" --max-iterations 10

# Risky experiment
/codex-sandbox "Try experimental algorithm implementation"

CLI Command

codex --full-auto --sandbox true --network disabled "Your task"

# Via script
CODEX_MODE=sandbox bash scripts/multi-model/codex-yolo.sh "Task" "id" "." "10" "sandbox"

Isolation Layers

| Layer | Protection |

|-------|------------|

| Network | DISABLED - no external connections |

| Filesystem | CWD only - no parent access |

| OS-Level | Seatbelt (macOS) / Docker |

| Process | Subprocess jail with limits |

| Commands | Blocked: rm -rf, sudo, etc. |

Integration Pattern

// 1. Run risky refactoring in sandbox
const result = await codexSandbox("Refactor entire auth system");

// 2. If successful, apply to real codebase
if (result.tests_pass) {
  Task("Coder", "Apply sandboxed changes to main", "coder");
}

Memory Integration

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.