empiricaai/empirica/loop-cron
Claude Code and agent skill by empiricaai/empirica
- community
Checking that the SKILL.md file is still in the repository.
Use when scheduling cron-mode loops with Claude Code's /loop, when registering periodic background work, when the user says 'cron loop', 'periodic loop', 'register a cron', 'schedule recurring work', or when configuring a loop that needs to be visible in `empirica status`. This skill provides the prompt template that wires CC's /loop into Empirica's loop registry — register at start, check pause flag each fire, heartbeat at end. Without this wiring, a /loop cron is invisible to the cockpit and…
Install
npx vskill@latest install empiricaai/empirica/loop-cronSKILL.md
Loop-Cron Wiring
Claude Code's built-in /loop skill drives periodic work via CronCreate. On its own, those loops are invisible to other terminals — you can't see what's scheduled, can't tell when one last ran, and can't pause them without killing the process. Empirica's loop registry fixes that with three CLI calls layered into the cron prompt.
This skill is the prompt template for cron-mode loops that integrates with the registry.
When to Use
You're about to start a cron-mode loop with /loop (or already have one running) and:
- You want it visible in
empirica status --all - You want to pause/resume from any terminal without killing the process
- You want a heartbeat trail for "did it actually run, did it succeed"
- You want it to survive a Claude Code session restart cleanly
If your loop is one-shot or interactive ("dynamic mode"), skip this — it applies to scheduled (cron/interval) loops only.
Cron Prompt Template (self-scheduling)
The body owns the schedule (the design doc is gone; tests/test_cockpit_self_scheduling.py pins the behaviour, docs/specs/PROPOSAL_LOOP_BACKOFF.md has the backoff math). Each fire installs the next fire as a one-shot at the timestamp the backoff math returns. There is no recurring cron — pause means the scheduler is silent (no token bleed).
When invoking /loop in cron mode, prepend these CLI lines to your task prompt. Variables: {NAME} (loop identifier, no spaces), {INTERVAL} (base cadence, e.g. 15m), {DESC} (one-line description).
The register call is idempotent — it preserves runtime state (last_run, last_status, last_message, last_result, empty_streak, next_scheduled_job_id) while updating declarative fields. Safe to re-issue on every fire without losing history.
Backoff stretches the actual schedule (not just a body-internal threshold like the previous spec). schedule-next returns:
- streak 0 → base interval (e.g. 15m)
- streak 1 → base × 2 = 30m
- streak 2 → base × 4 = 1h
- ... capped at
--max-interval(default 4h)
`--result` is the schedule signal:
found→ new work happened — reset streak, next fire at baseempty→ fire ran cleanly, nothing to do — advance streakfail→ errored — reset streak, retry at base (no compound delay)paused→ body short-circuited on pause check — freezes streak
The body is its own next-fire scheduler — every fire installs the next one. empirica loop pause clears the recorded next_scheduled_job_id; the body's pause check at the start of the next fire is the final backstop (it sees the pause flag and exits without scheduling).
Manual escape hatches:
Resets the streak to 0 and clears the threshold. The next fire (when it arrives) runs at base.
Computes the next-fire schedule and emits the cron expression + a hint to install it. Bootstraps after empirica loop resume on Claude Code (the empirica CLI can't call CronCreate directly — re-issue via /loop or run the printed CronCreate(...) invocation).
Concrete Example
A 15-minute inbox poll with backoff:
Pausing and Resuming
From any terminal, on any machine that shares ~/.empirica/:
pause clears the recorded next_scheduled_job_id and — for CronCreate-mode loops — writes a pending uninstall request file at ~/.empirica/loop_uninstall_pending_{instance}_{name}.json containing the job_id. The owning Claude instance's UserPromptSubmit hook (loop-uninstall-pickup.py) surfaces this on the next prompt as a system-reminder asking Claude to run CronDelete(job_id) from inside that CC session. The cron is then genuinely off — no more fires.
If the owning Claude doesn't run CronDelete in time, the body's pause check at the next fire is the backstop: it sees the pause flag and exits without scheduling the next fire, so the loop dies cleanly after at most one more silent fire. CronDelete makes that one extra fire go away too.
resume clears the pause flag. The next prompt in the target instance will pick up any pending install request and the body will re-arm itself. To reissue the install (bootstrap the cron) from any other terminal:
That registers in the target's registry and queues a pending request that the target instance's UserPromptSubmit hook surfaces as a system-reminder on the next prompt — Claude in that instance runs /loop and CronCreate fires. Use empirica loop fire {NAME} for single manual fires (testing, ad-hoc poke).
| State | Cron firing | Body running | Tokens | |
|---|---|---|---|---|
| Active, no backoff | every base | every fire | every base | |
| Active, in backoff | every backoff_interval | every fire | every backoff_interval | |
| Paused | never | never | none |
Visibility
Once registered, the loop appears in:
…showing kind, schedule, last fire, last status, and pause state in one table. This is the comprehension principle: you shouldn't run loops you can't read.
Migration from Bespoke Pause Files
Old patterns like touch /tmp/inbox-poll.disabled should migrate to empirica loop pause inbox-poll. The standard pattern wins because:
- Visible to other instances (any tmux pane can pause/resume)
- Surfaces in the cockpit (
empirica statusshows pause state) - Survives reboots (
~/.empirica/persists) - Scoped per-instance (no cross-talk between Claudes)
Once an old /tmp/*.disabled loop is re-issued through this template, the bespoke flag file becomes dead code and can be deleted.
Related
empirica status --all --pretty— cockpit overviewempirica sentinel pause/resume— per-instance noetic firewall controldocs/architecture/COCKPIT.md— full state-file layout and discovery rules
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingempirica/plugins/claude-code-integration/skills/loop-cron/SKILL.md
Popularity
- Repository stars
- 251
- Repository forks
- 32
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/empiricaai/empirica/loop-cron)