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
- Building new features or apps (
--full-auto/--yolo) - PR reviews (always in temp dir or git worktree — never the live project)
- Large refactors
- Parallel issue fixing (one agent per
git worktree)
Not for: simple one-liner edits, read-only code exploration, ACP-runtime chat threads, or any work inside ~/.openclaw.
Codex specifics
- Requires a git repo; use
mktemp -d && git initfor scratch work. --full-auto: sandboxed, auto-approves writes.--yolo: no sandbox, no approvals (fastest, riskiest).- Default model:
gpt-5.2-codex(via~/.codex/config.toml).
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
- Right mode per agent (PTY for Codex/Pi/OpenCode;
--printfor Claude Code). - Respect user's tool choice — don't silently substitute a different agent or hand-code the patch.
- Patient monitoring — don't kill slow sessions.
- Never spawn agents in
~/.openclaw($OPENCLAW_STATE_DIR). - Never checkout branches in
~/Projects/openclaw/(live instance). - Communicate: one message at spawn; next only at milestone, question, error, or completion.
Cross-references
- Source - Coding Agent Skill (OpenClaw)
- Agent Loop (OpenClaw) — the loop the orchestrating agent runs in
- Background Tasks — ledger that tracks spawned agent runs
- Heartbeat — periodic wake that coding agent completion events can bypass
- Automation & Tasks (OpenClaw) — broader automation decision guide
- Session Tool — alternative for spawning agents in ACP/chat-thread context