--- name: coding-agent description: Run Claude Code, Codex CLI, or OpenCode via tmux for resilient coding sessions. metadata: {"clawdis":{"emoji":"🧩","requires":{"bins":["tmux"],"anyBins":["claude","codex","opencode"]}}} --- # Coding Agent (tmux-first) Use **tmux** for all coding-agent CLIs. Keep sessions resumable and logs visible. ## Quick preflight ```bash command -v claude codex opencode tmux ``` If none of `claude`, `codex`, `opencode` exist, stop and ask to install. ## tmux baseline ```bash # Create or attach tmux new -A -s coding-agent # Split panes tmux split-window -h tmux split-window -v # Leave running, detach tmux detach ``` ## Claude Code Interactive (preferred in tmux): - `claude` — start session - `claude -c` — continue most recent - `claude -r ""` — picker - `claude -r ` — resume specific ## Codex CLI ⚠️ **Model-specific settings required!** | Model | Config Needed | |-------|---------------| | `gpt-4o` | Works with defaults | | `gpt-5.2-codex` | Requires `-c reasoning_effort="medium"` (NOT low/high!) | | `o3` | ❌ Not available with ChatGPT accounts | **One-shot with tmux (recommended):** ```bash # IMPORTANT: Use bash workdir param to start in the target folder! # This way Codex "wakes up in a little box" - only sees relevant files # Default model (gpt-4o) bash workdir:~/project/folder command:"tmux new -d -s codex-task 'codex exec \"Your task\"'" # gpt-5.2-codex (MUST use medium reasoning) bash workdir:~/project/folder command:"tmux new -d -s codex-task 'codex exec --model gpt-5.2-codex -c reasoning_effort=\"medium\" \"Your task\"'" # Full auto mode (sandboxed, auto-approve) bash workdir:~/project/folder command:"tmux new -d -s codex-task 'codex exec --full-auto \"Your task\"'" # Monitor progress tmux capture-pane -t codex-task -p | tail -20 ``` **Interactive:** - `codex "Your prompt"` - `codex resume` - `codex resume --last` - `codex resume --session ` **Apply changes:** - `codex apply` **Useful flags:** - `-s workspace-write` — Allow writing to workspace - `--full-auto` — Sandboxed + auto-approve - `-C ` — Set working directory - `--skip-git-repo-check` — Run outside git repos ## OpenCode One-shot: - `opencode run "Write a Python function that ..."` - `opencode run -m anthropic/claude-sonnet-4-5 "Complex task"` - `opencode run -m openai/gpt-5.2 "Coding task"` - `opencode run -m google/gemini-2.5-pro "Research task"` Interactive: - `opencode` - `opencode -c` - `opencode -s ` Session management: - `opencode session list` - `opencode export [sessionID]` - `opencode import ` ## Notes - **Always prefer tmux** — keeps history, survives disconnects, allows monitoring - For auth: `claude`, `codex login`, `opencode auth` - Check tmux session: `tmux attach -t ` - List sessions: `tmux list-sessions` ## ⚠️ IMPORTANT: Respect Tool Choice! **If user asks for Codex/Claude Code/OpenCode → USE THAT TOOL!** - NEVER offer to "just build it yourself" instead - NEVER kill a running session because it's "too slow" - Let the tool complete its work — be patient! - The user wants to test/use that specific tool for a reason