skills/coding-agent/SKILL.md
Use bash with background:true for all coding-agent work.
Do not use a foreground one-shot path here.
Start the agent, get the sessionId, monitor with process, and require the worker to notify the user directly when it finishes.
For Codex, Pi, and OpenCode, PTY is required:
# Correct for Codex/Pi/OpenCode
bash pty:true background:true command:"codex exec 'Your prompt'"
For Claude Code (claude CLI), use --print --permission-mode bypassPermissions instead.
Do not use PTY for Claude Code here.
# Correct for Claude Code
bash background:true command:"claude --permission-mode bypassPermissions --print 'Your task'"
# Wrong for Claude Code (PTY, wrong flags, no background)
bash pty:true command:"claude --dangerously-skip-permissions 'task'"
| Parameter | Type | Description |
|---|---|---|
command | string | The shell command to run |
pty | boolean | Use for Codex/Pi/OpenCode |
workdir | string | Working directory |
background | boolean | Always true for this skill |
timeout | number | Timeout in seconds |
elevated | boolean | Run on host instead of sandbox (if allowed) |
| Action | Description |
|---|---|
list | List all running/recent sessions |
poll | Check if session is still running |
log | Get session output (with optional offset/limit) |
write | Send raw data to stdin |
submit | Send data + newline (like typing and pressing Enter) |
send-keys | Send key tokens or hex bytes |
paste | Paste text (with optional bracketed mode) |
kill | Terminate the session |
Every coding-agent run follows this pattern:
notifyChannelnotifyTargetnotifyAccount (if applicable)notifyReplyTo (if replying to a specific message is desired)notifyThreadId (Telegram topic / Slack thread when applicable)background:true immediately.openclaw message send on completion.process action:log / poll.If you do not have a trustworthy notification route, say so and do not claim that completion will notify the user automatically.
Do not rely on:
openclaw system eventtools.exec.notifyOnExitHEARTBEAT.mdUse a direct outbound completion message instead:
openclaw message send --channel <channel> --target '<target>' --message '<text>'
Add optional routing flags only when they are real and applicable:
--account <id>--reply-to <messageId>--thread-id <threadId>openclaw message send is a direct outbound send. It does not depend on heartbeat being enabled.
Append something like this to every worker prompt:
Notification route for completion:
- channel: <notifyChannel>
- target: <notifyTarget>
- account: <notifyAccount or omit>
- reply_to: <notifyReplyTo or omit>
- thread_id: <notifyThreadId or omit>
When the task is completely finished, send exactly one completion message back to the user with openclaw message send using that route.
If the task fails fatally, send exactly one failure message back to the user with openclaw message send using that route.
Do not use openclaw system event. Do not rely on heartbeat. Do not skip the completion/failure message.
openclaw message send \
--channel <notifyChannel> \
--target '<notifyTarget>' \
--message 'Done: <brief summary>'
Optional additions:
--account <notifyAccount> \
--reply-to <notifyReplyTo> \
--thread-id <notifyThreadId>
For scratch Codex work, create a temp git repo first, then start the worker in the background with the completion route injected into the prompt:
SCRATCH=$(mktemp -d)
cd "$SCRATCH" && git init
bash pty:true workdir:$SCRATCH background:true command:"codex exec 'Your prompt here.
Notification route for completion:
- channel: <notifyChannel>
- target: <notifyTarget>
- account: <notifyAccount or omit>
- reply_to: <notifyReplyTo or omit>
- thread_id: <notifyThreadId or omit>
When the task is completely finished, send exactly one completion message back to the user with openclaw message send using that route.
If the task fails fatally, send exactly one failure message back to the user with openclaw message send using that route.
Do not use openclaw system event. Do not rely on heartbeat. Do not skip the completion/failure message.'"
Codex refuses to run outside a trusted git directory. Reuse this same notify-route injection block in every example below; only the task-specific prompt body should change.
Model: gpt-5.2-codex is the default (set in ~/.codex/config.toml)
| Flag | Effect |
|---|---|
exec "prompt" | One-shot execution inside the worker CLI |
--full-auto | Sandboxed but auto-approves in workspace |
--yolo | No sandbox, no approvals |
# Always background immediately
bash pty:true workdir:~/project background:true command:"codex exec --full-auto 'Build a dark mode toggle'"
# More autonomy
bash pty:true workdir:~/project background:true command:"codex --yolo 'Refactor the auth module'"
Never review PRs in OpenClaw's own project folder. Clone to a temp folder or use a worktree.
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130
bash pty:true workdir:$REVIEW_DIR background:true command:"codex review --base origin/main"
Or:
git worktree add /tmp/pr-130-review pr-130-branch
bash pty:true workdir:/tmp/pr-130-review background:true command:"codex review --base main"
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #86. git diff origin/main...origin/pr/86'"
bash pty:true workdir:~/project background:true command:"codex exec 'Review PR #87. git diff origin/main...origin/pr/87'"
process action:list
process action:log sessionId:XXX
bash workdir:~/project background:true command:"claude --permission-mode bypassPermissions --print 'Your task'"
bash pty:true workdir:~/project background:true command:"opencode run 'Your task'"
# Install: npm install -g @mariozechner/pi-coding-agent
bash pty:true workdir:~/project background:true command:"pi 'Your task'"
# Non-interactive mode
bash pty:true workdir:~/project background:true command:"pi -p 'Summarize src/'"
# Different provider/model
bash pty:true workdir:~/project background:true command:"pi --provider openai --model gpt-4o-mini -p 'Your task'"
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main
bash pty:true workdir:/tmp/issue-78 background:true command:"pnpm install && codex --yolo 'Fix issue #78: <description>. Commit and push after review. Send the completion message with openclaw message send using the provided notify route.'"
bash pty:true workdir:/tmp/issue-99 background:true command:"pnpm install && codex --yolo 'Fix issue #99 from the approved ticket summary. Implement only the in-scope edits. Send the completion message with openclaw message send using the provided notify route.'"
process action:list
process action:log sessionId:XXX
pty:true--print --permission-mode bypassPermissions (no PTY required)$OPENCLAW_STATE_DIR, default ~/.openclaw) - it'll read your soul docs and get weird ideas about the org chart!When you spawn a coding agent in the background, keep the user in the loop.
openclaw message send, say that clearly in your start update.This prevents the user from seeing only a missing reply and having no idea what happened.
background:true for every coding-agent launch.pty:true--print --permission-mode bypassPermissionsopenclaw message send.openclaw system event or heartbeat.process.
process action:log is the default low-friction check.~/.openclaw/.~/Projects/openclaw/.exec under background orchestration: short and long tasks follow the same path now.submit vs write: use submit to send input plus Enter.