DEV Community

Cover image for I gave my AI coding agents a night shift
nestor quiroga
nestor quiroga

Posted on

I gave my AI coding agents a night shift

I use Claude Code and Codex every day. And I kept running into the same want: hand the agent a task at night — bump dependencies, keep the changelog current, fix the flaky test — and just review it in the morning over coffee.

You can already schedule the agents. The catch is where they run.

Scheduling a prompt isn't the hard part

Every scheduler I tried runs the agent on your working directory. That's fine at 2pm when you're watching. It's not fine at 3am when you're asleep: if the agent gets something wrong, it gets it wrong on your code, on the branch you'll open tomorrow.

I didn't want "an agent that runs unattended." I wanted "an agent whose overnight work is isolated and reviewable."

The idea: a worktree per run, and a morning inbox

So I built a small VS Code extension called TaskKeeper. Each scheduled run happens inside a fresh Git worktree created from the exact base commit. The agent works on a throwaway copy; your checkout is never touched. When it finishes, the result lands in a review inbox: the diff, the files it changed, what it cost, and two buttons — accept (a local merge, never a push) or discard (worktree and branch gone, nothing left behind).

A task runs overnight in an isolated worktree, then waits in the morning inbox — accept or discard

The whole bet is that one line: if it gets it wrong at 3am, it gets it wrong on a copy — and you decide in the morning.

What a finished run looks like

You don't get a wall of JSON. You get a readable transcript with a summary header — cost, turns, files changed, which worktree — and the actions right there.

The morning inbox: a finished run with a readable transcript and accept/reject

Accept merges into your branch locally. Reject deletes the worktree and its branch. Either way, nothing ever leaves your machine on its own.

Creating a task starts from intent

A task is really two independent choices: which conversation (new / resume / fork) and where it works (isolated worktree, or directly in the repo). Instead of making you think about that, the panel opens on the intent — in a conversation or isolated task in a repo — and fills in the rest. There's a small catalog of templates (bump dependencies, write the changelog, lint sweep, fix failing tests) to start from.

Creating a task: templates, the two intents, repository and agent

It runs with VS Code closed

There's no daemon of mine sitting in your tray. Each task is one entry in the operating system's own scheduler — Windows Task Scheduler or macOS launchd. At the scheduled time a short-lived worker starts, takes a machine-wide slot, creates the worktree, launches the agent, and records everything in a local SQLite database. The extension only reads that database. If your machine is on, the task runs; on Windows it can even wake the machine.

Keeping it safe

Two things I wasn't willing to hand-wave:

  • Permission profiles per run. Every run gets one of two explicit profiles — audit (read-only) or isolated changes — applied through a controlled settings profile that your personal Claude config can't widen. A read-only task stays read-only even if your interactive setup is permissive.
  • Local-first. No telemetry, no account, no network call from the extension itself. Secrets that look like tokens are redacted from stored logs.

Catching the failure schedulers hide

The scary failure mode of any scheduler isn't a task that errors — you see those. It's a task that silently stops running because its OS trigger got unregistered. So there's a Last night digest: what ran while you were away, and a health check that turns a task red if its trigger went missing, instead of it quietly never running again.

The Last night digest with scheduler health, flagging a missing trigger

Watching the spend

Overnight agents cost money, so there's a monthly cap the runner itself enforces — once the month hits the cap, the next task is skipped before it spends. A panel breaks the month down by day and by task.

The Spend panel: month vs. cap, by day and by task

(Cost is reported by Claude; Codex doesn't report it, and the panel says so.)

Three things I actually run it for

  • Dependencies: weekly, bump to latest compatible and run the tests. I review the diff, I don't babysit the upgrade.
  • Changelog: read-only, summarise the week's commits into a draft entry.
  • Flaky tests: overnight, find the failing test and make it pass without changing intent — then I decide if the fix is real.

Try it

It's free, local-first, no account. Windows and macOS (the macOS binaries are signed).

Not affiliated with Anthropic or OpenAI — it launches the same CLIs you already use.

I'm most interested in how other people handle unattended agent runs: worktrees, containers, throwaway branches, something else? What's held up for you?

Top comments (0)