diffox
Blog

Automations and routines: running a coding agent on a schedule

Claude Code routines and Codex, Cursor and Copilot automations start a coding agent on a schedule, a GitHub event or an API call. We read five tools’ docs.

ShareXLinkedIn

Summary. A coding agent can also run when nobody is at the keyboard: every night, when a pull request is opened, or when your monitoring tool calls an endpoint. Claude Code calls this a scheduled task (the cloud version used to be called a routine), and so does OpenAI’s Codex; GitHub Copilot and Cursor call it an automation. On 5 November 2026, we read the documentation of these four tools, of Google’s Antigravity and of GitHub Actions.

  • In most tools, an automation is a cloud agent that nobody is watching. A trigger starts a saved prompt: 5 of the 5 tools offer a schedule, 4 a GitHub event and 3 an API call. The questions a cloud agent raises apply here too, plus one more: what should the agent do when there is nothing to do?
  • The agent runs as you or as a service account, with nobody watching. Claude Code’s cloud tasks commit on GitHub as your user; in Copilot you can choose Copilot’s identity, and in Cursor a service account. The text of an issue or pull request that arrives with an event can also end up in the prompt; by default, Copilot ignores events from people without write access.
  • Let the agent write the change, and a separate step open the pull request. Codex’s CI example, Cursor’s CI guide and GitHub Agentic Workflows run the agent in a way that it can’t open a pull request; opening the pull request, commenting or labeling is left to a separate step.
  • When there is nothing to do, the agent should say so in one line. In its Agentic Workflows documentation, GitHub describes an agent that finishes without leaving any output as the most common runtime failure in these workflows; Cursor and OpenAI also ask you to write into the prompt when the agent should do nothing and how it should decide whether there is anything to report. A “nothing to do” note, not an empty pull request.

What is an automation, and is it the same as a routine?

5/5tools can start the agent on a schedule
4/5tools can also start it on a GitHub event
3/5tools can also start it with an API call
1 hourthe shortest interval of a Claude Code cloud task

In the cloud agent post, we covered how an agent runs in the cloud, on a clean machine opened for each task, and in the hooks post, the commands that hook into events in the agent’s own session. In both, a person started the work. This post looks at starting the agent without anyone typing a prompt: on a schedule, on an event on GitHub, or with an API call. The tools call this by different names:

  • Claude Code: scheduled task. The cloud version used to be called a routine, and that name still appears in the claude.ai/code/routines address, in the CLI’s /routines alias and in the API.
  • OpenAI Codex: scheduled task. The documentation’s address is still /docs/automations; tasks are set up in the ChatGPT desktop app and on the web.
  • GitHub Copilot and Cursor: automation; in both Copilot and Cursor, every run starts a cloud agent.
  • Google Antigravity: /schedule inside an open conversation, and a sidecar for standing jobs that run on their own, independent of any conversation.

The names differ, but they are all made of the same parts:

4 parts in every automation. It runs with nobody typing; you make the decisions when you set it up. 1. Trigger. A schedule, a GitHub event or an API call. 2. Saved prompt. The same task on every run, and nobody to ask. 3. Permissions. Who it runs as, which tools are on, where it pushes. 4. Result. A pull request, comment or message; a one-line note if no work.
Source: the five tools’ automation documentation, 5 November 2026.

The difference is that no person starts this cloud agent. GitHub’s documentation says so plainly: automations run Copilot without a person starting each task, so they carry additional risks. Claude Code’s cloud tasks also run on their own, as full cloud sessions. So the questions a cloud agent raises (where it runs, whose token it uses, where it can push) apply here too. And one more is added: what should the agent do when there is nothing to do?

What starts an automation?

There are three kinds of trigger: a schedule, a GitHub event and an API call. One task can combine several: in the example in Claude Code’s documentation, a review task runs every night, is triggered from a deploy script, and also runs on every new pull request. What we list below is each tool’s own automation feature; any of these agents can also run from its CLI in GitHub Actions, which we cover in the next section.

Schedule. Every hour, every night or once a week. Claude Code and Cursor accept a cron expression as well as their presets, and GitHub Actions works with cron expressions directly; Copilot offers hourly, daily and weekly options. The shortest interval varies by tool: Claude Code’s cloud task runs no more than once an hour, while GitHub Actions’ schedule event can run every 5 minutes at most. The time isn’t exact either. GitHub can delay scheduled jobs at busy times, especially at the start of every hour, and drop some of them if the load gets high enough. Claude Code says a task scheduled exactly on the hour can start several minutes late, and Cursor that a run may start late but never early. Claude Code’s example of this kind: a task that, every weeknight, reads the issues opened since the last run, labels them, assigns owners and posts a summary to Slack.

GitHub event. A pull request is opened or gets new commits, or an issue is opened. You can also filter the event: run the task only on pull requests that aren’t drafts, or when a label is added (Claude Code), or only when certain files change (Copilot). Claude Code needs the Claude GitHub App installed on your repository; each event opens a separate session, and events over the hourly caps are dropped. Claude Code’s example: a task that runs on the pull_request.opened event, applies the team’s own review checklist, and leaves inline comments on security, performance and style issues, plus a summary comment.

API call. An HTTP request sent to the task’s own endpoint; your monitoring tool, your deployment pipeline or a tool you wrote yourself can start the agent this way. In Claude Code, each task has its own token, which can trigger that task only; Copilot does this through GitHub’s REST API, and Cursor through each automation’s own webhook URL. The example in Claude Code’s documentation sends the text of a Sentry alert to the task:

bash
curl -X POST https://api.anthropic.com/v1/claude_code/routines/trig_01ABCDEFGHJKLMNOPQRSTUVW/fire \
  -H "Authorization: Bearer sk-ant-oat01-xxxxx" \
  -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"text": "Sentry alert SEN-4521 fired in prod. Stack trace attached."}'

The request’s text field doesn’t reach the agent as an instruction. Claude Code wraps it in a block labeled as untrusted data and tells the agent not to follow the instructions inside it unless the task’s own prompt says to. According to the documentation, the reason is that anyone who gets hold of the token can send text too. If you want the task to investigate the alert, you have to say so explicitly in the prompt.

How do automations work in the five tools?

We read the five tools’ documentation on 5 November 2026. Here is each tool’s own feature:

Automations in five coding tools: where they run, what starts them, where the result goes and what they can change
ToolWhere it runsWhat starts itWhere the result goesWhat it can change
Claude CodeIn the cloud, on Anthropic’s servers or your company’s; the desktop app also has local tasksSchedule, a pull request, release or issue event on GitHub, API callEach run is a separate session; changes go to a claude/ branch, and the pull request is opened by you, or by the agent if the prompt asksThe repositories and connectors you select; on GitHub as your user, in auto mode
CodexIn the desktop app, on your machine, in the project or a separate worktree; on the web, without access to folders on your computerSchedule; on the web and mobile, Gmail, Slack and GitHub pull request eventsThe Scheduled inbox: runs with findings show up there as unreadAs much as your default sandbox setting allows; without asking for approval if your organization allows it
GitHub CopilotIn GitHub’s cloud, as a cloud agent session; VS Code also has local automationsSchedule (hourly, daily, weekly), issue, pull request, discussion and security alert events, REST APIPull request, issue label, comment; everyone who can read the repository sees the sessionOnly the tools you select; GitHub tools in that repository, and if you choose, only in the issue or pull request that triggered it
CursorIn the cloud, as a cloud agent; with Self-Hosted Machines, commands run on your machineSchedule (cron), GitHub, GitLab and Bitbucket events, Slack, Linear, Sentry, PagerDuty, webhookPull request (the tool is on by default), pull request comment, Slack messageThe repository and tools you select; approving is a separate permission
AntigravityAlongside the app, on your machine (sidecar)Schedule (cron); /schedule only inside an open conversationA new conversation in a projectNot stated in the documentation

Source: the tools’ documentation and GitHub’s changelog, 5 November 2026. “Not stated in the documentation”: in the pages we read that day, we found no sentence that describes this. Copilot’s automations only work in private and internal repositories; Codex’s event-triggered tasks are available on eligible plans. Antigravity’s sidecars are in the desktop app, and off until you turn them on. Google’s Jules had scheduled tasks too; according to Google’s announcement of 29 October 2026, Jules becomes read-only after 11 November 2026 and shuts down on 31 December 2026.

The biggest difference is where it runs. A task in the cloud keeps going while your computer is off, but it can’t see your files: each run gets the repository as a fresh clone. A local task has access to your files and tools, but runs only while the computer is awake. Claude Code and Copilot have both: you set up a local task in Claude Code’s desktop app, and Copilot’s in VS Code. Codex’s desktop task also needs the computer on and the app running.

The feature people search for as “Claude Code routines” is one of Claude Code’s three ways to schedule work, and Anthropic’s documentation puts all three side by side:

Three ways to schedule in Claude Code: cloud task, desktop task and /loop
What differsCloud task (formerly routine)Desktop task/loop
Where it runsIn the cloud, on Anthropic’s servers by defaultOn your machineOn your machine, inside the open session
Computer must be onNoYesYes
Session must be openNoNoYes
Local filesNo, each run is a fresh cloneYesYes
Permission promptsAuto mode by defaultSet per taskInherited from the session
Shortest interval1 hour1 hour in the form, 1 minute if Claude sets it up1 minute
After a restartKeptKeptRestored with --resume; a recurring task is deleted after 7 days

Source: Claude Code’s scheduling documentation, 5 November 2026. A desktop task runs while the app is open and the computer is awake; of the runs missed while the computer was asleep, only the most recent one runs, once, when it wakes.

The documentation’s advice is clear: a cloud task for work that should run reliably without your machine, a desktop task for work that needs local files and tools, and /loop for quick polling during a session. You can also set up a cloud task in the CLI, for example by typing /schedule daily PR review at 9am. For that, you need to be logged in with your claude.ai subscription; otherwise the CLI hides the command, but you can still set up the task at claude.ai/code/routines.

You can also put an agent on a schedule without any of these features: add schedule to a GitHub Actions workflow and run the agent’s CLI or the vendor’s action in it. To start it by hand, there is workflow_dispatch. Anthropic’s claude-code-action, OpenAI’s Codex action, Cursor CLI, OpenCode and Google’s run-gemini-cli for Gemini CLI describe this in their own documentation. On this path the workflow file lives in the repository and can be reviewed in a pull request; Copilot’s automations, by contrast, are stored separately from the repository and aren’t committed to Git. GitHub points anyone who wants to keep an automation as code to GitHub Agentic Workflows: you write the workflow in Markdown, it is compiled into a standard Actions workflow, and Copilot or another coding agent runs inside it.

GitHub Actions has rules of its own too: a scheduled workflow runs only on the default branch, and in a public repository it is disabled automatically after 60 days without any activity.

Whose permissions does the agent use when nobody is watching?

In the cloud agent post, we covered how secrets, the network and the commit author vary from tool to tool, and all of that applies here too. With an automation, nobody is there to approve each run, so three questions come first: who the agent acts as, who can trigger it, and what it can change.

Who it acts as. Claude Code’s cloud tasks belong to your claude.ai account and aren’t shared with your teammates. Everything a task does on GitHub and in connectors appears under your name; commits and pull requests carry your GitHub user. In Copilot, you choose an automation’s type when you create it, and you can’t change it later: a personal automation runs with your identity, a shared automation with Copilot’s. Because a shared automation belongs to the repository, it keeps running even if the person who set it up leaves the team. In Cursor, the “Run as” setting makes the same choice: your account, or a service account created just for that automation. OpenAI’s Team Tasks also run with the team’s service account.

Codex’s desktop tasks run with your default sandbox settings and, if your organization allows it, without asking for any approval (approval_policy = "never"); OpenAI writes that in full access mode this carries a higher risk. Claude Code’s cloud tasks also start in auto mode: a model allows or blocks, in your place, the actions that would otherwise wait for your approval.

Who can trigger it. In an automation that runs on events, whoever writes the issue or pull request also writes the text the agent will read. GitHub’s documentation says so plainly: input from untrusted users can become part of the prompt. That is why Copilot, by default, ignores events triggered by people without write access to the repository. Cursor doesn’t run automations on pull requests opened from forks; according to its documentation, running outside code with the repository’s permissions isn’t safe. The Claude Code GitHub Action checks whether whoever triggered an issue or pull request event has write access, but events that nobody starts, such as schedule, skip this check; OpenCode’s documentation likewise notes that a scheduled workflow has no user whose permissions could be checked. OpenAI, for its part, asks in the Codex action’s security checklist that you sanitize text coming from pull requests, commit messages and issues, and that you check HTML comments and hidden text before giving them to the agent. We explained how this attack works in the prompt injection post.

What it can change. In Copilot, the tools you select decide what an automation can do. GitHub tools can act only in that repository, and for an automation triggered by an event you can also limit its writes to the issue or pull request that triggered it. Tools from MCP servers, however, aren’t limited to the repository; according to Cursor’s documentation, connecting an MCP server gives the agent every tool that server offers. In Copilot, each run is a cloud agent session, and according to GitHub, the cloud agent can push to one branch only: the branch of the pull request it was called on, or a copilot/ branch created for it. Claude Code also pushes its changes to a branch starting with claude/, unless the prompt names another branch. Which branches it can push to is set by branch protection rules on GitHub; but according to the documentation, these rules apply to the GitHub access you connected, so a rule you can bypass doesn’t stop the task’s push either.

Some tools can also give an automation the right to approve or merge: in Cursor, if you turn on approvals in the comment tool, the agent can approve a pull request; in Copilot, merging pull requests is among the tools an automation can be given. We covered what an AI approval does and doesn’t show in the approval post. Copilot’s own safeguard points the same way: if the repository requires at least one approval, a pull request opened by a shared automation needs one more approval by default, and the person who set up a personal automation can’t approve the pull requests it opens.

Three vendors’ documentation shows the same pattern: the agent runs without write access, and a separate step opens the pull request. In Codex’s CI example, the agent runs with read access only and writes its change to a patch file; the pull request is opened by a separate job that has write access but never sees the OpenAI key. Cursor’s CI guide likewise recommends, for production workflows, that the agent only change files and that later steps handle the branch, the commit and the comment. In GitHub Agentic Workflows, the agent runs without write access, and a separate job carries out the issue, comment or pull request it asks for.

Which jobs should you give an automation?

The vendors’ examples look a lot alike. Claude Code’s documentation describes this kind of work with three traits: unattended, repeatable, and tied to a clear outcome. We collected the examples from the documentation along with their triggers:

Example jobs the vendors give automations in their own documentation, and their triggers
JobTriggerExample from
Reading new issues, labeling them and assigning ownersEvery night or when an issue is openedClaude Code, Copilot, GitHub Agentic Workflows
Trying to fix failing tests and opening a draft pull requestEvery nightCopilot
Investigating a broken CI run and proposing a fixWhen CI finishesCodex, Cursor, GitHub Agentic Workflows
Investigating an alert or an error and proposing a fixA call or an event from a monitoring toolClaude Code, Copilot, Cursor
Reviewing a pull request against the team’s own checklistWhen a pull request is openedClaude Code, Cursor
Summarizing recent changesEvery morning or every dayCodex, Cursor, Antigravity, Claude Code
Keeping the docs in step with changed APIsOnce a weekClaude Code, GitHub Agentic Workflows

Source: the tools’ documentation and GitHub’s changelog, 5 November 2026. These are the vendors’ own examples, not measured results.

What the examples share is that the result is something a person will read: a draft pull request, a label, a summary or a comment. None of them merges. In Claude Code’s docs-drift example, update pull requests are opened for an editor to review; in its alert example, the on-call engineer reviews a ready pull request instead of starting from a blank terminal.

For getting started, OpenAI’s advice points the same way: before you put a task on a schedule, try the prompt by hand in a regular chat, read the results of the first few runs, then adjust the prompt or the frequency. In Claude Code and in Copilot, you can also run an automation by hand, without waiting for its trigger.

What should the agent do when there is nothing to do?

An agent on a schedule also runs on days when there is nothing to do. If the prompt doesn’t say what to do on such a day, it may simply end in silence. GitHub Agentic Workflows’ documentation names this outright: if the agent finishes without calling any output tool, the workflow fails silently, with no output. According to the documentation, this is the most common runtime failure in workflows where the agent leaves the writing to a separate job (safe outputs). The fix is simple: when there is nothing to do, the agent calls the noop tool and writes why in one sentence. The documentation doesn’t count silence as “nothing to do”.

The other vendors ask for the same rule in the prompt. Cursor asks you to set a quality bar in the prompt for when the agent should open a pull request, when it should comment and when it should do nothing. OpenAI asks that the prompt of a task scheduled inside a chat say how to decide whether there is anything important to report, and when to stop; one of its own example prompts tells the agent not to feel it has to update anything, “only if there’s a good reason!” Codex’s CI example writes the same rule into the workflow: if the agent’s patch is empty, the job that opens the pull request doesn’t run at all.

It takes two sentences in the prompt. The example below starts from Copilot’s “Each night, check for failing tests on the main branch, attempt a fix, and open a draft pull request” and adds what to write when there is nothing to do:

EXAMPLE. With nothing to do, it still writes a line. prompt: Every night, find the failing tests on main. / If no test fails, write this and stop: / “Nothing to do: all tests pass.” / If some fail, make the smallest fix on a new branch. / If the tests still fail, write why and stop. / If they pass, open a draft pull request. Don’t merge.. Nothing to do: Leaves a record, not silence; opens no empty pull request. A new branch: Leaves the default branch alone. Draft pull request: Leaves the decision to a person.
An example prompt, put together from Copilot’s nightly tests example and GitHub Agentic Workflows’ noop rule, 5 November 2026.

A run that ends as “succeeded” doesn’t show that the work was done, either. In Claude Code, a run marked Succeeded, Failed or Cancelled tells you how the session ended, not whether the work in the prompt was done; blocked network requests and unfinished work appear only in the run’s transcript. In Antigravity CLI’s non-interactive mode, a tool call that can’t get approval is denied, but the run still ends with a success exit code. In Cursor, if an MCP server rejects the automation’s credentials, the run goes on without that server’s tools, and Cursor sends no notification about it; its documentation suggests that on Enterprise you set up an alert on this event through OpenTelemetry. We covered gathering the agents’ own records in one place in the OpenTelemetry post.

To sum up, check these before you turn on your first automation:

Before you turn it on, check these. Nobody will be there to approve each run. The names above each card are the tools whose documentation says so. Copilot · Claude Code Who can trigger it?: Ignore events from people without write access. Copilot · Cursor Who does it run as?: Your account, or a service account? Copilot · Cursor Which tools are on?: Only those the job needs. An MCP server gives them all. Claude Code · Copilot Where can it push?: To its own branch; keep the default branch protected. Codex · Cursor · GitHub Who has write access?: The agent edits; a separate step opens the pull request. GitHub · Cursor · Codex What if there’s no work?: A one-line note, not an empty pull request.
Compiled from the vendor documentation cited in this post, 5 November 2026.

Our AI code review tool, diffox, is an agent triggered by events too. When GitHub reports that a pull request was opened, reopened, marked ready for review or received new commits, it reviews the change. It writes its findings on the pull request as comments; since it never submits its review as an approval or a change request, it never blocks a merge. When it finds nothing, it says that too: the summary’s heading is “No findings”, and the sentence under it, “Nothing in this change needed a comment.”

Frequently asked questions

What are Claude Code routines?

It is the former name of Claude Code’s scheduled tasks that run in the cloud; Anthropic calls the feature a scheduled task. A task is a saved Claude Code configuration: a prompt, one or more repositories, and connectors. Because it runs in Anthropic’s cloud or in your company’s own environment, it keeps going when your computer is off. It starts on a schedule (at most once an hour), with an API call or on a GitHub event; each run opens a separate session and pushes its changes to a branch starting with claude/. You set one up at claude.ai/code/routines, in the desktop app, or in the CLI with /schedule. The feature is in research preview; its behavior and limits may change.

What is the difference between routines and scheduled tasks?

They are the same feature: routine is the old name of Claude Code’s cloud tasks, and scheduled task the new one. The old name remains in the claude.ai/code/routines address, the CLI’s /routines alias and the API. The distinction people actually mix up is between Claude Code’s three ways to schedule. A cloud task runs even when your computer is off, but it can’t see your local files, and it runs at most once an hour. The desktop app’s local task works with your files, but it needs the app open and the computer awake. /loop runs only inside an open session, and a recurring task deletes itself after 7 days.

How do Codex automations work?

In OpenAI’s documentation, this page’s address says automations and its title says Scheduled tasks. In the ChatGPT desktop app, a task runs in the background on a schedule, in the project you choose or in a separate worktree; this needs the computer on and the app running. On the web and mobile, on eligible plans, Gmail, Slack and GitHub events can also start a task, but web tasks can’t work in a folder on your computer. Desktop tasks run with your default sandbox settings and, if your organization allows it, without asking for any approval; runs with findings show up as unread in the Scheduled inbox. Codex CLI doesn’t have this interface; in CI, you use codex exec or the Codex GitHub Action.

Do Cursor automations run in the cloud?

Yes. Cursor’s automations start a cloud agent on every run; the work happens in the cloud, in an isolated virtual machine. If you use Self-Hosted Machines, file edits and commands run on a machine you manage, while the agent loop and the model stay with Cursor. An automation can be started by a schedule (cron), GitHub, GitLab or Bitbucket events, Slack, Linear, Sentry, PagerDuty or a webhook. It runs as you or as a service account of its own, and it doesn’t run on pull requests opened from forks.

What are GitHub Copilot automations?

Saved tasks that start Copilot’s cloud agent on a schedule (hourly, daily or weekly), on an event in the repository (issue, pull request, discussion, security alert) or through the REST API. You set them up from the repository’s Agents tab, the GitHub Copilot app or VS Code, and they only work in private and internal repositories. A personal automation runs with your identity, a shared automation with Copilot’s. The tools you select decide what it can do, and events triggered by people without write access to the repository are ignored by default. Automations aren’t committed to Git; for anyone who wants to keep the workflow in the repository as code, there is GitHub Agentic Workflows.

What permissions does a scheduled agent run with?

With the permissions you gave it when you set it up, and with nobody watching. Claude Code’s cloud tasks belong to your account and commit on GitHub as your user. In Copilot, a personal automation uses your identity and a shared one uses Copilot’s; in Cursor, an automation runs as you or with its own service account. Codex’s desktop tasks run with your default sandbox settings. So turn on only the tools and connectors the job needs, limit pushes to the agent’s own branch, and leave opening the pull request to a separate step. Remember that the text of an issue or pull request that comes with an event also goes into the prompt; ignore events from people without write access.

How does automatic code review work when a pull request is opened?

A GitHub App installed on the repository receives an event from GitHub when a pull request is opened or gets new commits, and starts the review. Claude Code’s scheduled task does this with the pull_request.opened trigger, and Copilot and Cursor automations with a “pull request opened” trigger. diffox works this way too: it reviews a pull request when it is opened, reopened, marked ready for review or gets new commits. It writes its findings as comments and never blocks a merge; when it finds nothing, its summary says “No findings”.