How to schedule Claude Code
Claude Code stops being a tool you invoke and starts being a teammate the moment it runs on a schedule. Here are the two ways to set that up, how to write a prompt that survives running unattended, and a worked example you can copy.
Two ways to schedule Claude Code
There are two solid paths, and they suit different jobs:
- Cloud routines via
/schedule. Claude Code can create recurring cloud agents that run on a cron cadence on Anthropic infrastructure. Your machine can be off; results are waiting when you look. - Local scheduling via headless mode. Your system scheduler (cron, launchd, Task Scheduler) invokes
claude -p "your prompt"on a timer. Everything stays on your machine, but the machine has to be awake.
Default to cloud routines for anything that should survive your laptop lid closing; use local scheduling when the job needs your local environment.
Scheduling with /schedule
Inside Claude Code, run /schedule, describe the job in plain language, and pick a cadence: daily, weekly, or a cron expression. That creates a routine, a scheduled cloud agent that runs your prompt on the cadence you chose. You can list, update, pause, or delete routines the same way.
Because routines run unattended, treat the prompt as a spec: say exactly what to produce, where to put it, and when to stop.
Writing a prompt that survives a schedule
A prompt that works fine interactively often fails on a schedule because nobody is there to clarify. Make it:
- Self-contained: include every path, URL, and constraint the agent needs.
- Verifiable: give it a definition of done it can check itself, like a passing test suite.
- Reviewable: have it produce an artifact (a branch, report, or digest) rather than shipping changes directly.
- Repeat-safe: running it twice should not double anything up.
The local cron alternative
For jobs tied to your machine, wrap Claude Code headless mode in your system scheduler: claude -p "summarize new errors in ./logs and append to triage.md" on a nightly cron. It is simple and local, with the obvious tradeoffs: your machine must be on, and you own the logging and failure handling a cloud routine gives you for free. See cron job ideas for jobs worth the wiring.
A worked example: /tfg-schedule
The cleanest set-and-forget example we know is Tokens for Good. Run /tfg-schedule once and it wires up a recurring routine in one step: on each run, your agent claims a queued nonprofit, researches it against a fixed methodology with citations, and submits a structured report toward the public directory. It runs on Anthropic cloud on your existing subscription with no separate API cost, so the schedule keeps giving whether or not you remember it exists.
Cadence and review habits
Match the cadence to how fast the input changes: daily suits digests and triage, weekly suits sweeps and reports. Then actually read the output for the first few runs; a schedule multiplies whatever the prompt does, good or bad. Once you trust it, browse more scheduled task ideas and overnight jobs worth adding.
Frequently asked questions
Can Claude Code run tasks on a schedule?
Does my computer need to stay on for scheduled Claude Code tasks?
What is /tfg-schedule?
Do scheduled Claude Code runs cost extra?
Schedule something worth running
One /tfg-schedule sets up a recurring agent that vets nonprofits with your spare capacity, even while your machine is off.
Set it up in about a minute