1. The loop: the floor above the agent
In What is an AI agent, I explained the assistant/agent difference: an assistant answers, an agent acts in a loop until the result is delivered — then stops. The loop adds the time dimension: the whole task is re-run at a regular interval. The agent no longer works once toward a goal; it comes back to check — again and again.
It's the natural pattern for anything monitoring: you never "finish" watching a deployment or an order flow; you look, compare against the expected state, alert if it drifts, and come back later.
2. How it works in Claude Code
Claude Code (the tool I use for all dev work — see Chat, Cowork or Code) ships a /loop command: you give it a prompt and an interval (in seconds, minutes, hours or days), and it re-runs that prompt at every tick, inside your session.
The detail that won me over: the guardrail is built in. A loop automatically expires 3 days after creation — it runs one last time, then deletes itself. A forgotten loop can't run forever or silently burn a budget. It's exactly the kind of framing I called for in the agent guide (goal, budget, frequency, success criterion) — except here, the boundary is set by the tool itself.
3. Loop or scheduled task?
Both re-run a task at a regular interval; everything else differs.
Ephemeral, zero setup
- Tied to your working session
- Created in one line
- Expires on its own (3 days max)
Durable, real infra
- Runs without you (cron, Actions)
- Requires setup
- Lives until someone stops it
My daily AI watch, for instance, is a scheduled task (it has to run every morning, forever). Watching that an Odoo deployment goes well this afternoon is a loop: useful for three hours, forgettable afterwards.
4. What it's good for in retail
Anything you check at regular intervals over a day or two:
- Orders: check every 30 minutes that morning orders move to fulfillment; alert if a status gets stuck.
- Production deploys: after a release, check every 10 minutes that key pages respond and nothing breaks.
- Supplier flows: make sure an expected stock import arrived and integrated cleanly.
- Critical restock: track an out-of-stock reference and ping as soon as stock comes back.
That's the workstream I'm opening at Cobra right now: moving checks I used to do by hand (or not at all) into loops. The detailed journal entry will land once the first ones run in production — as always, everything gets documented.