بنقرة واحدة
collaborating-with-codex
// Delegate tasks to Codex CLI for prototyping, debugging, code review, and implementation. Supports multi-turn sessions via SESSION_ID.
// Delegate tasks to Codex CLI for prototyping, debugging, code review, and implementation. Supports multi-turn sessions via SESSION_ID.
Break down complex tasks into a structured plan and trackable Issue CSV, then execute autonomously. Use when a task has multiple steps, needs research before starting, requires status tracking, or benefits from a structured breakdown before execution.
Delegate tasks to Claude Code CLI for prototyping, debugging, and code review. Supports multi-turn sessions via SESSION_ID.
Delegate tasks to Gemini CLI for prototyping, debugging, code review, and web search. Supports multi-turn sessions via SESSION_ID.
| name | collaborating-with-codex |
| description | Delegate tasks to Codex CLI for prototyping, debugging, code review, and implementation. Supports multi-turn sessions via SESSION_ID. |
| metadata | {"short-description":"Delegate to Codex CLI"} |
Use Codex CLI as a collaborator while your primary agent remains the implementer.
The bridge script (scripts/codex_bridge.py) wraps codex exec (headless mode), returns structured JSON, and manages session continuity via SESSION_ID.
Codex runs in a sandbox by default. The bridge defaults to read-only:
--sandbox read-only — (default) no file writes, no destructive commands. Recommended for review/consultation.--sandbox workspace-write — can write files in the workspace only.--sandbox danger-full-access — unrestricted. Use only in externally sandboxed environments.--full-auto — convenience alias for sandboxed auto-execution (workspace-write + auto-approve).Do not use --full-auto or danger-full-access unless you understand the implications.
⚠️ Backticks in prompts trigger shell command substitution — use a heredoc. See references/shell-quoting.md.
PROMPT="$(cat <<'EOF'
Review src/auth.py around login() and propose fixes.
OUTPUT: Unified Diff Patch ONLY.
EOF
)"
python3 skills/collaborating-with-codex/scripts/codex_bridge.py \
--cd "." --PROMPT "$PROMPT"
Returns: { "success": true, "SESSION_ID": "...", "agent_messages": "..." }
Capture SESSION_ID from the first call and pass it back:
# Turn 1
python3 skills/collaborating-with-codex/scripts/codex_bridge.py \
--cd "." --PROMPT "Analyze the bug in foo()."
# Turn 2 — resume by ID
python3 skills/collaborating-with-codex/scripts/codex_bridge.py \
--cd "." --SESSION_ID "<id>" --PROMPT "Propose a fix."
# Or resume the most recent session
python3 skills/collaborating-with-codex/scripts/codex_bridge.py \
--cd "." --last --PROMPT "What about edge cases?"
| Flag | Purpose | Default |
|---|---|---|
--PROMPT | Prompt text (required) | — |
--cd | Workspace root (required) | — |
--SESSION_ID | Resume a previous session by thread ID | new session |
--last | Resume the most recent session | off |
--model | Override Codex model | CLI default |
--sandbox | read-only · workspace-write · danger-full-access | read-only |
--full-auto | Sandboxed auto-execution | off |
--image | Attach image files (repeatable) | none |
--add-dir | Additional writable directories (repeatable) | none |
--skip-git-repo-check | Allow running outside a Git repo | off |
--ephemeral | Don't persist session to disk | off |
--return-all-messages | Include all JSONL events in output | off |
Default timeout: set timeout_ms to 600000 (10 min) when invoking via an external command runner.
Use assets/prompt-template.md for quick plain-text starters. For complex tasks, use composable XML prompt blocks — see references/prompt-blocks.md.
Key principles:
<task>, add <verification_loop> for correctness, <grounding_rules> for reviews.OUTPUT: Unified Diff Patch ONLY. for code changes when using read-only sandbox.python3 skills/collaborating-with-codex/scripts/codex_bridge.py --helpsuccess: true and a SESSION_ID.Keep this block updated while collaborating:
[Codex Capsule] Goal: | SID: | Sandbox: | Files: | Last: | Next: