CLAUDE LABJP
MEMORY — Claude Code closes a cluster of long-session memory leaks, including MCP stdio stderr piling up to 64 MB per server and LSP documents staying open indefinitelyTABLES — Very large markdown tables no longer stall rendering; tables over 200 rows now show the first 200 with a "… N more rows" noticeSPEED — Sessions carrying many deny/ask permission rules no longer lose seconds every turn: rule matchers are compiled once and cachedTOOLS — print/SDK sessions with many MCP tools get up to 7x faster tool rounds thanks to cached tool-pool assemblyARTIFACTS — Claude Code Artifacts turn session work into live, shareable web pages that update in place — useful for PR walkthroughs and dashboardsDEADLINE — Opus 4.7 fast mode is removed on July 24; speed: "fast" will error, so move to Opus 4.8 fast mode before thenMEMORY — Claude Code closes a cluster of long-session memory leaks, including MCP stdio stderr piling up to 64 MB per server and LSP documents staying open indefinitelyTABLES — Very large markdown tables no longer stall rendering; tables over 200 rows now show the first 200 with a "… N more rows" noticeSPEED — Sessions carrying many deny/ask permission rules no longer lose seconds every turn: rule matchers are compiled once and cachedTOOLS — print/SDK sessions with many MCP tools get up to 7x faster tool rounds thanks to cached tool-pool assemblyARTIFACTS — Claude Code Artifacts turn session work into live, shareable web pages that update in place — useful for PR walkthroughs and dashboardsDEADLINE — Opus 4.7 fast mode is removed on July 24; speed: "fast" will error, so move to Opus 4.8 fast mode before then
Articles/Claude.ai
Claude.ai/2026-03-12Beginner

Using Claude Code's /loop and Cron Scheduling as a Background Worker — What I Learned

A hands-on record of folding Claude Code's /loop command and cron-style scheduling into everyday personal-project tasks. Covers the basic syntax, the gotchas I only found by using it — tasks that vanish after 3 days, tasks that fire only when idle — and how to decide what belongs on a real cron instead.

claude-code128automation93scheduling2workflow37

As an indie developer juggling several small apps, between sessions I kept wishing the late-night chores — reviewing pull requests, watching an error log — could happen while I slept. But standing up a server cron just for that, and then babysitting it, felt like too much. So when Claude Code added the /loop command, I pointed it straight at that "light, always-on" work and ran it for a few weeks.

The short version: the convenience was everything I'd hoped for, but if you treat it like a plain cron, a few habits will trip you up. Below is the basic usage, plus the gotchas I only understood after getting burned, and where I ended up drawing the line between what /loop should handle and what belongs elsewhere.

The basics — schedule a repeat in one line

/loop runs any prompt or slash command on a fixed interval. The syntax is just an interval followed by what to run.

/loop [interval] [prompt or command]

To review a specific pull request every two hours, for instance:

/loop 2h /review-pr 1234

As long as the session stays open, PR #1234 gets reviewed automatically every two hours. Intervals use the units below, and if cron syntax isn't your thing, you can describe the interval in plain language and Claude will interpret it.

UnitNotationExample
Secondss30s
Minutesm15m
Hoursh2h
Daysd1d

The first two I set up were log monitoring and tests.

/loop 15m Check logs/error.log and report only the key points of any critical errors
/loop 30m Run the test suite, and if anything fails, investigate the cause and fix it

Catch log anomalies every 15 minutes, run tests every 30. Without anyone watching, by morning the conversation had a running record of what broke and what got fixed. That part was exactly as pleasant as I'd imagined.

Three quirks I only learned by using it

The trouble showed up when I trusted it the way I'd trust a plain cron. I'd read the docs and thought I understood these three points — but I only really learned them after dropping the ball.

Close the session and everything disappears

/loop tasks fire only while Claude Code is running and idle. Close the terminal or end the session, and every registered task is cancelled together. Once, I shut my laptop and headed out, and came home to find nothing had run at all. Unlike a cron on a server, it doesn't keep going once you walk away from the machine. If you want it resident, you have to plan around keeping the terminal open and the machine awake.

Tasks auto-expire after 3 days

Each task has a three-day lifespan from creation. After firing one last time, it quietly deletes itself. If you assume "set it once and it runs forever," you'll be puzzled when the task is simply gone the following week. It's a poor fit for anything you want running permanently. Treat it as a tool for lightening the work of these particular few days, and it fits.

It only fires when idle

When Claude Code is busy with other work, scheduled tasks wait for a gap. While I was deep in an interactive implementation, that 15-minute log check did not arrive neatly every 15 minutes. For anything that needs a strict clock — "aggregate at the top of every hour, no exceptions" — it's safer to look elsewhere.

Deciding between /loop and a real cron

Once those quirks sink in, /loop's sweet spot comes into focus. I settled on this split.

  • Work that wraps up in a few days and only needs to happen while I'm around → hand it to /loop (PR previews, skimming logs, a light check on work-in-progress code)
  • Work that must keep running after I close the terminal → move it to a server cron / CI
  • Work that must honor an exact schedule → avoid /loop (idle-waiting causes drift)
  • Failures that must reliably reach a human → put monitoring on a separate track (if the session dies, /loop takes the alerting down with it)

Put another way, /loop isn't a CI/CD replacement — it's a companion that handles odd jobs alongside an interactive session. Get that line right, and the small daily repetitions get noticeably lighter.

One more thing: you'll often want to tell whether a scheduled task has stalled or is simply waiting its turn. I've written separately about diagnosing a Claude that won't respond in How to tell when Claude stops responding — and what to do, which pairs well with this.

Your next step

If you want to try it, don't hand it real work right away. Start with a harmless read-only task — something like watching logs/error.log, where a miss breaks nothing. A few days in, the idle-wait drift and the three-day disappearance become things you know in your bones. From there, lift only the "keep going after I close the terminal" pieces up to a server, and the division of labor between /loop and server cron settles itself.

I started out expecting this one tool to cover all my overnight work, and I dropped plenty. I'm writing down the stumbles in the order I hit them, in the hope it spares someone the same detour.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Claude.ai2026-04-11
Claude MCP × Agent Workflows: Designing and Building Real-World Automation Systems
A practical guide to designing and building automation workflows by combining Model Context Protocol (MCP) with Claude agents — from architecture design to implementation and production deployment.
Claude.ai2026-04-05
The Complete Claude AI Content Creation Guide: Practical Workflows for Blogs, Videos, Social Media, and eBooks
A practical guide to content creation workflows using Claude AI. Learn how professionals use Claude to consistently produce high-quality blogs, YouTube scripts, social media posts, and eBooks at scale.
Claude Code2026-06-18
Claude Code Adds /cd — Carrying Your Warm Cache Across Repositories
Claude Code's new /cd moves a running session to another working directory without rebuilding the prompt cache. Here are the design calls and pitfalls when you sweep across several repositories in one sitting.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →