- Use bash background:true instead of tmux - Full programmatic control: log/poll/write/kill - Simpler, no shell escaping issues - workdir still critical for 'little box' pattern
1.8 KiB
1.8 KiB
name, description, metadata
| name | description | metadata | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| coding-agent | Run Claude Code, Codex CLI, or OpenCode via background process for programmatic control. |
|
Coding Agent (background-first)
Use bash background mode for all coding-agent CLIs. Full programmatic control, no tmux needed.
The Pattern: workdir + background
# Start agent in target directory ("little box" - only sees relevant files)
bash workdir:~/project/folder background:true command:"<agent command>"
# Returns sessionId for tracking
# Monitor progress
process action:log sessionId:XXX
# Check if done
process action:poll sessionId:XXX
# Send input (if agent asks a question)
process action:write sessionId:XXX data:"y"
# Kill if needed
process action:kill sessionId:XXX
Why workdir matters: Agent wakes up in a focused directory, doesn't wander off reading unrelated files.
Codex CLI
Model: gpt-5.2-codex — choose reasoning effort based on task:
medium— most taskshigh— complex/architectural tasks
bash workdir:~/project background:true command:"codex exec --model gpt-5.2-codex -c reasoning_effort=\"medium\" -s workspace-write \"Your task\""
Flags: -s workspace-write, --full-auto, --skip-git-repo-check
Claude Code
bash workdir:~/project background:true command:"claude \"Your task\""
OpenCode
bash workdir:~/project background:true command:"opencode run \"Your task\""
⚠️ Rules
- Respect tool choice — if user asks for Codex, use Codex. Don't offer to build it yourself!
- Be patient — don't kill sessions because they're "slow"
- Monitor with process:log — check progress without interfering