Chapter 6: The agent

All of that assumed you were at the keyboard. Take yourself away and the harness is all that is left.

Headless mode

Also called Print mode, Non-interactive mode

Running an agent with nobody at the keyboard: one command, one prompt, and output a script can read. It is how an agent runs on a schedule, or in continuous integration, the automatic checks on a server that chapter 9 covers.

There is no one to answer a prompt, so whatever would have asked must be decided in advance. Allow too little and the run achieves nothing. Allow too much and nothing is watching. And never trust its final message: have the script run the checks itself.

Say it to your agent

“In CI run: claude -p "Fix the lint errors in src/" --allowedTools "Read,Edit,Bash(bun run lint)" --max-budget-usd 2 --output-format json. Then have the job run bun run lint itself and fail on a non-zero exit, whatever the agent said.”

The workshop

Name a word, or describe what you mean in everyday language.