Coding Agent (OpenClaw)

Coding Agent (OpenClaw)

The coding-agent skill is OpenClaw's orchestration layer for delegating coding work to external CLI agents. OpenClaw acts as the orchestrator — spawning, monitoring, and communicating with agents — never patching code itself in this mode.

Supported agents

Agent Package PTY? Invocation
Codex @openai/codex yes codex exec --full-auto 'task'
Claude Code @anthropic-ai/claude-code no claude --permission-mode bypassPermissions --print 'task'
Pi @mariozechner/pi-coding-agent yes pi 'task' or pi -p 'task'
OpenCode opencode yes opencode run 'task'

Why Claude Code differs: --print mode keeps full tool access without interactive prompts; PTY + --dangerously-skip-permissions exits after the confirmation dialog, making it unreliable.

Execution pattern

All work goes through the bash tool:

# Foreground (Codex)
bash pty:true workdir:~/project command:"codex exec --full-auto 'task'"

# Background (returns sessionId)
bash pty:true workdir:~/project background:true command:"codex --yolo 'task'"

# Claude Code (no PTY)
bash workdir:~/project background:true command:"claude --permission-mode bypassPermissions --print 'task'"

workdir scopes the agent to a specific directory so it doesn't explore unrelated files.

Monitoring background sessions

Use the process tool:

process action:log sessionId:XXX     # read output
process action:poll sessionId:XXX    # check if still running
process action:submit sessionId:XXX data:"yes"  # respond to prompts
process action:kill sessionId:XXX    # terminate

When to use

Not for: simple one-liner edits, read-only code exploration, ACP-runtime chat threads, or any work inside ~/.openclaw.

Codex specifics

PR review workflow

git worktree add /tmp/pr-130 pr-130-branch
bash pty:true workdir:/tmp/pr-130 command:"codex review --base main"
# Clean up:
git worktree remove /tmp/pr-130

Batch reviews: launch one agent per PR with background:true, collect results, post via gh pr comment.

Auto-notify on completion

Append to any long-running agent prompt to get an immediate wake event (bypasses the 30-minute Heartbeat cycle):

When completely finished, run:
openclaw system event --text "Done: [summary]" --mode now

Rules

  1. Right mode per agent (PTY for Codex/Pi/OpenCode; --print for Claude Code).
  2. Respect user's tool choice — don't silently substitute a different agent or hand-code the patch.
  3. Patient monitoring — don't kill slow sessions.
  4. Never spawn agents in ~/.openclaw ($OPENCLAW_STATE_DIR).
  5. Never checkout branches in ~/Projects/openclaw/ (live instance).
  6. Communicate: one message at spawn; next only at milestone, question, error, or completion.

Cross-references