How to Use Claude Code Scheduled Tasks and Routines for Business Automation
Claude Code Routines run on a schedule or webhook trigger without keeping your computer on. Learn how to set them up for email triage, proposals, and more.
What Claude Code Scheduled Tasks and Routines Actually Are
If you’ve used Claude Code for any real work, you’ve probably run into the same wall: Claude is powerful, but it only runs when you’re sitting at your terminal. Close the laptop, and everything stops.
Claude Code Routines — also called scheduled tasks — solve that problem directly. They let you define a workflow once, attach a schedule or a webhook trigger, and have Claude execute it automatically, without your computer being open, without your terminal running, without you being anywhere near it.
This guide covers how they work, how to set them up, and which business automation use cases they’re actually well-suited for.
How Claude Code Routines Work
At a basic level, a Routine is a Claude Code task that runs on a trigger rather than on manual invocation. Two trigger types matter here:
- Schedule-based: The task runs at a defined interval — hourly, daily at 6 AM, every Monday morning, etc.
- Webhook-based: The task runs when an external system sends an HTTP POST to a specific endpoint.
The underlying mechanism varies depending on how you’re hosting things. In a self-managed setup, you might use a cron job on a cloud server, GitHub Actions on a schedule, or a platform like Trigger.dev to manage the execution environment. In a managed setup, the hosting provider handles the scheduling infrastructure entirely.
What makes this different from a traditional automation script is that the agent can reason about what it encounters. It’s not just moving data between fields — it can read an email, determine intent, classify urgency, draft a reply, and decide whether to send it or queue it for review. That’s the meaningful distinction between agentic workflows and traditional automation.
Setting Up Your First Scheduled Task
Step 1: Define the Task in a CLAUDE.md File
Before anything can run on a schedule, you need a clearly defined task. Claude Code uses a CLAUDE.md file in your project root as the agent’s operating context. This is where you describe what the agent should do, what tools it has access to, what outputs to produce, and how to handle edge cases.
A good Routine definition looks something like this:
## Email Triage Routine
Run at 7:00 AM daily.
1. Connect to Gmail via the gmail MCP tool.
2. Fetch all unread emails received in the last 24 hours.
3. Classify each email as: urgent/action-required, FYI, newsletter/promo, or unknown.
4. For urgent emails, draft a reply and save it as a draft in Gmail.
5. For FYI emails, apply the "Read Later" label.
6. For newsletters, apply the "Promotions" label and mark as read.
7. Output a summary report to Slack channel #morning-briefing.
Keep instructions explicit. Claude will attempt to interpret ambiguous instructions reasonably, but a well-specified task produces consistent results across runs.
Step 2: Choose Your Execution Environment
Your Routine needs somewhere to run. Options include:
- A cloud VM or server running Claude Code in headless mode, with a cron job triggering execution. This is covered in detail in how to keep your Claude Code agent running 24/7.
- GitHub Actions with a scheduled workflow. This works well for repository-adjacent tasks and is explored in how to use GitHub Actions to run scheduled experiments.
- Trigger.dev or similar platforms for event-driven and scheduled agentic tasks.
- Anthropic’s managed agents infrastructure, which abstracts away the hosting entirely. See what Anthropic’s Managed Agents offers for details on that option.
If you’re not sure which fits, Claude Code Loop vs Scheduled Tasks breaks down when each approach makes more sense.
Step 3: Configure the Trigger
For schedule-based execution:
If you’re using a Linux server, a cron entry like this runs your Routine at 7 AM daily:
0 7 * * * /usr/local/bin/claude --headless --task email_triage
If you’re using GitHub Actions:
on:
schedule:
- cron: '0 7 * * *'
For webhook-based execution:
Set up an endpoint that your external system can POST to. When the request arrives, your server invokes the Claude Code task with any relevant payload data passed as context.
For example, a form submission could trigger a proposal generation Routine. When a lead fills out a contact form, the webhook fires, Claude receives the form data, and the Routine generates a draft proposal within minutes. AI-powered forms with webhook integration covers the mechanics of this pattern in depth.
Step 4: Grant Tool Access
A Routine that can’t touch external systems isn’t useful for most business tasks. You’ll need to configure MCP (Model Context Protocol) tools or direct integrations depending on what the task needs to access:
- Gmail or Outlook for email tasks
- Google Calendar or Calendly for scheduling tasks
- Slack or Teams for notifications and reports
- CRM systems via API for lead and client data
- Google Docs or Notion for document creation
Claude Code’s headless mode allows tool use without an interactive terminal session. What Claude Code headless mode enables walks through the specific flags and configuration.
Step 5: Add Logging and Error Handling
Automated tasks fail silently if you don’t instrument them. Add:
- Output logging to a file or structured log service
- Slack or email notifications on failure
- Retry logic for transient API errors
- A summary output at the end of each successful run
This is especially important for tasks touching customer-facing data, like sending emails or updating CRM records.
Business Automation Use Cases That Work Well
Email Triage and Priority Inbox
This is one of the highest-value Routines for most business owners and operators. Rather than manually sorting through 50–100 emails every morning, a scheduled task runs before you start your day and does the following:
- Flags genuine action items
- Drafts replies to common patterns (meeting requests, status check-ins, vendor follow-ups)
- Archives newsletters and promotions
- Creates tasks in your project management tool for items requiring follow-up
The key advantage over a traditional email filter is that Claude understands context. It can recognize that a message from a new prospect asking about pricing is higher priority than a message from an existing client asking a question already answered in the FAQ — and act accordingly.
For deeper coverage of this pattern, see AI email parsing for automated data entry.
Proposal and Document Generation
Webhook-triggered Routines shine here. The flow looks like this:
- A prospect fills out a lead intake form on your website.
- The form submission triggers a webhook.
- Claude receives the prospect’s name, company, industry, and stated needs.
- The Routine fetches relevant case studies and pricing templates from your knowledge base.
- It generates a first-draft proposal in Google Docs and shares it with your sales team.
A human still reviews and sends it, but the 45 minutes of pulling together a proposal draft is gone. This is explored further in building an AI executive assistant with Claude Code and Google Workspace.
Daily Briefings and Reporting
Schedule a Routine to run at 7 AM that:
- Pulls the previous day’s metrics from your analytics platform
- Summarizes key changes and anomalies
- Formats a concise briefing and posts it to Slack
This is similar in spirit to building an AI news digest agent with Claude Code and Trigger.dev — the pattern of pulling information, synthesizing it, and delivering a structured output on a schedule.
CRM Hygiene and Follow-up Prompts
Sales pipelines degrade fast when nobody’s updating records. A weekly Routine can:
- Check for deals that haven’t been updated in more than 7 days
- Flag them with a note in your CRM
- Generate a short list of follow-up actions and send it to the responsible rep
This is lower-friction than building a full CRM automation, and it catches the cases that slip through structured rules.
Content Publishing Workflows
A scheduled Routine can handle the mechanical parts of content operations:
- Pull approved drafts from Notion or a shared doc
- Format them for a specific platform
- Schedule or publish via API
For social media specifically, using Blotato with Claude Code to automate social media posting walks through a concrete implementation.
Newsletter and Digest Compilation
If you send a weekly newsletter or internal digest, a Routine can do the heavy work. It reads a curated list of sources, selects relevant items, writes summaries, and formats the draft. You review and send. This is the same pattern covered in building a newsletter automation agent with Claude Code.
Chaining Routines Into Larger Workflows
Individual Routines are useful. But the real productivity gains come from chaining them together. This is what distinguishes a scheduled task from an agentic operating system.
A simple example: a morning email triage Routine identifies a high-priority inbound lead. It writes a summary to a shared file. A second Routine, triggered by the presence of that file, pulls the lead data and fires the proposal generation workflow. A third Routine, running at end of day, checks whether the proposal was sent and adds a follow-up task to the CRM if not.
Each Routine is simple and testable on its own. Chained together, they handle an end-to-end business process without human intervention between steps.
For architecture patterns that support this kind of chaining, building an agentic business OS with Claude Code is worth reading. The agentic OS heartbeat pattern is also relevant for keeping multi-step pipelines active and self-correcting.
Common Mistakes to Avoid
Underspecifying the task. Vague instructions lead to inconsistent behavior across runs. Write your CLAUDE.md task descriptions as if you were onboarding a new employee: explicit steps, defined outputs, clear rules for edge cases.
Skipping dry runs. Before scheduling a task that touches live data, run it once manually with logging enabled. Verify it behaves as expected before letting it run autonomously.
No error handling. A Routine that fails silently is worse than no automation at all — you won’t know data was missed or an email wasn’t sent. Build notification logic in from the start.
Over-automating before validating. Start with tasks where Claude produces a draft that a human reviews before anything is sent or committed. As you build confidence in reliability, extend autonomy gradually.
No rate limiting or de-duplication. If your Routine processes emails, make sure it marks items as processed. Running the same Routine twice shouldn’t produce double replies or duplicate CRM entries.
Where Remy Fits Into This Picture
If you want to take Claude Code Routines further and embed them in a full-stack application — complete with a database, backend logic, auth, and a real UI for managing and reviewing agent outputs — that’s where Remy becomes relevant.
Remy compiles annotated specs into full-stack applications. You describe what your automation app should do in a structured spec document, and Remy produces the backend, database, frontend, and deployment. The result isn’t a prototype — it’s a real application with SQL persistence, authentication, and a live URL.
For example: if you want a web interface where your team can review Claude’s drafted proposals before they go out, set approval thresholds, view a history of automated actions, and configure Routine settings — that’s a full-stack app. Building it from scratch takes weeks. Describing it in a spec and letting Remy compile it takes significantly less time.
The code Remy generates is real TypeScript. You can read it, extend it, and integrate it with your existing Claude Code Routines. The spec stays as the source of truth — so as your automation needs evolve, you update the spec and recompile rather than digging into application code.
You can try Remy at mindstudio.ai/remy.
Frequently Asked Questions
What is a Claude Code Routine?
A Claude Code Routine is an automated task that runs Claude Code on a defined trigger — either a cron schedule (time-based) or a webhook (event-based) — without requiring a human to be present at the terminal. You define the task once in your project’s CLAUDE.md file, configure the trigger in your hosting environment, and the agent executes it autonomously on schedule.
Do I need my computer on for Claude Code scheduled tasks to run?
No. That’s the core point of moving to Routines. The task runs on whatever server or managed infrastructure you’ve configured for execution. Your laptop can be off entirely. This is covered in more detail in how to keep your Claude Code agent running 24/7.
What’s the difference between Claude Code scheduled tasks and the /loop command?
The /loop command keeps a task running repeatedly within an active terminal session. It’s useful during development and for tasks that need to run continuously while you’re working. Scheduled tasks are independent of any open session — they trigger at defined times or events and run on infrastructure that doesn’t depend on your local machine being active. If you’re deciding which to use, Claude Code Loop vs Scheduled Tasks covers the tradeoffs directly.
Can Claude Code Routines use external tools like Gmail or Slack?
Yes, through MCP (Model Context Protocol) tool integrations. You configure which tools the agent has access to in your project setup, and the Routine can use those tools during execution. Common integrations include Gmail, Google Calendar, Slack, Notion, and CRM APIs. The agent can read from and write to these systems autonomously as part of the task.
How do webhook-triggered Routines work?
You set up an endpoint that external systems can POST to. When the webhook fires — for example, a form submission, a CRM event, or a payment confirmation — your server receives the payload and invokes the Claude Code task with that data as context. The agent then uses the payload to complete the task. This is a common pattern for proposal generation triggered by lead intake, or for processing data from AI-powered forms.
How reliable are Claude Code Routines for production business use?
Reliability depends on how carefully the task is specified and how robust your error handling is. Claude Code is capable of handling complex, multi-step tasks consistently — but like any automation, the quality of outputs tracks closely with the quality of instructions. Starting with tasks where outputs are reviewed by a human before taking effect (draft proposals, email drafts, report summaries) is the safer approach before extending to fully autonomous actions. Building self-improving AI agents with scheduled tasks covers patterns for iterating on reliability over time.
Key Takeaways
- Claude Code Routines run on a schedule or webhook trigger without requiring an active terminal session or open laptop.
- Two trigger types: time-based (cron schedule) and event-based (webhook from external systems).
- Execution environments include cloud servers, GitHub Actions, platforms like Trigger.dev, and Anthropic’s managed infrastructure.
- High-value use cases include email triage, proposal generation, daily briefings, CRM hygiene, and content publishing.
- Individual Routines chain together into end-to-end automated workflows, replacing manual handoffs between tasks.
- Start with human-in-the-loop review before extending to fully autonomous actions.
- If you want a full application layer — UI, database, auth — around your Routines, Remy compiles that from a spec without requiring you to build the infrastructure yourself.