$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill coding-agentDelegate 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-li
| 1 | # Coding Agent (bash-first) |
| 2 | |
| 3 | Use **bash** (with optional background mode) for all coding agent work. Simple and effective. |
| 4 | |
| 5 | ## ⚠️ PTY Mode: Codex/Pi/OpenCode yes, Claude Code no |
| 6 | |
| 7 | For **Codex, Pi, and OpenCode**, PTY is still required (interactive terminal apps): |
| 8 | |
| 9 | ```bash |
| 10 | # ✅ Correct for Codex/Pi/OpenCode |
| 11 | bash pty:true command:"codex exec 'Your prompt'" |
| 12 | ``` |
| 13 | |
| 14 | For **Claude Code** (`claude` CLI), use `--print --permission-mode bypassPermissions` instead. |
| 15 | `--dangerously-skip-permissions` with PTY can exit after the confirmation dialog. |
| 16 | `--print` mode keeps full tool access and avoids interactive confirmation: |
| 17 | |
| 18 | ```bash |
| 19 | # ✅ Correct for Claude Code (no PTY needed) |
| 20 | cd /path/to/project && claude --permission-mode bypassPermissions --print 'Your task' |
| 21 | |
| 22 | # For background execution: use background:true on the exec tool |
| 23 | |
| 24 | # ❌ Wrong for Claude Code |
| 25 | bash pty:true command:"claude --dangerously-skip-permissions 'task'" |
| 26 | ``` |
| 27 | |
| 28 | ### Bash Tool Parameters |
| 29 | |
| 30 | | Parameter | Type | Description | |
| 31 | | ------------ | ------- | --------------------------------------------------------------------------- | |
| 32 | | `command` | string | The shell command to run | |
| 33 | | `pty` | boolean | **Use for coding agents!** Allocates a pseudo-terminal for interactive CLIs | |
| 34 | | `workdir` | string | Working directory (agent sees only this folder's context) | |
| 35 | | `background` | boolean | Run in background, returns sessionId for monitoring | |
| 36 | | `timeout` | number | Timeout in seconds (kills process on expiry) | |
| 37 | | `elevated` | boolean | Run on host instead of sandbox (if allowed) | |
| 38 | |
| 39 | ### Process Tool Actions (for background sessions) |
| 40 | |
| 41 | | Action | Description | |
| 42 | | ----------- | ---------------------------------------------------- | |
| 43 | | `list` | List all running/recent sessions | |
| 44 | | `poll` | Check if session is still running | |
| 45 | | `log` | Get session output (with optional offset/limit) | |
| 46 | | `write` | Send raw data to stdin | |
| 47 | | `submit` | Send data + newline (like typing and pressing Enter) | |
| 48 | | `send-keys` | Send key tokens or hex bytes | |
| 49 | | `paste` | Paste text (with optional bracketed mode) | |
| 50 | | `kill` | Terminate the session | |
| 51 | |
| 52 | --- |
| 53 | |
| 54 | ## Quick Start: One-Shot Tasks |
| 55 | |
| 56 | For quick prompts/chats, create a temp git repo and run: |
| 57 | |
| 58 | ```bash |
| 59 | # Quick chat (Codex needs a git repo!) |
| 60 | SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "Your prompt here" |
| 61 | |
| 62 | # Or in a real project - with PTY! |
| 63 | bash pty:true workdir:~/Projects/myproject command:"codex exec 'Add error handling to the API calls'" |
| 64 | ``` |
| 65 | |
| 66 | **Why git init?** Codex refuses to run outside a trusted git directory. Creating a temp repo solves this for scratch work. |
| 67 | |
| 68 | --- |
| 69 | |
| 70 | ## The Pattern: workdir + background + pty |
| 71 | |
| 72 | For longer tasks, use background mode with PTY: |
| 73 | |
| 74 | ```bash |
| 75 | # Start agent in target directory (with PTY!) |
| 76 | bash pty:true workdir:~/project background:true command:"codex exec --full-auto 'Build a snake game'" |
| 77 | # Returns sessionId for tracking |
| 78 | |
| 79 | # Monitor progress |
| 80 | process action:log sessionId:XXX |
| 81 | |
| 82 | # Check if done |
| 83 | process action:poll sessionId:XXX |
| 84 | |
| 85 | # Send input (if agent asks a question) |
| 86 | process action:write sessionId:XXX data:"y" |
| 87 | |
| 88 | # Submit with Enter (like typing "yes" and pressing Enter) |
| 89 | process action:submit sessionId:XXX data:"yes" |
| 90 | |
| 91 | # Kill if needed |
| 92 | process action:kill sessionId:XXX |
| 93 | ``` |
| 94 | |
| 95 | **Why workdir matters:** Agent wakes up in a focused directory, doesn't wander off reading unrelated files (like your soul.md 😅). |
| 96 | |
| 97 | --- |
| 98 | |
| 99 | ## Codex CLI |
| 100 | |
| 101 | **Model:** `gpt-5.2-codex` is the default (set in ~/.codex/config.toml) |
| 102 | |
| 103 | ### Flags |
| 104 | |
| 105 | | Flag | Effect | |
| 106 | | --------------- | -------------------------------------------------- | |
| 107 | | `exec "prompt"` | One-shot execution, exits when done | |
| 108 | | `--full-auto` | Sandboxed but auto-approves in worksp |