Modern Creator
Nate Herk | AI Automation · YouTube

Claude Code Scheduled Tasks: The 24/7 AI Employee

A 9-minute demo showing how native cron sessions turn any Claude Code skill into a self-healing, self-improving background agent.

Posted
2 months ago
Duration
Format
Tutorial
educational
Views
128.6K
2.9K likes
Big Idea

The argument in one line.

Claude Code scheduled tasks run a full agent on a cron, not a script, which means they self-heal errors, rewrite their own prompts, and improve over time when paired with a single overwritten run-log file.

Who This Is For

Read if. Skip if.

READ IF YOU ARE…
  • You already use Claude Code and have built at least one skill or automation you run manually.
  • You want background processes that run while you sleep without babysitting or permission prompts.
  • You have brittle Python cron scripts that error and stop with no recovery.
  • You are building a personal executive assistant layer on top of your Claude Code workflow.
SKIP IF…
  • You have never opened Claude Code — this tutorial assumes familiarity with skills and sessions.
  • You need server-side or headless automation — scheduled tasks require the desktop app open on an awake machine.
TL;DR

The full version, fast.

Claude Code now supports native scheduled tasks: a cron fires, a fresh session starts, the agent reads your prompt and tools, does the work, and closes with no human needed. Unlike a Python script, the agent self-heals errors and can rewrite its own code and prompt between runs. The critical design pattern is a single overwritten run-log file per task structured as Pre-Flight (read last run), Main Task, and Post-Run (overwrite log), which keeps context lean and lets each new session pick up where the last one left off without ballooning an append log.

Members feature

Chat with this breakdown.

Modern Creator members can chat with any breakdown — ask for the hook, quote a framework, find the exact transcript moment. Unlocks at T2: refer 3 friends + add your own API key.

Create a free account →
Chapters

Where the time goes.

00:0000:42

01 · Hook & Feature Announcement

Cold open frames scheduled tasks as a 24/7 AI employee. Two setup paths introduced: Schedule tab UI and /schedule slash command.

00:4201:16

02 · Creating a Task in the UI

Live demo of the New Scheduled Task form: name, description, prompt, model, folder, frequency. Morning coffee task shown active at 6:09 AM daily.

01:1601:42

03 · Scheduled Tasks: Prompt on a Cron

Illustrated flow: Cron Fires, Session Starts, Gets Tools, Runs & Closes. Establishes this is a full agent session, not a triggered function.

01:4202:23

04 · Script vs Agent

Side-by-side comparison diagram. Cron Script: fixed steps, no context, no recovery. Claude Code Agent: codebase, reasoning, skills, MCP tools, self-healing loop.

02:2303:11

05 · Morning Coffee Demo

Live conversion of an existing skill into a scheduled daily task using a single natural language prompt. Task live in under 60 seconds.

03:1103:42

06 · Skills Discovery

Demo showing Claude listing all available project skills on request, illustrating how any skill becomes a candidate for weekly automation.

03:4204:12

07 · The One Gotcha: Machine Must Be Awake

Illustrated slide: if the laptop is asleep the task is skipped, but on wake the app checks 7 days back and catches up. Time-sensitive tasks may not recover cleanly.

04:1205:08

08 · What Scheduled Tasks Cannot Do

Four-quadrant slide: No Git Push, No Destructive Ops, No Shared Memory by default, Needs Your Keys. Recommendation to do a manual test run first.

05:0806:08

09 · Self-Improving Loop: Three Layers

Illustrated three-layer diagram: fix scripts on error, rewrite own prompt when improvements are found, maintain a run log for memory across stateless sessions.

06:0807:06

10 · The Lean Strategy: One File Per Task

Live Claude conversation showing the recommended run-log pattern. One overwritten markdown file per task, not an append log. Prompt structure: Pre-Flight, Main Task, Post-Run.

07:0607:57

11 · Notifications, Hooks & External Alerts

Desktop app notification diagram. Audio hook demo. Recommendation to add a ClickUp/messaging step at the end of each task prompt for external notification.

08:1109:02

12 · Create vs Edit vs Run: Architecture

Three-section diagram showing the desktop app creates and runs tasks, the file system stores editable task files, and VS Code can edit but not create or trigger crons.

09:0209:43

13 · CTA & Close

Outro linking to a project setup video. Standard like/subscribe ask.

Atomic Insights

Lines worth screenshotting.

  • Claude Code scheduled tasks run a full agent session on a cron, not a script, so error recovery and self-modification are in play from the first run.
  • A cron script has no context and a fixed path; a Claude Code agent has your entire codebase, MCP tools, email, APIs, and reasoning.
  • The self-improving loop has three layers: fix its own code, rewrite its own prompt, and log state for the next run.
  • One overwritten log file per task keeps context under 30 lines and does not bloat the session token window the way an append log does after a thousand runs.
  • The prompt structure that works: Pre-Flight (read last log, fix known issues), Main Task, Post-Run (overwrite log with status, issues, state).
  • Tasks only run while the desktop app is open on an awake machine, making this a personal-machine automation pattern, not a server-side one.
  • If the machine was asleep, the app checks back 7 days on wake and runs missed tasks, useful but not reliable for time-sensitive work.
  • You can make tasks deterministic by having them just execute a script; agentic flexibility is opt-in, not forced.
  • The desktop app is the only place that can create or trigger scheduled tasks; VS Code and terminal can only read and edit the underlying files.
  • Setting up a task takes one sentence: tell Claude to turn your skill into a scheduled task at a given time and it handles the rest.
  • Always run a new task manually before leaving it on schedule to flush permission prompts that would otherwise pause an unattended run.
  • Deny lists in project settings are how you guard against destructive autonomous actions and should be configured before any task runs unsupervised.
  • Self-healing means the agent tries multiple alternatives when it hits an error, then updates itself so it does not repeat the mistake next run.
  • Shared memory between stateless sessions lives on disk: a markdown file the agent reads at start and overwrites at end.
Takeaway

Automation that fixes itself while you sleep.

WHAT TO LEARN

The shift from cron scripts to agent sessions is the difference between automation that stops when something breaks and automation that diagnoses the problem, fixes its own code, and runs correctly the next time.

  • Scheduled tasks run a full Claude Code agent, not a script, so error recovery, tool access, and self-modification are all in play from the first run.
  • The stateless design is intentional: each session starts clean to prevent context bloat, but requires an explicit on-disk memory pattern to accumulate improvement over time.
  • One overwritten log file per task, not an append log, keeps context short enough to fit in a session without degrading over hundreds of runs.
  • The three-layer self-improvement loop means fix code on error, rewrite the prompt when improvements are spotted, and update the run log each time, so a well-structured task gets more reliable the longer it runs unsupervised.
  • The desktop-app-only constraint is architectural, not a polish gap: the cron scheduling mechanism lives in the app, not in files any process can trigger.
  • Always run a new task manually before leaving it on schedule to flush permission prompts that would otherwise silently pause an unattended run.
  • Any existing Claude Code skill becomes a scheduled automation with one sentence of natural language instruction, making the activation cost near zero once the skill exists.
Glossary

Terms worth knowing.

Scheduled task
A Claude Code feature that fires a full agent session on a cron schedule from the desktop app, running a prompt with access to all project tools, then closing when done.
Self-healing agent
An agent that, when it encounters an error, tries multiple recovery approaches and then edits its own code or prompt so the same error does not recur on the next scheduled run.
Stateless session
A fresh Claude Code session with no memory of previous conversations; each scheduled task run starts from zero unless context is explicitly loaded from a file on disk.
Run log
A single markdown file per scheduled task that the agent overwrites at the end of each run with current status, issues, and state, giving the next session a compact handoff without accumulating history.
Pre-Flight / Post-Run
The two bookend phases of a well-structured scheduled task prompt: Pre-Flight reads the last run log and fixes known issues before the main task, Post-Run overwrites the log with new state after the main task completes.
Deny list
A project-level permission setting in Claude Code that explicitly forbids certain bash commands (like delete or remove), used to prevent autonomous tasks from taking destructive actions without review.
Quotables

Lines you could clip.

01:03
This is not a deterministic workflow. And that is the huge unlock.
The key reframe of the entire video in one sentence.TikTok hook↗ Tweet quote
02:20
You are no longer the bottleneck, and these skills and workflows can actually get better and better over time automatically.
Strong payoff line with clear emotional resonance.IG reel cold open↗ Tweet quote
06:32
If you run an automation a thousand times, then you might have a thousand append logs.
Vivid concrete consequence that makes the one-file pattern immediately obvious.newsletter pull-quote↗ Tweet quote
05:08
The only bridge between runs is files on disk.
Tight, quotable, captures the stateless architecture in 9 words.newsletter pull-quote↗ Tweet quote
The Script

Word for word.

00:00Cloud Code is now a twenty four seven AI employee, which means that it is always Cloud Code o'clock, and that might be the nerdiest thing I've ever said. Anthropic has finally done it and launched scheduled tasks natively for Cloud Code, which means every single process, every single skill, everything you've been building and using inside of Claude Code just got 10 times more powerful.
00:19And they literally could not be easier to set up. So in today's video, I'm gonna show you exactly how they work and tell you everything important that you need to know about them. Let's not waste any time and get straight into it.
00:27So here I am in Claude Code in the Claude desktop app. Now right now, you do need to be using the desktop app in order to access these scheduled tasks. Now this scheduled task feature came out about a week or two ago in Claude Cowork.
00:39As you can see, it's basically the exact same thing. You could create scheduled automations. But now they finally brought it to Cloud Code, and there's a few ways that you can set them up.
00:46The first way is you'd go over here to the schedule tab, and you just click on it, and you can see right here, run tasks on a schedule or whenever you need them, type slash schedule in any existing session to set one up. So those are the two ways. You can either click right here, new task.
00:59You can give a name, a description, give it a prompt. You can choose the model you want it to run on. You can choose the mode to run on, and you can also select the folder.
01:06And then finally, you just say, hey. I want this to run every hour, every day, every week. At this time, boom.
01:12You now have a scheduled automation. So that cron would basically fire off, the session would start up, and then the agent would read the prompt, it would go through your files, it would work in your project, do whatever it needed to do, and then after it's done, it would just stop. And the huge unlock here, which is so exciting to me, is that this isn't a deterministic workflow.
01:29And so there's some good there and there's some bad there, but the good news is that you can completely control it. And what I mean by that is if you've been following some other Cloud Code videos I've done in the past, we build either like a Python script or a TypeScript, and that is the actual automation, and that is deterministic logic code.
01:44Meaning that will always happen step one, step two, step three. If there's an error, it can't fix itself. It just errors and then we get notified.
01:50But this isn't just a Python script. This is ClaudeCode agent running the same exact way it runs when you talk to it. And that's why this is so exciting because agentic workflows are self healing, and they can read everything in your entire project and use all your tools.
02:03So as you guys know, you tell it to go do something and it starts trying. If it runs into an error, it doesn't just come back and say, I tried. It says, okay.
02:10Here's the error. Let me try three other things. And then after I see which one of those three other things work best, I'm gonna update myself so that I never run into that error again.
02:18So now you are no longer the bottleneck, and these skills and these workflows can actually get better and better over time automatically. The other important thing to remember here is if you do want it to be more deterministic and you want more control, you can do that. Because you could literally have it just execute a script and that's the whole scheduled task, and it just is completely deterministic that way.
02:35So how do you go ahead and start creating some scheduled tasks? Well, here you can see one I have is called morning coffee. So I've showed this one off before in a few other videos.
02:42But, basically, every single morning, I would open up my Cloud Code, and I would say, hey. Run morning coffee, which would help me plan my day. It would look at my commitments.
02:49It would look at the projects and help me catch up on what the team is up to. But now this can actually just run automatically at 6AM every morning. And literally all that I did to set this up was I said, take a look at my morning coffee skill.
02:59I would like to turn this into a scheduled task that goes off every morning at 6AM. Help me get this set up. It read the skill.
03:05It complimented me on the skill, and then it asked me one question about it. Then And a minute later, my skill that I run every morning is now automated. And if you've never used Cloud Code in the desktop app, don't worry.
03:14It's super easy. You can basically pull in, you know, a GitHub repo or a different folder, and you can be working in the exact same project that you're used to. So right here in the new session, I just asked it, what skills do you have in this project?
03:24And it came back and said, hey. Here are all the active skills. We've got content creation.
03:27We've got research and intelligence. We've got visual diagrams, operations, and meta. And now any of these skills, I could just say, okay.
03:33Cool. Turn that into a weekly automation. Alright.
03:36So there are a few limitations though. The first major gotcha is the fact that your laptop has to be on or your computer has to be on, and the desktop app has to be open. So if you turn off your computer, that automation will not run.
03:47And the good news is let's say you had a task for 7AM and you wake up at eight, you turn on your computer, Cloud Code would actually check back seven days and see any scheduled task that it missed and then would catch up and it would run those. Obviously, that's not perfect because some of those may be time sensitive, but it is cool that it has that ability.
04:02Now what are some other things to think about? Well, the first one is that this thing is now running without your supervision. And ideally, it's not gonna stop to ask you questions because then what's the point of having it automated?
04:12So that means you want to be looking at your permissions to make sure that it can't actually go off the rails and do anything, like maybe make a major change to your GitHub repository or go off and delete things. And you can take care of that by changing your local settings in that project, which you could just say, hey.
04:26I wanna make sure that you never delete things. How can I put this in your settings? You know, deny a bash command that does any deletes or removes, and it will help you figure that out.
04:34I've got a video coming about this. I will tag that right up here once that is live on YouTube. These are also stateless.
04:40So basically, every time that you run one of these, it's going to throw it in in a new session. So right here, I did a test run of my morning coffee. Here's the actual task itself.
04:48And then when I open this up, I will be able to see every run. And every run is going to be fresh, and it's not going to have context of what happened on the previous run. And the other thing, of course, is that if you didn't put in an API key or if there's literally something that it can't do because it needs your permission, it's gonna stop.
05:01So what I'd recommend is as soon as you create a new task, just run it manually and make sure that it can go through all of the steps without oversight. Otherwise, what's gonna happen is it's gonna pause and it's gonna ask you for permissions to do this and permissions to do that. Now sometimes it's a good thing that they're stateless and that they don't have shared memory, but sometimes you might want them to.
05:18And that would be kind of part of this whole self improving thing. So here's how I imagine the self improving loop working. So first of all is fixing the actual script.
05:27So you can have in there the fact that if it errors, edit your own code and make sure you're fixed. The second layer is the prompt. So if you realize that there's an opportunity to improve this prompt, rewrite it, and now you have a new prompt.
05:38And then the third one is potentially having a log for memory. Whether that means every single run, you put some sort of, like, status of what that run did, or maybe you just have a file that you overwrite so that every time when the new agent wakes up, it can look at the log and say, hey. This is what the previous agent just did.
05:52Now I need to run. So there's lots of ways that you can kind of tweak these scheduled tasks to fit your use cases better. And once again, because they have the context of everything in that project, they're gonna be super powerful.
06:02They can look at any file that you want them to. So that's what my brain immediately went to, but I wanted to see what Claude Co. Thought.
06:08So I asked it what it thought the most optimal strategy was to make these improve and make sure they have the right context. So what it thought of was a lean strategy where you have one file per task. So basically, every single time the agent runs, it would overwrite this file with information like, here's the last run, here's how long it lasted, here's what happened, here's what I did, here are known issues, and things like that.
06:29And this is better than an append log in some scenarios because like I said earlier, if you run an automation a thousand times, then you might have a thousand append logs. But then what's cool is the actual structure of your prompt.
06:39So when you're creating a new task right here, the way that you prompt it, you could basically say, okay. Before you actually do your job, go ahead and read this file, which is basically the last run.
06:49And then you do your main task, and then after you're done with the task, overwrite that file with any current issues or status or anything that you found that might help the next agent. So obviously, I'm gonna be playing around with different structures of having context shared between these different, you know, tasks, but that's just something that I thought would be really, really cool.
07:05So another thing I wanted to talk about is because this is in the desktop app and because this is running on a schedule, how do you want to get notified that that scheduled task has been done? So the desktop app does have notifications, but they're not super great. At least it wasn't making any noise and it wasn't capturing my attention.
07:20It's cool that everything gets organized over here, so as you have more tasks, you can see them all and it's organized. But what you can do is you can add a hook so that every time you actually get a sound. So what I did is I set up a hook so that every time a ClaudeCode session finishes, I get a notification.
07:34So listen to this.
07:38So that was like kind of the default Windows little sound. You can change that. But But that's really helpful because I could be working and I could forget that a scheduled task might go off and then I get that noise.
07:46But the other thing I would recommend is in the prompt of the actual skill itself, maybe just at the bottom say, hey. Once this is done, just shoot me a ClickUp message and say that this happened. And that's probably what I'm gonna set up for all my scheduled tasks.
07:58And if you're curious about setting up hooks, literally just say to Cloud Code, set up a hook. I want you to play a sound every time you finish talking to me, and it will do it in, a minute. And the last thing I was curious about is the fact that we're limited to the desktop app.
08:11Now Anthropic is shipping like crazy, so I'm sure in a week or two that this is gonna be open in the terminal and in the IDE extensions and stuff like that too. But for the moment, it's only desktop app. And basically why is because all of the actual, like, cron logic and that kind of metadata lives in the desktop app even though the actual files live in your computer.
08:31They live somewhere where terminal or your Versus Code, Cloud Code could actually see it. So I was interested in that, and I said, are you able to see my scheduled task for morning coffee? It runs at 06:09, and here's where it lives because it lives kind of in this global folder path right here.
08:46And it can see it. Right? Because it just exists as a file.
08:49But what it can't do is it can't create new scheduled tasks because it can't actually touch the cron that the desktop app of Cloud Code sets up. But what it could do is it could edit it.
08:59So it could improve it. It could make changes, but it can't create them or, like, run them.
09:04Now that's actually not a huge deal to me right now because I usually work in Versus Code, but I can just have the desktop app open, and I can just leave it open in the background while I've got my computer on, and all of my scheduled tasks will still be running. And so now that Cloud Code is so powerful on its own, it can actually, like, do things in the browser as well.
09:20I truly think we're getting to that point where you can automate anything. So I'm gonna go ahead and stop talking. What you need to do now is go learn how to set up your project and create your own executive assistant to become way more productive and start to schedule some stuff.
09:31Go ahead and watch this video right up here. So, hopefully, I'll see you guys over there, but that is gonna do it for today. So I appreciate you guys making it to the end.
09:37And if you enjoyed the video or you learned something new, please give it a like. It helps me out a ton, and I'll see you on the next one. Thanks, everyone.
The Hook

The bait, then the rug-pull.

A clock graphic, a deadpan punchline, and a feature that actually delivers: Claude Code can now run your skills on a schedule while you sleep, with no babysitting required.

Frameworks

Named ideas worth stealing.

05:08model

Self-Improving Task Loop

  1. Layer 1: Fix Scripts (Error to Edit Code to Fixed)
  2. Layer 2: Update Prompt (Old Prompt to Rewrites Itself to New Prompt)
  3. Layer 3: Log as Memory (Last Log to Learns Each Run to New Log)

Three-layer architecture that lets a scheduled task improve over time without human intervention: fix broken code on error, rewrite the prompt when improvements are found, maintain a run log so the next stateless session has context.

Steal forAny long-running background automation that needs to stay reliable without regular manual tuning.
06:08model

Pre-Flight / Main Task / Post-Run Prompt Structure

  1. Pre-Flight (30s): Read run-log.md, fix known issues before starting
  2. Main Task: Execute the actual skill or automation
  3. Post-Run (30s): Overwrite run-log.md with status, issues, state for next run

Three-phase prompt structure that gives each stateless scheduled task session a lightweight memory without bloating context.

Steal forStructuring any Claude Code skill that will run repeatedly or autonomously over time.
01:42model

Script vs Agent Decision

  1. Cron Script: deterministic, fixed path, no recovery, no context
  2. Claude Code Agent: full codebase access, MCP tools, reasoning, self-healing, can rewrite itself

Framework for deciding when to use a traditional cron script vs a Claude Code scheduled agent based on need for error recovery, dynamic reasoning, and self-improvement.

Steal forAny automation planning session where you are deciding how much resilience and adaptability you need vs how much predictability you need.
CTA Breakdown

How they asked for the click.

09:02next-video
What you need to do now is go learn how to set up your project and create your own executive assistant.

Clean end-of-video link to prerequisite setup video. No hard sell. Appropriate given the tutorial format.

Storyboard

Visual structure at a glance.

hook
hookhook00:00
title card
hooktitle card00:07
schedule UI
valueschedule UI00:18
cron flow diagram
valuecron flow diagram01:16
script vs agent
valuescript vs agent01:42
self-healing loop
valueself-healing loop02:07
one gotcha
valueone gotcha03:42
what it cannot do
valuewhat it cannot do04:12
self-improving layers
valueself-improving layers05:08
lean strategy
valuelean strategy06:08
desktop app loop
valuedesktop app loop07:06
create vs edit vs run
valuecreate vs edit vs run08:11
outro
ctaoutro09:02
Frame Gallery

Visual moments.