Scheduled tasks — fires and their states, claiming, missed and busy rules, the pause, keep-5, fire worktrees and their oracle. A repository rule for apps/daemon/src/v1/schedules/**, apps/ui/src/main/schedule-conductor.ts, apps/ui/src/renderer/scheduled/**; read it before editing a file there.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Daemon Schedules?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-daemon-schedules)
---
name: rule-daemon-schedules
description: "Scheduled tasks — fires and their states, claiming, missed and busy rules, the pause, keep-5, fire worktrees and their oracle. A repository rule for apps/daemon/src/v1/schedules/**, apps/ui/src/main/schedule-conductor.ts, apps/ui/src/renderer/scheduled/**; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/daemon-schedules.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Scheduled tasks
- A schedule belongs to a project (`schedules`, deleted when its project is: `SchedulesService` drops them on the project event once the project is gone). Each time it comes due it gets one fire row (`schedule_fires`), kept as history. A fire's state is `claimed`, `started`, `skipped`, `missed`, `failed` or `done`. `claimed` moves to `started` (then its run is made and linked), `failed` (the start failed) or `missed` once the grace ends; `started` moves to `done` or `failed` when its run first settles. `skipped` and `missed` are written final.
- Claims are serialized in the daemon, and every state change is a compare-and-set on the state the caller read. A start for a fire that is not `claimed` is refused `409 SCHEDULE_FIRE_TAKEN`. Never start a run for a fire without winning that write.
- The times are the Mac's local wall time, computed by `utils/next-fire.ts` with no cron or date library. `nextFireAt` is recomputed when the zone offset changes.
- **Every N hours** is one series from its start day (`repeat.date`) and time, stepping N hours of wall time straight through midnight, never restarting at the time each day. A save that leaves the time and step as they were keeps the start day; one that changes them starts the series again today.
- **Grace.** A fire due more than 10 minutes before the daemon first saw it is missed, never started. One streak of missed fires is one marker on the schedule (`missed.count` rises) and one `missed` fire row, so one notification and one run on Run now. The marker clears when the schedule next starts a run, or on dismiss.
- **Busy** means the previous fire's run is not terminal, or `RunLiveWork` holds it, or it has a pending question, or `ApprovalRegistry.listByRun` is not empty. A fire that finds the schedule busy is `skipped` ("previous run still working"), and Run now answers `409 SCHEDULE_RUN_ACTIVE`. A skip notifies nothing.
- **Pause.** 3 failures in a row set `enabled` false and `pausedReason` `failures`. A failed start counts. A run ended by a usage limit or an interruption neither counts nor resets the streak, and a cancel moves nothing. A success resets it; Resume clears the pause.
- **Keep 5.** After a run starts, the schedule's chats beyond the newest 5 are archived, but only a chat that is settled, idle (no live work, no question, no approval) and seen. Never archive a running chat.
- **The starter `schedule`** takes none of the autopilot's gates (cap, breaker, armed flag, forced approval): the run's approval is the schedule's own, and a scheduled chat is a cardless run, so the board's live count never includes it.
- **The fire worktree** is `<userData>/worktrees/sched-<fireId>` on a start that names a branch, else the project's folder. The daemon derives the path (`scheduleFireFolder` in `tasks/utils/task-worktree.ts`) and never takes one from the caller; it is the twin of main's `fireWorktreePath`. Change both together.
- **The oracle** (`POST /v1/schedules/worktrees/finished`) is the only thing that says a fire worktree may go. A claimed fire, and a started one whose run is not linked yet, are not finished. An unknown fire is not finished. A fire with no run, whose run is archived or whose run row is gone is finished. Never ask `/v1/tasks/finished` about a fire: it counts an id with no card as finished.
- **The registry.** `worktrees.json` rows have an owner: a task row (no `owner`, as written before) or a fire row (`owner: 'schedule-fire'`). A task-keyed function never reads, settles or removes a fire row, and the reverse. A reaper without a fire oracle keeps fire rows.
- The conductor and the claim, start, failed and finished routes are desktop-only (`DesktopOnlyGuard`). A paired phone reads, edits, pauses and presses Run now; the run starts on the Mac at the next tick.
- `schedules_changed {scheduleId, reason}` goes to every client. `reason` is `saved`, `deleted`, `fired`, `skipped`, `missed`, `paused` or `settled`. The renderer's parser in `daemon-client.ts` is a twin of the daemon's schema.