Skip to main content
MindStudio
Pricing
Blog About
My Workspace

Claude Code Routines: How to Run Scheduled AI Agents Without a Server

Claude Code's new Routines feature lets you schedule agents to run in the cloud on a $20/month plan. Here's how to set them up and what they can automate.

MindStudio Team RSS
Claude Code Routines: How to Run Scheduled AI Agents Without a Server

What Claude Code Routines Actually Are

Most AI coding tools are reactive. You open a terminal, type a prompt, watch it run, close the laptop. The agent only exists when you’re there to summon it.

Claude Code Routines change that. With Routines, you can schedule an AI agent to run on a fixed schedule — hourly, daily, weekly — entirely in the cloud. No server to manage, no laptop to leave running, no cron job to babysit. The agent wakes up, does its work, and goes back to sleep. You don’t have to be anywhere near it.

This is a meaningful shift in how Claude Code can be used. Instead of a tool you reach for, it becomes something that works for you in the background — more like a scheduled job than an interactive session.

This article covers what Routines are, how they work, how to set one up, and what kinds of tasks they’re actually useful for.


The Problem Routines Solve

Before Routines, running a Claude Code agent on a schedule required real infrastructure. You had a few options:

  • Leave your computer on — obvious downsides
  • Use a cloud VM — EC2, Lightsail, a DigitalOcean droplet — and SSH into it regularly
  • Use GitHub Actions — which works well for running scheduled AI experiments, but requires YAML config and familiarity with CI/CD pipelines
  • Use Trigger.dev or n8n — more flexible, but you’re introducing a whole separate automation platform

None of these are bad options, but they all add overhead. You’re solving an infrastructure problem before you’ve even started on the actual automation.

Keeping a Claude Code agent running 24/7 without a Mac Mini has been a legitimate engineering challenge. Routines are Anthropic’s answer: just let the platform handle the scheduling and execution environment.


How Claude Code Routines Work

Routines run Claude Code in headless mode on Anthropic’s cloud infrastructure. When the scheduled time arrives, Anthropic spins up a session, runs your agent with the instructions you’ve defined, and tears it back down when the task is complete.

From your perspective, you define three things:

  1. The trigger — when the Routine should run (a cron expression or natural language schedule like “every day at 8am”)
  2. The task — what Claude should do, written as a prompt or referencing a CLAUDE.md file in your repo
  3. The context — which repository or workspace the agent has access to

The agent runs with the same capabilities as an interactive Claude Code session: it can read and write files, run shell commands, call APIs, browse the web (if enabled), and commit to git. The key difference is there’s no human in the loop. It runs, does the work, and stops.

This is the same underlying architecture that powers Anthropic’s managed agents approach — offloading the execution environment entirely to Anthropic’s infrastructure so you’re not responsible for uptime, memory, or compute.

What the Agent Has Access To

By default, a Routine runs with the permissions you’ve configured in your Claude Code settings. This typically includes:

  • Read/write access to the connected repository
  • The ability to run shell commands in a sandboxed environment
  • Access to environment variables you’ve stored securely
  • Internet access for API calls and web browsing tasks

What it doesn’t have by default is the ability to make destructive changes without guardrails. You can configure permission levels — from fully autonomous to requiring confirmation before certain actions — depending on how much trust you want to extend to an unattended agent.


How to Set Up a Claude Code Routine

Here’s the practical walkthrough. This assumes you have an active Claude Code subscription on the Max plan ($20/month or higher — Routines are not available on the free tier).

Step 1: Open the Routines Panel

Inside Claude Code, navigate to the Routines section. This is accessible from the main menu or settings panel, depending on the interface you’re using. You’ll see any existing Routines listed here, along with an option to create a new one.

Step 2: Define the Schedule

You can specify the schedule using:

  • Natural language — “Every weekday at 7am” or “Every Sunday at midnight”
  • Cron syntax — for more precise control, e.g., 0 7 * * 1-5 for weekdays at 7am UTC

Pick the timezone carefully. The default is UTC, which catches people off guard when their “morning report” agent fires at 2am local time.

Step 3: Write the Task Prompt

This is the most important part. The prompt you write here is the full instruction set the agent receives when it wakes up. Write it the same way you’d write a CLAUDE.md task or a headless mode prompt:

  • Be explicit about what the agent should do and in what order
  • Specify where output should go (a file, a Slack message via API, a GitHub issue, etc.)
  • Include success criteria if relevant
  • Call out what the agent should NOT do if there are things you want to protect

A weak prompt produces inconsistent results. A tight, specific prompt produces reliable ones. Think of it less like a chat message and more like a job description for an unattended worker.

Step 4: Connect a Repository (if needed)

If your Routine involves reading or writing code, you’ll need to connect a git repository. Claude Code supports GitHub and GitLab connections. The agent will clone or pull the repo at runtime, do its work, and (if configured) push commits back.

For tasks that don’t touch code — like fetching data from an API and sending a summary email — you can skip the repo connection entirely.

Step 5: Set Permissions and Storage

Decide how much autonomy the agent has. Options typically include:

  • Auto mode — the agent acts without asking for confirmation
  • Restricted mode — the agent asks before making writes or running certain commands

You can also configure secure credential storage via Vaults so the agent has access to API keys, tokens, and secrets without you hardcoding them in the prompt.

Step 6: Test Before Activating

Run the Routine manually once before setting it to a live schedule. Most Routine interfaces include a “Run Now” option that fires the agent immediately. Watch the logs, check the output, and confirm it did what you expected. Fix the prompt if not.

Then activate the schedule and let it run.


What You Can Actually Automate

The most useful Routines tend to fall into a few categories.

Daily Reporting and Monitoring

Set an agent to run every morning and compile a summary of whatever you care about: GitHub issues opened overnight, errors in your logs, changes to a competitor’s pricing page, movement in a portfolio. The agent fetches the data, synthesizes it, and sends you a digest via email or Slack.

This is one of the most straightforward use cases and a good first Routine to build. For a worked example, see how to build an AI news digest agent that runs on a schedule.

Codebase Maintenance

Schedule an agent to run weekly and handle routine maintenance tasks on your repo:

  • Dependency updates and security patches
  • Linting and auto-fixing style issues
  • Running test suites and flagging failures
  • Pruning stale branches or cleaning up TODOs

These are tasks that always fall through the cracks when you’re focused on shipping. A Routine handles them in the background without you thinking about it.

Data Pipeline Tasks

If you have a data pipeline that runs on a schedule — pulling from an API, transforming records, writing to a database or CSV — a Routine can handle that without any dedicated backend infrastructure. The agent writes the transformation logic, runs it, and outputs the result.

This is particularly useful for smaller operations that don’t justify a full ETL platform.

Automated Testing and QA Runs

For teams using Claude Code in their workflow, a Routine can run a full QA sweep on a schedule — exercising the application against a test matrix, identifying regressions, and posting a summary back to Slack or as a GitHub comment.

Content and Research Workflows

A Routine can run each week and automatically research a topic, compile structured notes, and deposit them into a shared file or Notion database. This is useful for keeping up with fast-moving areas without dedicating manual research time. You can do something similar with scheduled browser automation for tasks that require actually visiting pages.


Routines vs Other Scheduling Options

Routines aren’t the only way to run scheduled AI agents, so it’s worth knowing how they compare.

Routines vs the /loop Command

The /loop command in Claude Code creates a recurring loop within an active session — the agent keeps cycling through a task until you stop it. This is great for long-running interactive work within a session, but it requires your terminal to stay open. Routines are cloud-hosted and survive session termination. For a deeper comparison, see Claude Code Loop vs Scheduled Tasks.

Routines vs n8n / Zapier

Dedicated automation platforms like n8n and Zapier offer more visual workflow builders and broader native integrations. But they require you to model your workflow as a node graph, which adds friction for anything complex. Claude Code Routines vs n8n is a detailed breakdown of the tradeoffs, but the short version: Routines are better when the task requires actual reasoning and judgment; n8n is better when you need tight integration with specific SaaS tools.

Routines vs GitHub Actions

GitHub Actions is excellent for code-specific automation on a schedule. It’s free for public repos and well-documented. The tradeoff is that it’s YAML-heavy and doesn’t have AI judgment built in — you’d need to call Claude from a GitHub Action explicitly. Routines are simpler to configure and better suited to tasks that go beyond just CI/CD.

Routines vs Trigger.dev

Trigger.dev is a code-first workflow platform built for developers who want programmatic control. It handles scheduling, queuing, retries, and observability. It’s a better fit for production-grade pipelines where you need fine-grained control. Routines are better for getting something up and running quickly without writing infrastructure code.


Limitations Worth Knowing

Routines are useful but not unlimited. Here’s what to keep in mind:

Session length limits. Routines aren’t designed for multi-hour tasks. They’re optimized for focused, bounded work that completes in a reasonable timeframe. Very long-running tasks may time out.

No persistent state between runs. Each Routine execution starts fresh. If your agent needs to remember something from the previous run, you need to write that state somewhere — a file in the repo, an external database, a note in a shared doc — and have the agent read it at the start of each session.

Cost scales with usage. Routines consume Claude API tokens like any other session. A daily Routine that does significant work will add meaningful cost to your plan. Monitor usage in the dashboard, especially when first setting up.

No interactive recovery. If the agent hits an unexpected state mid-task, it can’t ask you for help. This makes prompt quality critical. Test thoroughly before running unattended.

Limited to Max plan and above. The $20/month plan unlocks Routines, but the free tier does not. If you’re evaluating cost, factor in both the plan price and the token usage from scheduled runs.


Combining Routines with Other Claude Code Features

Routines become more powerful when combined with other Claude Code capabilities.

With Agent Teams: You can structure a Routine to spawn multiple agents working in parallel on different parts of a task. One agent researches, another writes, another edits — all within a single scheduled run. This can compress complex multi-step workflows into a single scheduled Routine.

With Dispatch: Claude Code Dispatch lets you trigger an agent remotely from your phone. You can set a Routine as the default task and use Dispatch to fire it manually outside its normal schedule — useful when something comes up and you need the agent to run immediately.

With a Heartbeat pattern: Some builders run a lightweight Routine every 15 minutes as a proactive heartbeat — checking conditions and triggering deeper work if something needs attention. This approximates an always-on agent without running a full heavyweight session continuously.

For a full picture of the architectural patterns available, the Claude Code agentic workflow patterns guide is worth reading.


Where Remy Fits In

Claude Code Routines are excellent for scheduled agentic tasks. But they’re still fundamentally a tool for running code and logic against existing systems.

If the task you want to automate involves building or extending an actual application — a dashboard that surfaces your Routine’s output, an internal tool that acts on the data your agent collects, a backend that ingests and stores reports — that’s where Remy is useful.

Remy compiles a spec (an annotated markdown document describing what your app does) into a full-stack application: backend, database, auth, deployment. You describe what the application should do, and Remy produces working software from that description.

So a reasonable workflow looks like: Claude Code Routines handle the scheduled data collection and processing, while a Remy-built app provides the interface for reviewing that data, triggering actions, or sharing results with a team.

You can try Remy at mindstudio.ai/remy.


Frequently Asked Questions

What plan do I need to use Claude Code Routines?

Routines require the Claude Code Max plan, which starts at $20/month. They are not available on the free tier or the basic Pro plan. The Max plan also includes higher usage limits and access to other advanced features like Agent Teams.

Can a Routine run multiple agents in parallel?

Yes. Within a Routine, you can structure the task prompt to spawn sub-agents that work in parallel. Claude Code supports multi-agent architectures natively. You define the orchestration in your prompt, and the platform handles execution. See how parallel agents share tasks in real time for more on how this works.

How do I pass secrets and API keys to a Routine?

Use Vaults — Claude Code’s secure credential storage. You store the secret once in the Vault, reference it by name in your Routine, and the agent receives it securely at runtime. Never paste API keys directly into your task prompt — they’ll appear in logs.

What happens if a Routine fails?

You’ll receive a notification (email or in-app, depending on your settings) with the error and logs from the session. You can inspect what the agent tried, where it stopped, and why it failed. Fix the prompt or underlying issue and re-run. Routines don’t automatically retry by default, though you can configure retry behavior in some plan tiers.

Are Routines available outside the US?

Claude Code itself is available in most regions where Anthropic operates. Routines run on Anthropic’s cloud infrastructure regardless of your location. However, the feature may roll out at different paces by region. Check the Claude Code Q1 2026 update roundup for the latest on regional availability and feature releases.

Can I run a Routine on-demand rather than on a schedule?

Yes. Every Routine has a “Run Now” option you can trigger manually at any time. This is useful for testing during setup, or for situations where you need to run the task outside its normal schedule. You can also use Dispatch to trigger Routines remotely from your phone.


Key Takeaways

  • Claude Code Routines let you schedule AI agents to run in Anthropic’s cloud on a fixed cadence — no server required.
  • Routines require the Max plan ($20/month) and run Claude in headless mode with access to your repo, shell commands, and stored credentials.
  • The most reliable Routines have tightly written task prompts, tested manually before activation, with state written to persistent storage if needed between runs.
  • Good use cases include daily reporting, codebase maintenance, data pipelines, QA runs, and research workflows.
  • Routines work well alongside Agent Teams, Dispatch, and the Heartbeat pattern for more sophisticated automation setups.
  • For building the application layer on top of your Routines’ output — dashboards, internal tools, data interfaces — Remy handles the full-stack side without requiring you to wire up infrastructure from scratch.

Presented by MindStudio

No spam. Unsubscribe anytime.