Claude Code Agent Loops: What They Actually Do
Claude Code Agent Loops: What They Actually Do (And Don't Do)
Claude Code's new /loop command lets you run recurring scheduled tasks within a single terminal session — but it's not a 24/7 autonomous agent. It expires after 3 days, dies when you close your terminal, and runs inside your current session. It's still a genuinely useful productivity feature for repetitive micro-tasks during active work sessions. But the hype machine has already gone off the rails, and you need the real picture before you waste time trying to build something /loop was never designed for.
I saw the announcement drop less than 24 hours ago, and within minutes there were already videos calling this "Claude 2.0" and showing people how to "talk to Claude Code via Telegram" using agent loops. None of that is accurate. So let me break down what's actually going on — because the scheduled tasks space in Claude Code is surprisingly confusing, and the loop feature is just one piece of a bigger puzzle.
What Are Agent Loops in Claude Code?
Agent loops are a new /loop command in Claude Code's CLI that lets you schedule recurring tasks within your current terminal session. You type /loop, set an interval, and give it a prompt. By default, it runs every 10 minutes, but you can customize the timing — every 5 minutes, every hour, every morning.
Boris Cherny, the creator of Claude Code at Anthropic, shared some example use cases when the feature launched:
/loopbabysit all my PRs, autofix build issues, and when comments come in, use a work tree agent to fix them- Every morning, use the Slack MCP to give me a summary of the top posts I was tagged in
Sounds powerful, right? And it is — within its actual scope. The problem is people are reading these examples and imagining a persistent background agent that runs forever. That's not what this is.
What Are the Limitations of Claude Code /loop?
Here's the thing — the limitations are significant, and they define when this feature actually makes sense. Let me lay them out clearly:
- 3-day expiration. Every loop automatically shuts off after 3 days. Period. You can't extend it.
- Session-based. The loop only runs while that specific terminal session is open. Close the terminal? It's gone.
- Computer must stay on. If your machine goes to sleep, the loop stops. If you shut down, it's dead.
- Runs in the current session. All loop output appears in the same terminal window you're working in. There's no background process.
- Can interrupt your workflow. If you're actively chatting with Claude Code and a scheduled loop fires, you have to pause. It won't stop mid-task for you — it'll deliver the output when it finishes, but you're sharing one session.
So when someone tells you this is a "24/7 agent," they're ignoring that it requires your terminal open, your computer awake, and resets every 72 hours. That's not 24/7 anything.
What Is /loop Actually Good For?
Given those constraints, agent loops are best for repetitive micro-tasks during an active work session — think of them as automating things you'd otherwise be doing manually every few minutes or hours while you're already working in Claude Code.
Here are use cases that actually make sense:
- Every 10 minutes, check the deployment status of your website and make sure it's still up
- Every 5 minutes, run Playwright tests and verify form submissions still work
- Every hour, scan error logs and flag anything unusual
- Monitor your PR pipeline during an active sprint and autofix build issues as they come in
Think of /loop almost like a skill — or a skill of skills. You're taking something you'd constantly be doing manually inside Claude Code and automating the cadence. That's a real productivity boost. It's just not the autonomous agent people are pretending it is.
Using it is dead simple: type /loop, set your time interval (5 minutes, 1 hour, every morning), and write a prompt describing what you want done.
How Does Claude Code Desktop Handle Scheduled Tasks Differently?
This is where it gets interesting, and where most of the confusion lives. Claude Code Desktop actually has more powerful scheduling capabilities than the CLI's /loop command. For all the hype around agent loops, Desktop has been quietly doing this better for a while.
In Claude Code Desktop, you can go to the scheduled tasks section and hit "New Task" — or use the /schedule command. Here's how it compares:
| Feature | CLI (/loop) | Claude Code Desktop |
|---|---|---|
| Expires | After 3 days | Never — runs in perpetuity |
| Survives restart | No | Yes |
| Session-based | Yes (same terminal) | No (creates new sessions) |
| App needs to be open | Terminal must stay open | Desktop app must be open |
| Computer must be on | Yes | Yes |
| Interrupts your work | Yes (shared session) | No (separate sessions) |
The big differences: Desktop scheduled tasks don't expire, survive restarts, and create their own sessions so they don't interfere with whatever you're doing. When a scheduled task fires in Claude Code Desktop, it's like opening a new terminal window in the background. Your current work stays untouched.
There's a catch to be aware of, though. Because Desktop creates a new session every time the scheduler runs, frequent schedules can pile up. If you schedule something every minute, you'll have 60 separate sessions after an hour. So be mindful of your intervals.
The bottom line: if you need a recurring task that runs daily (like a morning report), use Claude Code Desktop. If you need something monitored during an active 1-3 day work sprint, /loop in the CLI works great.
Boris Cherny's own example of "every morning use the Slack MCP for a summary" is actually a terrible fit for the CLI — you'd have to re-enter that command every 3 days. That's a perfect Claude Code Desktop task.
What About Claude Code with GitHub Actions?
GitHub Actions is the one option where your computer doesn't need to be on at all. Claude Code can execute tasks inside GitHub Action workflows, running entirely on GitHub's infrastructure. No terminal. No Desktop app. No local machine required.
But here's the scope limitation: GitHub Actions is scoped to GitHub-related work. It makes perfect sense for:
- Automated PR reviews
- Code implementation checks
- Build and deployment workflows
- CI/CD pipeline tasks
It does not make sense for "I want to talk to Claude Code via Telegram" or general-purpose agent tasks. GitHub Actions runs Claude Code as part of repository workflows — it's not a general compute environment for arbitrary Claude Code tasks.
What About Claude Code Remote Control?
Remote Control is another feature that gets thrown into this conversation. It lets you connect to a running Claude Code session from another device — your phone, a tablet, a web browser. Sounds like it could solve the persistence problem, right?
Not really. Remote Control is also session-based. It connects to a specific running session on your machine. If that session ends, if your terminal closes, if your computer shuts down — the remote connection dies too. It supports only one remote connection per session, and extended network outages (around 10 minutes) will time out and require a restart.
Remote Control is great for checking in on a long-running task from your phone. It's not a solution for persistent, always-on agent behavior.
When Should You Use Each Claude Code Scheduling Option?
Most people get this wrong because they don't realize there are multiple options with different strengths. Here's the decision framework:
Use /loop (CLI) when:
- You need something monitored during an active work session
- The task is tied to a specific project you're working on right now
- You're fine with a 1-3 day window
- Example: "Every 10 minutes, check if our deployment is still healthy"
Use Claude Code Desktop scheduling when:
- You need a recurring task that runs indefinitely
- You want it to survive restarts
- You don't want it interrupting your current work
- Example: "Every morning, summarize my Slack mentions from overnight"
Use GitHub Actions when:
- The task is GitHub/repo-scoped
- You need it running regardless of your machine state
- Example: "Review every new PR and flag potential issues"
Use Remote Control when:
- You want to check in on an active session from another device
- You're running a long task and want to monitor from your phone
- Example: "I kicked off a big refactor and want to approve permissions from the couch"
It's a shame that the CLI doesn't have Desktop's scheduling power yet, but I'd expect that gap to close over time. For now, know which tool fits your situation.
FAQ
Does Claude Code /loop run in the background?
No. The /loop command runs inside your current terminal session. It doesn't create a background process. If you close that terminal window, the loop ends. Your computer also needs to stay awake — sleep mode kills it. All output from the loop appears in the same terminal you're working in.
How long can a Claude Code agent loop run?
Agent loops in Claude Code expire after a maximum of 3 days. After 72 hours, the loop automatically shuts off regardless of whether your session is still active. If you need something to run indefinitely, use Claude Code Desktop's scheduling feature instead, which has no expiration.
Is Claude Code /loop the same as Claude Code Desktop scheduled tasks?
No — they're different features with different capabilities. /loop is CLI-only, session-based, and expires after 3 days. Claude Code Desktop scheduled tasks are persistent, survive restarts, create separate sessions, and run indefinitely. Desktop scheduling is more powerful for long-term recurring tasks, while /loop is better for short-term monitoring during active work.
Can Claude Code run as a 24/7 autonomous agent?
Not with current features. Every scheduling option in Claude Code requires either your terminal open, the Desktop app running, or (in the case of GitHub Actions) tasks scoped to GitHub workflows. There is no fully persistent, always-on agent mode yet. The closest you can get is Claude Code Desktop scheduling with your computer always on and the app open.
What is the default interval for Claude Code /loop?
The default interval is every 10 minutes if you don't specify one. You can customize this with a leading token like /loop 5m check the build or a trailing clause like /loop check the build every 2 hours. Intervals can range from minutes to hours to daily.
If you want to go deeper into Claude Code workflows and automation, join the free Chase AI community for templates, prompts, and live breakdowns. And if you're serious about building with AI, check out the paid community, Chase AI+, for hands-on guidance on how to make money with AI.


