Cron Jobs for My Agent Fleet¶
November 18, 2026
At 7:00 this morning, before I'd opened my laptop, a new tmux window showed up in my agentctl session. Brandon, my main agent, went through every open PR and issue on agentctl, flagged the stale ones and the ones with red CI, and left me a summary. Nobody typed anything. That was the first real run of agentctl cron, which I merged yesterday.
Before building it I had to answer an obvious question: why not use the schedulers Claude already ships?
Claude already has three schedulers¶
Anthropic gives you several ways to run Claude on a timer:
- Cloud scheduled tasks (routines) run on Anthropic's infrastructure against a fresh clone of your repo.
- Desktop scheduled tasks start a new local session from the Claude Desktop app on a cron schedule.
/loopandCronCreateschedule recurring prompts inside a running Claude Code session.
They're all real and they all work. I still use /loop for things like "check on this PR every ten minutes for the next hour." For the work I actually want done at 7am, though, none of them gives the agent what my laptop gives it.
The access is the whole point¶
When Brandon runs in my terminal it isn't just Claude with a repo checked out. It has my whole machine:
gh, logged in as me, for every repo and org I belong to- AWS profiles and
kubectlcontexts, including my homelab k3s cluster - My Obsidian vault and the Lincoln Loop journal, which is where client context lives
- The agentctl context store, where agents leave notes for each other
- Every other agent session on the machine, reachable with
SendMessage - Local tools I've built up over years:
hrvstfor Harvest,icalfor my calendar, Home Assistant, the UniFi box, local models through Ollama - My
~/.claudeconfig: agent definitions, skills, hooks,CLAUDE.mdrules
A cloud routine gets almost none of that. It's a clean sandbox with a git clone. That's the right call for Anthropic, and for a lot of people it's exactly what they want. But "triage my issues and check what my other agents are stuck on" doesn't mean much in a box that can't see my other agents. Nor does "pull this week's Harvest entries and compare them to my calendar." Those jobs are only useful because the agent can reach everything I can.
Desktop tasks do run locally, which gets you closer. But they run in the Desktop app, apart from everything else I use. The session doesn't show up in my tmux fleet, the agentctl hub, or the phone app I use to approve prompts when I'm away from my desk. It doesn't get a worktree per run through my dispatch pipeline, or done detection, or an auto-opened PR, or the push notification when it gets stuck. Every agent I run lives in one place. A scheduled one that lives somewhere else is one I'll forget to check.
/loop is local and in the fleet, but it's tied to a session and expires after seven days. Restart the session, or the laptop, and the schedule is gone.
So I wrote down the gap in the design doc:
| | /loop | Desktop tasks | Cloud tasks | agentctl cron |
|---|---|---|---|---|
| Survives restarts | no, 7-day expiry | yes | yes | yes |
| My files, CLIs and logins | yes | yes | no, fresh clone | yes |
| Visible in tmux / hub / phone | that session only | no | no | yes |
| Worktree per run, done detection, PR | no | worktree checkbox | n/a | yes, via dispatch |
What was missing was local scheduling that lasts, and that starts agents the same way I do by hand.
What I built¶
A job is an entry in ~/.config/agentctl/schedules.json:
agentctl cron add nightly-triage \
--schedule '0 7 * * 1-5' \
--agent brandon \
--dir ~/code/personal/agentctl \
--no-worktree \
--prompt 'List open PRs and issues, flag anything stale or red in CI, and summarize.'
agentctl cron install drops one launchd plist that runs agentctl cron tick every 60 seconds. The tick is short-lived and holds a file lock. For each job it works out whether a fire is due (schedules are parsed with robfig/cron, in local time), checks the throttles, and launches.
The launch step is the important part: it doesn't start Claude any differently. A cron fire goes through the same code path as agentctl dispatch --prompt. That means an interactive claude in a tmux window, under my own login, with the agent's definition, hooks, worktree and account. If the project's tmux session isn't running, the tick starts it detached first. The window is tagged scheduled_by: nightly-triage, so I can tell it apart from the ones I started.
Because it's an ordinary agentctl window, everything else comes for free. It shows up in the hub with a state glyph. If it hits a permission prompt it goes blocked and my phone buzzes. When it finishes, done detection picks that up, and if it changed code, a PR opens.
agentctl cron list shows what's coming up:
Throttles: min_interval 15m · max_concurrent 2 (0 active) · catchup_window 6h · usage gate 5h ≥ 80%, 7d ≥ 90%
Usage (personal): now 5h 7%, 7d 9%, updated now
NAME SCHEDULE NEXT LAST ENABLED AGENT ACCOUNT
nightly-triage 0 7 * * 1-5 21 hours from now (Thu 19 Nov 07:00) fired 2 hours ago yes brandon personal
Laptops sleep¶
A server cron can assume the machine is on. A laptop cron can't. The lid is closed at 7am about half the time. So there are a few rules for that:
- Catch-up. If the laptop wakes up within six hours of a missed fire, the job runs once for the most recent one. It doesn't replay every hourly fire from a night with the lid shut.
- No double fires.
last_fireis saved before the launch, so a crash mid-tick can't fire a job twice. Two ticks racing each other just fight over the lock. - Overlap. If yesterday's run is still alive and not done, today's is skipped.
- Jitter. Each job gets a fixed 0–90 second offset from a hash of its name, so five jobs at
0 * * * *don't all hit the API in the same second.
Every decision (fired, skipped because of overlap, skipped because of usage, too late to catch up, failed) goes into runs.ndjson, and agentctl cron runs shows the history. agentctl health tells me whether the ticker is loaded, how long ago it last ticked, and whether a job has failed several times in a row.
Giving an agent this much access, on a timer¶
The same access that makes this useful is what makes it a little scary. A cloud sandbox has a limited blast radius. A cron job running as me on my laptop doesn't. So most of the work went into deciding who gets to create a schedule.
Creating a schedule is the approval. One cron add authorizes unlimited future runs that nobody is watching. So when an agent runs agentctl cron add, cron resume or cron run --force, the PreToolUse hook stops it and shows me the same preview popup I get for dispatches: the schedule in words with its next fire time, the agent, the directory, the account, and the full prompt. I can approve it there or from my phone. It fails closed: if the prompt comes from shell expansion, an unreadable file or an unset context key, it gets denied, since I can't approve what I can't see. When I type cron add myself in a shell, there's no popup.
Agents can't edit the schedule file directly. Without this the popup would be pointless, because an agent could just write the JSON. The Bash validator and the Write/Edit hooks both refuse to touch schedules.json or the cron state directory.
Schedules are global only. A .agentctl/ directory inside a repo can't define a cron job. Otherwise cloning a hostile repo could install a recurring autonomous job on my machine. agentctl already treats hooks and notification commands the same way.
Throttles are on by default. Fifteen minutes is the minimum interval, two jobs can run at once, and a job is skipped when my 5-hour or 7-day usage is already high. That matters for the next part.
Is this even allowed?¶
I checked before writing any code, because "run Claude from a script on a subscription" sounds like something the terms might not allow. The consumer terms prohibit automated access "except when you are accessing our Services via an Anthropic API Key or where we otherwise explicitly permit it." Anthropic does explicitly permit it: claude -p is documented for scripts and CI, and Anthropic ships scheduled tasks of its own.
What isn't allowed is touching credentials: reading Claude's OAuth tokens, passing them to another tool, or running requests for other people on your login. So agentctl cron never reads ~/.claude/.credentials.json or the keychain. It runs the unmodified claude binary under my own login, the same way I would. Each job also has an account, so personal jobs run on my personal Max plan and not on the Lincoln Loop Team seat. The usage throttles are there because the terms also say the plan limits assume "ordinary, individual usage." Dozens of Opus agents running around the clock is the pattern that gets flagged, even if the letter of the terms allows it.
What's next¶
This is step one: Claude only, window mode. Next comes a headless mode for small report jobs that don't need a window (claude -p, with the result as the push notification). After that, jobs on the other harnesses agentctl now supports, and a schedules screen on the phone app.
The whole reason this exists is that the agent running at 7am should be the same one I'd run at 10am, with everything my laptop can reach. The schedulers Claude ships are fine for work that fits in a sandbox. Most of mine doesn't.
agentctl is on GitHub. The design doc is at docs/design/cron.md.