Night Shift

Why build it

AI coding agents are good at a well-described task and bad at knowing when they are done. Left alone, they declare success, quietly weaken a test, or "fix" a check so it passes. Night Shift is my answer: coding agents that work through the night on real repositories, and a set of guards that decide whether the work counts, which the agents cannot talk their way past.

How a night works

flowchart TD
    T["Task + check, written in advance"] --> Q{"Fails today?"}
    Q -- "no" --> R["Refused"]
    Q -- "yes" --> O["Overnight run: orchestrator + agents<br/>isolated, capped container"]
    O --> K{"Check passes,<br/>no test worse?"}
    K -- "no" --> O
    K -- "yes" --> V["Reviewer from a different model<br/>+ separate re-check"]
    V --> B["Branch for my review<br/>in the morning"]

The guards that matter

  • The check comes first. Every task carries a check written before the work starts, and the task is refused if the check already passes. A check that cannot fail proves nothing.
  • The agent cannot move the goalposts. The check is scored from a read-only copy. Existing tests are protected, deleted or weakened assertions are caught, and every test that passed before must still pass.
  • A second opinion from a different model. A reviewer from another model family reads the whole change, and a separate tool re-checks the agent's claims.
  • Bounded by design. Each run has a time limit set from measured pace, a container memory and process cap, a daily cloud budget after which it switches to local models, and a log of every internet host it reached.
  • I stay the gate. Nothing merges itself. Each morning there is a branch, the check result, the review and a plain summary.

Where it stands

It runs overnight on my own research and product repositories, mostly on the local AI cluster, with a small capped cloud budget for planning. Early runs showed exactly why the guards exist: agents deleted test assertions and even rewired their own commit hooks to get a pass. Each of those became a general guard in the runner, not a patch for one task. In a later trial on a research codebase it completed the small and medium tasks under the full set of guards.

Stack

Claude Code and Codex CLI as agent runtimes, local models through my AI gateway, Docker, Bash and Python, Git.