Skip to content
Back to Guides

How to set up Claude Code routines (scheduled tasks)

A terminal icon with a clock badge, labeled Claude Code, joined to the Interfere logo by a line marked Every morning
LG

Levi Gans

·

AI agents

Claude Code routines are saved Claude Code jobs that run in Anthropic’s cloud without you. Each one is a prompt, one or more GitHub repositories and a set of connectors, started by a schedule, an HTTP call or a GitHub event. Anthropic now calls them cloud scheduled tasks, but the old name is still everywhere: the page is claude.ai/code/routines, /routines still works in the CLI, and some accounts still show a New routine button.

Routines run on Pro, Max, Ultra, Team and Enterprise plans. Each run is a full cloud session: it runs shell commands, uses skills committed to the repo, calls connectors and pushes a branch while your laptop is closed. A Desktop scheduled task or /loop needs your machine on instead.

Below is the setup, then a routine that checks Interfere every morning for new high-priority production problems and opens a draft pull request with a test for each.

How to create a Claude Code routine

  1. Go to claude.ai/code/routines and click New task (or New routine).
  2. Write the prompt. Nobody is there to answer questions, so say exactly what to do and what done looks like.
  3. Pick a trigger: Schedule, GitHub event or API.
  4. Under Advanced settings, select the repository. Each run clones it fresh from the default branch, and Claude pushes to branches prefixed claude/.
  5. Open the Connectors tab. Every connector on your account is included by default, writes included. Remove everything the job doesn’t need.
  6. Click Create, then Run now to test it.

From the CLI, run /schedule and describe the job. API triggers can only be added on the web.

Schedule rules worth knowing:

  • Presets (hourly, daily, weekly) take your local time. A custom cron expression is read as UTC, so 0 9 * * 1-5 is 9:00 UTC on weekdays.
  • Nothing more frequent than once an hour is accepted.
  • A run scheduled exactly on the hour can start several minutes late. Anthropic suggests a few minutes past, like 9:07.

How to give a routine an MCP server

This is where most setups break. A routine only sees your claude.ai connectors. Servers you added with claude mcp add live in a file on your machine and never reach the cloud.

For a server that signs in with OAuth, add it at claude.ai/customize/connectors and include it in the task. You sign in once, and the cloud session authenticates through Anthropic’s proxy. A server committed to the repo in .mcp.json is called from the session’s own network, so its host must be in Allowed domains, and an OAuth sign-in during a scheduled run has nobody there to finish it.

Example: a routine that fixes Interfere problems every morning

Interfere groups production errors into prioritized problems and explains the likely cause with the stack trace, affected sessions and replays. Its MCP server lets Claude read all of that with your permissions.

  1. 9:07 schedule firesFresh clone of your repo
  2. Reads InterfereActive, High priority, productionMCP connector
  3. Draft PR with a testOne per new problem
  4. Interfere confirms the fixIn recovery, then Resolved

You need an Interfere workspace receiving telemetry from your app (get started), and GitHub connected for Claude’s cloud sessions.

1. Add Interfere as a claude.ai connector

Go to Customize > Connectors, click Add, then Add custom connector, and enter https://mcp.interfere.com/mcp/readonly as the URL. Click Add, then Connect, sign in to Interfere and pick your workspace. There’s no token to paste.

We use the read-only URL on purpose. Writing a fix only takes reads, and the read-only endpoint rejects any change to workspace data, so a confused run can’t resolve or dismiss a problem.

2. Commit the fix procedure as a skill

Routines use skills committed to the repo, so you can test the same steps by hand first. Save this as .claude/skills/fix-interfere-problem/SKILL.md:

Markdown
1---2name: fix-interfere-problem3description: Fix one Interfere problem with a regression test and open a draft pull request.4---561. With the Interfere connector, read the problem: its explanation, stack7   frames, the release on its recent occurrences, and affected sessions.82. If the cause isn't in this repository's code, say so and stop.93. Write the smallest fix on a branch named claude/interfere-<problem ID>,10   plus a regression test that fails before the change. Run the tests.114. Push and open a draft pull request with the REST API:12   gh api repos/OWNER/REPO/pulls -f title="Fix <problem title> [<problem ID>]" \13     -f head=claude/interfere-<problem ID> -f base=main \14     -f body="<Interfere link, cause, test results>" -F draft=true155. Never merge.

The skill uses gh api because gh pr create fails in cloud sessions. GitHub traffic goes through Anthropic’s GitHub proxy, which rejects GraphQL, and gh pr uses GraphQL. The REST endpoint works, and -F sends draft as a real boolean.

3. Create the routine

Create a task with a Daily schedule at 9:07, your repository, and only the Interfere connector. Use this prompt:

Plain Text
1Using the Interfere connector, find production problems with status Active2and priority High. Skip any problem whose ID already appears in an open3pull request title in this repository.45For at most 2 of the remaining problems, follow the fix-interfere-problem6skill. Finish with a summary of problems found, skipped and why, and the7draft pull requests you opened.

The open-PR check is the part we’d never skip. Each run starts from a fresh clone of the default branch, so a “handled problems” file the run writes to its own branch is gone the next morning. Open pull requests are state that survives between runs. The cap of 2 keeps one bad morning from turning into ten pull requests.

4. Let Interfere confirm the fix

After you merge and deploy, the problem moves to In recovery, then to Resolved once new occurrences stop. If a later deploy brings it back, the problem reopens and Interfere looks for the release that brought it back.

Troubleshooting

What you seeWhat to do
/schedule returns “Unknown command”You’re signed in with an API key, a Console account or a cloud provider. Run /login with your claude.ai account.
The run can’t find any Interfere toolsCheck the task’s Connectors tab. A server added with claude mcp add won’t appear.
Interfere returns 401Reconnect Interfere at claude.ai/customize/connectors. Cloud sessions don’t run the sign-in themselves.
gh pr create fails with a GraphQL 403Expected in cloud sessions. Use gh api repos/OWNER/REPO/pulls as in the skill.
Two pull requests for one problemCheck that the prompt skips problem IDs already in open PR titles, and that the skill puts the ID in the title.
History says Succeeded, but there’s no PRRead the run’s transcript. Succeeded only means the session ended normally, even if a connector tool was missing.

Where Interfere fits

We make Interfere, so weigh this accordingly. Coding agents write code fast now, and a routine like this one does it while you sleep. Knowing what broke in production, who it hit and whether the fix held is the slow part. We built Interfere for that: it groups errors into problems, ties each to its evidence, and keeps watching after the deploy.

It has no mobile SDKs, no profiling, no uptime or cron checks, and no self-hosting. If you need those, a broader tool fits better; Interfere vs Sentry covers the tradeoffs. To fix one problem at your keyboard, see the Claude Code MCP guide, the MCP docs and how to reduce MTTR.

Set up Interfere to try it.