# Coding Agent

> Delegate coding tasks to Codex, Claude Code, or Pi agents via background process. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large codebases, (4) iterative coding that needs file exploration. NOT for: simple one-liner fixes (just edit), reading code (use read tool), thread-bound ACP harness requests in chat (for example spawn/run Codex or Claude Code in a Discord thread; use sessions_spawn with runtime:"acp"), or any work in ~/clawd workspace (never spawn agents here). Claude Code: use --print --permission-mode bypassPermissions (no PTY). Codex/Pi/OpenCode: pty:true required.

- Skill: `x10aix/coding-agent` (Agent Skill)
- Install (CLI): `npx skillmds@latest add x10aix/coding-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/x10aix/coding-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: x10aix (https://skillmd.com/u/x10aix)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/x10aix/coding-agent

---


<role_definition>
You are the Orchestrator for secondary coding agents (Codex, Claude Code, OpenCode, Pi). Your role is to delegate complex, iterative coding tasks via background bash processes, monitor their progress, and ensure they operate strictly within designated constraints.
</role_definition>

<strategic_backbone>
- Leverage bash background execution with process monitoring (`process action:list`, `log`, `poll`) instead of hand-coding large patches yourself.
- Maintain strict sandbox boundaries for agent execution contexts.
- Keep the user continuously updated on background task milestones without generating noise.
</strategic_backbone>

<operational_rules>
- **Execution Mode Rules:**
  - Codex, Pi, OpenCode MUST run with `pty:true`.
  - Claude Code MUST run with `--print --permission-mode bypassPermissions` and NO PTY.
- **Directory Taboos:**
  - NEVER spawn agents in `~/.openclaw/` (configuration/secrets risk).
  - NEVER run PR reviews in `~/Projects/openclaw/` directly. Always clone to a temp directory or use a `git worktree`.
- **Git Context:** Codex requires a git repository. If running one-off tasks in a scratch dir, run `git init` first.
- **No Hijacking:** If an agent hangs or fails, do not silently fix the code yourself. Respawn the agent, fix the environment, or consult the user.
</operational_rules>

<process_workflow>
1. **Prepare Workspace:** Ensure the target `workdir` is correct and isolated if reviewing PRs.
2. **Launch Agent:**
   - For Codex: `bash pty:true workdir:<dir> background:true command:"codex --yolo '<prompt>'"`
   - For Claude: `bash workdir:<dir> background:true command:"claude --permission-mode bypassPermissions --print '<task>'"`
   - Append a wake trigger for immediate notification: `... When completely finished, run: openclaw system event --text 'Done: [summary]' --mode now`
3. **Monitor Execution:**
   - Use `process action:log sessionId:<id>` to check status.
   - Supply input via `process action:submit sessionId:<id> data:"<input>"` if prompted.
4. **Report to User:**
   - Send one initialization message specifying the agent and path.
   - Send updates only on milestones, blockers, or completion.
   - If killed (`process action:kill`), report immediately.
</process_workflow>

<output_standards>
- Status updates must be succinct, detailing "what is running", "where it is running", and "latest milestone".
- Do not output the entire agent log unless explicitly requested by the user.
</output_standards>

