From cb2d28443365782e60a341055bd52944125c4576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Rochel?= Date: Thu, 9 Apr 2026 09:12:40 +0000 Subject: [PATCH 1/2] docs: Update root README.md for Codex CLI support Document Codex CLI alongside Claude Code throughout the README: - Intro, Why section, and features list mention both tools - Dockerfile section adds @openai/codex and bubblewrap - Firewall table adds 5 OpenAI domains, fixes github.com categories to dynamic - Settings sync section documents copy-on-first-run strategy - devcontainer.json section adds containerEnv, Codex volume, extensions - Generated files table adds codex-config.toml, sync-codex-settings.sh, mise-config.toml - Diagram updated with sync-codex-settings.sh step and dual-tool label - Go version kept at 1.25+ (matches go.mod) - File count updated from 8 to 11 Co-Authored-By: Claude Opus 4.6 (1M context) --- ...ate-root-readmemd-for-codex-cli-support.md | 8 ++-- README.md | 43 +++++++++++++------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md b/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md index 1bca835..ec3d88c 100644 --- a/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md +++ b/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md @@ -20,10 +20,10 @@ The root README.md is outdated after the Codex CLI epic. Needs updates: ## Definition of Done -- [ ] Tests written (TDD: write tests before implementation) -- [ ] No new TODO/FIXME/HACK/XXX comments introduced -- [ ] `golangci-lint run ./...` passes with no errors -- [ ] `go test ./...` passes with no failures +- [x] Tests written (TDD: write tests before implementation) -- N/A: documentation-only change, no testable behavior +- [x] No new TODO/FIXME/HACK/XXX comments introduced +- [x] `golangci-lint run ./...` passes with no errors +- [x] `go test ./...` passes with no failures - [ ] Branch pushed to remote - [ ] PR created - [ ] Automated code review passed via `@review-backend` subagent (via Task tool) diff --git a/README.md b/README.md index 9ccd7a9..39346a7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # agentbox -Generate devcontainer setups for running Claude Code in sandboxed environments with full permissions and network isolation. +Generate devcontainer setups for running Claude Code and Codex CLI in sandboxed environments with full permissions and network isolation. ## Why -Claude Code works best with full permissions -- file read/write, command execution, and network access. But granting those on your host machine is risky. +Claude Code and Codex CLI work best with full permissions -- file read/write, command execution, and network access. But granting those on your host machine is risky. -agentbox generates a [devcontainer](https://containers.dev/) that gives Claude Code full permissions inside a network-isolated Docker container. An iptables firewall with domain-level allowlisting ensures Claude Code can only reach explicitly approved domains, making "bypass permissions" mode safe to use. +agentbox generates a [devcontainer](https://containers.dev/) that gives Claude Code and Codex CLI full permissions inside a network-isolated Docker container. An iptables firewall with domain-level allowlisting ensures the coding tools can only reach explicitly approved domains, making "bypass permissions" mode safe to use. ## Features @@ -15,7 +15,7 @@ agentbox generates a [devcontainer](https://containers.dev/) that gives Claude C - **Network isolation** -- iptables default-DROP policy with ipset allowlist and dnsmasq for dynamic domains - **Interactive wizard** -- TUI for stack selection and domain configuration (powered by [charmbracelet/huh](https://github.com/charmbracelet/huh)) - **Non-interactive mode** -- `--non-interactive` / `-y` flag for CI pipelines and scripting -- **Claude Code settings sync** -- Copies host settings into the container with jq deep-merge on subsequent runs +- **Settings sync** -- Copies host Claude Code settings with jq deep-merge; copies Codex CLI config on first run - **LSP plugin configuration** -- Auto-configures Claude Code LSP plugins per detected stack - **Runtime management via mise** -- Installs language runtimes through [mise](https://mise.jdx.dev/) @@ -52,7 +52,7 @@ Example output: ``` Stacks: [go] -Generated .devcontainer/ with 8 files and .agentbox.yml +Generated .devcontainer/ with 11 files and .agentbox.yml ``` Then open the project in VS Code and select **Dev Containers: Reopen in Container**, or use [DevPod](https://devpod.sh/) to launch the container. @@ -102,7 +102,8 @@ The generated `Dockerfile` uses `debian:bookworm-slim` as the base image and ins - **mise** for language runtime management (Go, Node, Python, Rust, Ruby) - **LSP servers** per detected stack (gopls, pyright, typescript-language-server, etc.) -- **Claude Code** via `npm install -g @anthropic-ai/claude-code` +- **Claude Code and Codex CLI** via `npm install -g @anthropic-ai/claude-code @openai/codex` +- **Sandbox runtime**: bubblewrap (required by Codex CLI sandbox mode) - **Firewall tooling**: iptables, ipset, dnsmasq - **Developer experience**: zsh, git-delta, GitHub CLI, fzf @@ -119,6 +120,8 @@ The firewall uses a three-layer architecture to enforce domain-level network iso | sync-claude-settings.sh | + sync-codex-settings.sh + | init-firewall.sh | +-----------------------+-----------------------+ @@ -130,21 +133,26 @@ into ipset hash:ip for dynamic domains OUTPUT -> DROP | | | +-----------------------+-----------------------+ | - Claude Code ready + Claude Code and Codex CLI ready (network limited to allowlist) ``` -**Static domains** (e.g., `api.github.com`, `registry.npmjs.org`) have stable IPs. They are resolved once at startup and cached in an ipset. +**Static domains** (e.g., `sentry.io`, `registry.npmjs.org`) have stable IPs. They are resolved once at startup and cached in an ipset. **Dynamic domains** (e.g., `*.anthropic.com`, `proxy.golang.org`) use CDNs or rotating IPs. They are managed by dnsmasq, which re-resolves them on TTL expiry and updates the ipset automatically. -The always-on allowlist includes domains required for Claude Code to function regardless of stack: +The always-on allowlist includes domains required for Claude Code and Codex CLI to function regardless of stack: | Domain | Category | Purpose | |--------|----------|---------| -| `github.com` | static | GitHub web and git-over-HTTPS | -| `api.github.com` | static | GitHub REST API | +| `github.com` | dynamic | GitHub web and git-over-HTTPS | +| `api.github.com` | dynamic | GitHub REST API | | `*.anthropic.com` | dynamic | Anthropic API for Claude Code | +| `api.openai.com` | dynamic | OpenAI API for Codex CLI | +| `auth.openai.com` | dynamic | OpenAI auth for Codex ChatGPT login flow | +| `auth0.openai.com` | dynamic | OpenAI auth0 for Codex ChatGPT token refresh | +| `chatgpt.com` | dynamic | ChatGPT for Codex ChatGPT login auth flow | +| `accounts.openai.com` | dynamic | OpenAI accounts for Codex ChatGPT auth | | `sentry.io` | static | Error reporting for Claude Code | | `statsig.com` | static | Feature flags and experimentation for Claude Code | @@ -154,14 +162,18 @@ Each detected stack adds its own domains (package registries, module proxies, et `sync-claude-settings.sh` copies the generated `claude-user-settings.json` into `~/.claude/settings.json` inside the container. On first run it creates the file; on subsequent runs it uses jq to deep-merge new settings with existing ones, preserving any manual changes. +`sync-codex-settings.sh` copies the generated `codex-config.toml` into `~/.codex/config.toml` inside the container. On first run it creates the file; on subsequent runs it skips the copy to preserve any manual changes (copy-on-first-run strategy, unlike the Claude Code deep-merge approach). + ### devcontainer.json The generated `devcontainer.json` configures: -- **Mounts** for bash history, Claude config, GitHub CLI config, and gitconfig -- **`postStartCommand`** that chains settings sync and firewall initialization +- **containerEnv** forwards `OPENAI_API_KEY` from the host for Codex CLI authentication +- **Mounts** for bash history, Claude config, Codex config, GitHub CLI config, and gitconfig +- **`postStartCommand`** that chains settings sync (Claude Code and Codex CLI) and firewall initialization - **Capabilities**: `NET_ADMIN` and `NET_RAW` (required for iptables/ipset) - **Security**: `seccomp=unconfined` (required for iptables inside the container) +- **Extensions**: Claude Code (`anthropic.claude-code`) and Codex (`openai.chatgpt`) VS Code extensions are auto-configured ## Generated Files @@ -171,13 +183,16 @@ Running `agentbox init` creates a `.devcontainer/` directory and a `.agentbox.ym | File | Description | |------|-------------| -| `Dockerfile` | Container image with runtimes, LSPs, Claude Code, and firewall tooling | +| `Dockerfile` | Container image with runtimes, LSPs, Claude Code, Codex CLI, and firewall tooling | | `devcontainer.json` | VS Code / DevPod configuration with mounts, capabilities, and startup commands | | `init-firewall.sh` | Network isolation setup script (runs as root via `sudo`) | | `warmup-dns.sh` | Pre-resolves dynamic domains through dnsmasq after firewall init | | `dynamic-domains.conf` | Editable list of dynamic domains for dnsmasq | | `claude-user-settings.json` | Claude Code settings with bypass permissions mode and LSP plugins | | `sync-claude-settings.sh` | Copies/merges Claude Code settings into the container | +| `codex-config.toml` | Codex CLI settings with full-auto approval policy and sandbox mode | +| `sync-codex-settings.sh` | Copies Codex CLI settings into the container (first-run only) | +| `mise-config.toml` | Runtime version configuration for mise (Go, Node, etc.) | | `README.md` | Per-project documentation for the generated devcontainer | ### `.agentbox.yml` From 87bbca937a8b55e9cfbbcd2f3e60db7bc446d22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Rochel?= Date: Thu, 9 Apr 2026 09:12:53 +0000 Subject: [PATCH 2/2] chore: Update bean checklist after branch push Co-Authored-By: Claude Opus 4.6 (1M context) --- ...agentbox-31g0--update-root-readmemd-for-codex-cli-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md b/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md index ec3d88c..a4257a2 100644 --- a/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md +++ b/.beans/agentbox-31g0--update-root-readmemd-for-codex-cli-support.md @@ -24,7 +24,7 @@ The root README.md is outdated after the Codex CLI epic. Needs updates: - [x] No new TODO/FIXME/HACK/XXX comments introduced - [x] `golangci-lint run ./...` passes with no errors - [x] `go test ./...` passes with no failures -- [ ] Branch pushed to remote +- [x] Branch pushed to remote - [ ] PR created - [ ] Automated code review passed via `@review-backend` subagent (via Task tool) - [ ] Review feedback worked in via `/rework` and pushed to remote (if applicable)