Run background coding agents, but only one build at a time — Tips
AutomationClaude CodeBackground agentsMac mini

Run background coding agents, but only one build at a time

Queue unattended jobs on an always-on machine and serialise the expensive part so the assistant stays responsive.

If you have an always-on machine, the biggest unlock is letting coding agents run while you are not looking. The second biggest unlock is stopping them from fighting each other.

The setup

  • Each job gets its own git worktree and its own branch, named after the task. Nothing touches main.
  • Jobs report back with a short summary, the branch name, and screenshots. I read the report first and the diff only if the report is vague.
  • Builds are the expensive part. A tiny shell shim wraps xcodebuild and swift build in a global lock at the lowest priority, so two jobs never compile at once and the interactive assistant never lags.

Why the lock matters

Three agents building in parallel will make the machine unusable for the one thing you actually want it for: answering you. Serialising builds costs wall-clock time on the jobs, which you are not waiting on anyway, and buys responsiveness, which you are.

# ~/bin/xcodebuild — the whole trick
exec flock /tmp/build.lock nice -n 19 /usr/bin/xcodebuild "$@"

Treat the machine like a workshop with one lathe. Everyone can plan at once. One person cuts.

Sep 8, 2026 128