| name | cli-agent-driver |
| description | Orchestrate CLI coding agents (codex, grok, aider, etc.) so agents write ALL implementation code while the orchestrator plans, reviews diffs, runs tests, and commits. Use for any implementation task in a multi-agent setup. |
CLI-Agent Driver Pattern
Division of labor: the orchestrating model never writes implementation code. A CLI coding agent writes it; the orchestrator reviews the diff, runs the tests, and commits. This keeps an independent reviewer in the loop for every line, and makes model choice per-step (expensive model frames, cheap model executes).
Tool routing
- Normal implementation step → your primary coding CLI (e.g.
codex exec --sandbox workspace-write "<prompt>" < /dev/null — the < /dev/null matters: without it codex can hang waiting on stdin).
- Simple/mechanical work (deletions, renames, small fixes) → a cheaper/faster CLI (e.g.
grok --always-approve -p "<prompt>").
- Investigation (no edits) → read-only sandbox, low reasoning effort. Read-only sessions that attempt writes burn retries — match sandbox to intent.
The review gate (the orchestrator's actual job)
After every agent run, before committing:
- Read the WHOLE diff. Reject unrelated cosmetic changes — send a corrective prompt ("revert only the cosmetic reformatting"), don't hand-fix. Corrective prompts land first-try when surgical.
- Run the step's tests against a recorded baseline (capture the pre-change failure set FIRST; it must not grow).
- Grep for dangling references after any delete/rename.
- One plan-step = one commit, staged file-by-file. Never
git add ..
Failure handling
If the agent fails twice on a step: do NOT write the code yourself. Re-scope into smaller prompts (single file, exact insertion point, expected diff shape) and retry. See skill agent-prompt-doctrine for what actually changes outcomes.
Handoff report
A driver's final report contains: commit list with hashes, per-step agent-vs-review notes, baseline-vs-final test results, deviations from plan (reported, never silently absorbed), open questions.