Scheduled agent tasks in Claude Code, Codex, Cursor, Grok
By Flavio
A scheduled agent task reruns a saved prompt on a clock or an event, without you in the chat. How Claude Code, Codex, Cursor, and Grok set that up.
A scheduled agent task runs a prompt you saved, on a clock or on an event, without you typing the next message. The prompt is the job. The trigger decides when a new run starts.
It is not goal mode. A goal keeps one session going until a condition holds. A schedule starts a run because the clock or an event said so, even if the last run already finished. Cloud agents are one place those runs can execute. A schedule can also be local, inside a session you still have open.
How a scheduled task works
You write the prompt once. You attach a trigger. A clock trigger is an interval or a cron time. An event trigger is something outside the chat: a GitHub event, a webhook, a message in a connected app. When the trigger fires, the agent starts a turn with that saved prompt. It uses the permissions of that run, not a fresh approval you type in the moment.
The prompt is stored ahead of time. It cannot act as a live “yes” during the run. If the job needs a decision you have not already allowed, the run waits or skips it, depending on the tool.
Three shapes show up across the tools. A cloud run can fire while your laptop is closed, and it works on a fresh clone. A desktop run uses your machine and your local files, so the machine has to be on. An in-session loop only fires while that session is open.
Scheduled tasks in each tool
All four can repeat a prompt. The durable ones are cloud or desktop products. /loop is the in-session version, and it dies with the session unless the tool restores it.
| Claude Code | Codex | Cursor | Grok | |
|---|---|---|---|---|
| In-session repeat | /loop |
Not documented as /loop |
/loop runs a prompt or skill on an interval |
/loop in Grok Build |
| Survives a closed laptop | Cloud scheduled tasks | Web tasks, yes. Local desktop tasks, no | Cloud Automations | Grok Bot routines |
| Event trigger | Cloud tasks: API and GitHub, and they can combine with a schedule | Web and mobile only. Not combined with a clock on the same task | GitHub, GitLab, Slack, webhooks, Linear, Sentry, PagerDuty, Bitbucket Cloud | Grok Bot: Slack, GitHub, Linear, Sentry, PagerDuty, email, webhook |
| Minimum interval the docs state | Cloud 1 hour. /loop 1 minute |
Not copied here. See the automations page | Not stated as a floor. Scheduled runs may start late, not early | Grok Build /loop: 60 seconds |
Claude Code
Claude Code documents three schedulers on one comparison page.
Cloud scheduled tasks, formerly routines, run on Anthropic-managed infrastructure, or on your organization’s self-hosted environment when they are routed there. The laptop can be off. There is no open session. Each repo is cloned at the start of the run. Connectors are chosen per task. Auto mode is the default. The shortest interval is one hour. A task can also fire from an HTTP POST with a bearer token, or from a GitHub event, and a task does not have to have a schedule. Plans are Pro, Max, Ultra, Team, and Enterprise. You manage them at claude.ai/code/routines or with /schedule in the CLI. The old name still appears in the product. Team and Enterprise Owners can turn the feature off under Organization settings, Capabilities, Remote sessions, with the toggle Scheduled tasks (Was Routines). Runs count against your account. Actions through GitHub or a connector appear as you. The prompt is stored in advance, so it cannot approve a step during the run. Claude opens branches prefixed with claude/. The default environment uses Trusted network access.
Desktop scheduled tasks run on your machine. The machine has to be on. An open session is not required. They can read local files. The comparison table says the minimum interval is one minute when Claude sets it, and one hour in the forms.
/loop runs inside an open session and inherits that session’s MCP servers and permissions. /loop 5m check the deploy is a fixed schedule. A prompt with no interval lets Claude pick a delay from one minute to one hour. Bare /loop runs a built-in maintenance prompt, or .claude/loop.md if that file exists, otherwise ~/.claude/loop.md. The file is truncated past 25,000 bytes. Seconds round up to a minute. A session holds at most 50 scheduled tasks. Recurring tasks expire after seven days. CLAUDE_CODE_DISABLE_CRON=1 turns the session scheduler off. Self-paced loops stop with Esc while they are waiting. A fixed interval stops when you ask Claude to cancel it. Esc and Ctrl+C do not stop a fixed loop.
Goal mode is the other long run, and the scheduled-tasks page points at it for “until a condition holds” rather than “every N minutes.”
See Claude Code scheduled tasks and cloud routines.
OpenAI Codex
Scheduled tasks are a ChatGPT web and mobile feature. Eligible plans can also start a task from Gmail, Slack, or a GitHub event. Those event triggers are web and mobile only. The desktop app, the CLI, and the IDE extension do not provide the Scheduled UI, and a task cannot combine an event trigger with a time schedule. You create and manage tasks on the web or in the desktop app. The CLI and the IDE can still be where you prepare and test the prompt.
A desktop task that uses a local project needs the computer on and the app running. A web task cannot touch a local folder. Scheduled tasks run unattended with your default sandbox settings. They use approval_policy = "never" when organization policy allows it. If admin requirements disallow that, they fall back to the approval behavior of the permission mode you selected. Full access is the elevated case the page tells you to narrow.
codex://automations opens Scheduled with the create flow open. That URL is covered in deep links.
See Codex automations.
Cursor
/loop is a built-in skill that runs a prompt or a skill on an interval. /automate creates a cloud Automation. Automations also live in the Agents Window, at cursor.com/automations, and as Marketplace templates.
An Automation has a trigger, a prompt, optional tools, and a repo choice: none, one repo, or several. You save it and activate it. Triggers include a schedule and events from GitHub, GitLab, Slack, webhooks, Linear, Sentry, PagerDuty, and Bitbucket Cloud. Usage is billed as cloud agent usage. Personal accounts bill you. On a team, Run as Me and a service account are the two identities. A scheduled trigger may run late. It does not run before the time you set. Opening a pull request is enabled by default.
See Cursor Automations and Cursor skills for /loop.
Grok
Grok Build’s /loop repeats a prompt in the session you have open:
/loop 5m Check if the test suite passes and report any failures
The interval is Ns (60 seconds minimum), Nm, Nh, or Nd. The prompt fires immediately, then repeats. Each firing is a new turn. Loops expire after seven days. At most 50 scheduled tasks can be active. Cancel from the tasks pane (Ctrl+G) or ask the agent. /tasks lists them. This list is separate from todos (Ctrl+T) and from monitors, which stream each line of a script as a notification.
Grok Bot routines are the cloud version. A skill is how the Bot does the job. A routine is when: a schedule, or an event from Slack, GitHub, Linear, Sentry, PagerDuty, email, or a webhook. The run happens in the cloud with the laptop closed. You ask the owning Bot in plain language. The timezone is under Settings, Bot, Timezone. A new routine does not run at creation. The first run is the next scheduled time. Test on the desktop runs it immediately, and that test can perform real external actions. Mobile can add a routine. Testing it needs the desktop app. Event triggers only see new activity after the routine exists.
See Grok Build background tasks and Grok Bot routines.
Details checked against each vendor’s documentation in November 2026.
A real example
You want a note when the newsletter deploy finishes, and you are sitting in a Claude Code session. The documented shape is a fixed /loop:
/loop 5m check if the newsletter deploy finished and tell me what changed
Claude confirms the cadence and a job id. Ask it to cancel that loop when the deploy is done. Esc will not stop a fixed interval.
The same words work as Grok Build’s /loop, with one difference from the Grok page: the first firing happens immediately, then every five minutes. For a check that should run overnight with the laptop closed, use a Claude Code cloud task, a Codex web task, a Cursor Automation, or a Grok Bot routine. /loop will not outlive the session that started it.
Work Tracebook is the timeline of what those runs reported after the fact. It is not the scheduler.
When to use a scheduled task
Use a schedule when the job is the same prompt on a clock: poll a deploy, check CI, send yourself a reminder. Use an event trigger when the work should start because something happened, and polling would be wasted turns. Claude Code’s own page says a channel or a webhook beats /loop for that.
Use goal mode when you want the agent to keep going until a check passes, inside one session, and then stop. What would make an overnight agent useful? is the question to answer before either one: what you want to decide when you come back.
Skip a schedule for a one-off edit you can review now. A stored prompt will run again. That is the point of the feature, and it is also how a vague prompt edits the repo on a cadence you forgot about.
Pitfalls
/loop feels durable and is not. Claude Code restores many session tasks on --resume and --continue, with exceptions the scheduled-tasks page lists, including a self-paced /loop. Grok Build’s page does not say a /loop survives a restart. A cloud task or a Grok Bot routine is the one that runs with the machine closed.
The stored prompt is not a person at the keyboard. Claude Code says it cannot approve a step during the run. Codex runs a scheduled task unattended, on your default sandbox, and with approval_policy = "never" when policy allows it. Which tasks to let agents do unattended is one local case of that sandbox. Cursor bills the run as cloud agent usage and may start a scheduled Automation late.
A test of a Grok Bot routine can take real actions. Event triggers do not replay old events. A Claude Code cloud run clones the repo fresh and pushes claude/ branches as you. Read the prompt as if it will run while you are away, because that is the case you scheduled.
Related on flaviocopes.com
- What would make an overnight agent useful? is the decision to write down before a long or repeated run.
- A deep dive into Grok Bot covers routines as the schedule on top of a skill.
- Which tasks to let agents do unattended includes the sandbox a Codex scheduled task keeps.
- Work Tracebook turns agent reports into a timeline you can read after the runs have finished.
Related glossary entries
- Goal mode: Goal mode keeps a coding agent working until a condition holds. How /goal works in Claude Code, Codex, the Cursor CLI and Grok Build.
- Cloud agents: Cloud agents run a coding task on a remote machine instead of your laptop. How Claude Code, Codex, Cursor and Grok Bot start one, and what they cannot see.
- Permission modes: Permission modes decide what a coding agent can do without asking. The modes in Claude Code, Codex, Cursor and Grok Build, and what YOLO mode really skips.
- Deep links: A deep link is a URL that opens a coding agent with a prompt waiting in the box. How claude-cli, cursor, and codex links work, and what Grok documents.
Want me to talk about your product? You can sponsor this site.