Candybar: the single clock
The live docs outrank this skill. Before acting read ~/code/33GOD/candybar/README.md
("Register a candybar", "Runner kinds", "Migrate a cron job onto candybar") and
deploy/migration/README.md. Policy text: ~/.agents/AGENTS.md, "Recurring schedules".
The one rule
Candybar owns WHEN recurring work runs. Never create a crontab entry, a new
systemd .timer, systemd-run --on-*, at/batch, a launchd interval, a Hermes
internal recurring job (cronjob tool, or hermes cron create without
--scheduler external), an n8n Schedule Trigger, or a private recurring
sleep/poll loop. Execution is free: a systemd .service, a Hermes job pinned
scheduler=external, an n8n webhook workflow or any exec argv. Candybar fires it.
Not schedules, so allowed: bounded retries and loops inside one invocation,
event-driven workers, and session-scoped waits (Claude Code CronCreate, /loop,
ScheduleWakeup, Kimi CronCreate). Those die with the session; never use them to
install durable recurring system work.
Pick the runner
| Need |
Runner |
Notes |
| Script or any command |
exec |
Table form with absolute argv; metered; on_failure argv for alerts |
| Existing systemd service |
systemd |
Keep the .service, retire only its .timer |
| Hermes agent (LLM) job |
hermes |
Needs a Hermes job pinned scheduler: external; runner takes profile + hex job_id |
Hermes no_agent script |
exec |
Run the script directly, not through hermes |
| n8n workflow |
n8n |
Webhook-triggered, active, responds on finish, zero Schedule Triggers |
| Faster than once a minute |
none |
Not schedulable. Use an event-driven worker, or loop inside one invocation, or ask the user for an exact exception record |
Install a new job (no native clock exists)
Run from ~/code/33GOD/candybar. API default http://127.0.0.1:8700; off-box
export CANDYBAR_API_URL=https://candybar.delo.sh.
- Put the script or
.service in its own repo, committed and pushed. Never add a .timer.
- Make it a project candybar in that repo (README "Project candybars"): from the repo,
candybar create --no-tui --name <slug> --schedule "<cron>" --exec "./scripts/job.sh args" --disabled (or --systemd UNIT, --hermes PROFILE:JOB_ID, --n8n PATH_OR_URL, --entrypoint SCRIPT; --timezone defaults to the host zone; --print previews). It writes .candybars/<name>.candybar.toml (--project-file appends a [candybars.<name>] table to .candybar.toml), validated by the same loader register uses. Relative paths resolve against the repo root, exec jobs start in the repo root, and the project:<repo> tag is added for you (never write a project: tag yourself). candybar create without --no-tui is the human TUI. A job with no repo can still use a plain candybar.toml (required name, 5-field schedule, exactly one of entrypoint or [candybar.runner]; unknown keys rejected).
- From the repo:
candybar register --dry-run, then candybar register (registers every project candybar; -n NAME for one). Changing the file later and rerunning candybar register --update PATCHes the drift (runner included); --prune archives registered candybars the repo no longer defines; candybar ls in the repo shows STATE and SYNC. A plain candybar.toml is candybar register <dir>, create-only (409 on duplicate; change it with candybar edit or PATCH). Side-effect jobs are created disabled (--disabled / enabled = false); enabled is never synced.
- Read back:
uv run candybar show <name> -n 5 and uv run candybar next. Check state, runner, schedule, timezone.
- Prove a terminal invocation:
uv run candybar run <name> --wait for side-effect-free jobs. For jobs with side effects do not test-run; wait for the first scheduled fire and read uv run candybar history <name> -n 5. Then confirm the job's actual effect.
uv run candybar resume <name> to enable.
uv run candybar doctor --repo . --live --json (read-only). Confirm no new bypass and no competing native clock.
- Commit and push the candybar file(s) in the job's repo.
Minimal manifests
[candybar] # exec
name = "my-job"
schedule = "*/5 * * * *"
timezone = "America/New_York"
enabled = false
[candybar.runner]
kind = "exec"
argv = ["/abs/path/script.sh"] # absolute or bare command
timeout_s = 600
# "--topic", "alerts"]
[candybar.runner] # systemd: the .service stays
kind = "systemd"
unit = "my-job.service"
[candybar.runner] # hermes: job already pinned scheduler=external
kind = "hermes"
profile = "33god-pm"
job_id = "a1b2c3d4e5f6"
[candybar.runner] # n8n: webhook workflow, no Schedule Trigger
kind = "n8n"
webhook = "candybar/nightly-digest"
New Hermes agent job (VERIFY FIRST, untested recipe): create it pinned external
so Hermes' own ticker is not a second clock, e.g.
hermes -p <profile> cron create --scheduler external --paused '<schedule>' '<prompt>'.
Check hermes cron create --help and read the job back before registering. A pin
on a running gateway may need hermes-gateway-restart --reason, never raw systemctl.
Migrating an existing cron line or timer
The ledger is deploy/migration/ledger.yaml; one scheduler per job at every step.
- Add a ledger entry (id like
systemd:foo.timer, crontab:N, hermes:<profile>:<job>), status: planned.
- Retire the re-enabler first: the owning repo's installer, mise task or README step must stop re-enabling the old clock. Commit and record it in
source_of_truth.commit.
uv run candybar migrate plan <id> --write; commit the ledger.
uv run candybar migrate cutover <id> [--wait 600] (registers disabled, retires native, enables; auto-rolls back on failure).
uv run candybar migrate verify <id> (exit 3 until the first scheduled fire). Commit the ledger.
migrate status [--probe] to inspect; migrate rollback <id> to restore native; migrate decommission <id> --reason '...' to retire for good, then delete the job's old units and installers.
Exceptions
The only standing exception is candybar-watchdog.timer (AD-22, a scheduler must
not watch itself). It does not exempt crank-watchdog or other agent schedules.
Any other exception is an exact entry in deploy/scheduling-policy.json that the
user approves with owner, scope and reason. Never self-grant one. Doctor findings
stay visible; do not auto-disable unfamiliar timers.
Done means
Manifest committed and pushed; registration read back through the API; a terminal
invocation and its intended effect proven; competing native clocks off; doctor
shows no new bypass. Registration or dispatch alone is not proof.
1---2name: candybar3description: Candybar is the only way to schedule recurring or background work on this host. Use whenever a task says schedule, scheduled, cron, crontab, systemd timer, .timer, OnCalendar, recurring, periodic, nightly, hourly, daily, weekly, every N minutes, background job, poll loop, n8n Schedule Trigger, hermes cron create, cronjob tool, or migrate a cron job. Covers registering a candybar.toml, per-runner manifests, migrating a native clock through the ledger, exceptions and proof of done.4metadata:5 source: https://skillmd.com/skills/delorenj/candybar6---78# Candybar: the single clock910The live docs outrank this skill. Before acting read `~/code/33GOD/candybar/README.md`11("Register a candybar", "Runner kinds", "Migrate a cron job onto candybar") and12`deploy/migration/README.md`. Policy text: `~/.agents/AGENTS.md`, "Recurring schedules".1314## The one rule1516Candybar owns WHEN recurring work runs. Never create a crontab entry, a new17systemd `.timer`, `systemd-run --on-*`, `at`/`batch`, a launchd interval, a Hermes18internal recurring job (`cronjob` tool, or `hermes cron create` without19`--scheduler external`), an n8n Schedule Trigger, or a private recurring20sleep/poll loop. Execution is free: a systemd `.service`, a Hermes job pinned21`scheduler=external`, an n8n webhook workflow or any exec argv. Candybar fires it.2223Not schedules, so allowed: bounded retries and loops inside one invocation,24event-driven workers, and session-scoped waits (Claude Code CronCreate, `/loop`,25ScheduleWakeup, Kimi CronCreate). Those die with the session; never use them to26install durable recurring system work.2728## Pick the runner2930| Need | Runner | Notes |31|---|---|---|32| Script or any command | `exec` | Table form with absolute `argv`; metered; `on_failure` argv for alerts |33| Existing systemd service | `systemd` | Keep the `.service`, retire only its `.timer` |34| Hermes agent (LLM) job | `hermes` | Needs a Hermes job pinned `scheduler: external`; runner takes profile + hex job_id |35| Hermes `no_agent` script | `exec` | Run the script directly, not through `hermes` |36| n8n workflow | `n8n` | Webhook-triggered, active, responds on finish, zero Schedule Triggers |37| Faster than once a minute | none | Not schedulable. Use an event-driven worker, or loop inside one invocation, or ask the user for an exact exception record |3839## Install a new job (no native clock exists)4041Run from `~/code/33GOD/candybar`. API default `http://127.0.0.1:8700`; off-box42`export CANDYBAR_API_URL=https://candybar.delo.sh`.43441. Put the script or `.service` in its own repo, committed and pushed. Never add a `.timer`.452. Make it a **project candybar** in that repo (README "Project candybars"): from the repo, `candybar create --no-tui --name <slug> --schedule "<cron>" --exec "./scripts/job.sh args" --disabled` (or `--systemd UNIT`, `--hermes PROFILE:JOB_ID`, `--n8n PATH_OR_URL`, `--entrypoint SCRIPT`; `--timezone` defaults to the host zone; `--print` previews). It writes `.candybars/<name>.candybar.toml` (`--project-file` appends a `[candybars.<name>]` table to `.candybar.toml`), validated by the same loader `register` uses. Relative paths resolve against the repo root, exec jobs start in the repo root, and the `project:<repo>` tag is added for you (never write a `project:` tag yourself). `candybar create` without `--no-tui` is the human TUI. A job with no repo can still use a plain `candybar.toml` (required `name`, 5-field `schedule`, exactly one of `entrypoint` or `[candybar.runner]`; unknown keys rejected).463. From the repo: `candybar register --dry-run`, then `candybar register` (registers every project candybar; `-n NAME` for one). Changing the file later and rerunning `candybar register --update` PATCHes the drift (runner included); `--prune` archives registered candybars the repo no longer defines; `candybar ls` in the repo shows STATE and SYNC. A plain `candybar.toml` is `candybar register <dir>`, create-only (409 on duplicate; change it with `candybar edit` or PATCH). Side-effect jobs are created disabled (`--disabled` / `enabled = false`); `enabled` is never synced.474. Read back: `uv run candybar show <name> -n 5` and `uv run candybar next`. Check state, runner, schedule, timezone.485. Prove a terminal invocation: `uv run candybar run <name> --wait` for side-effect-free jobs. For jobs with side effects do not test-run; wait for the first scheduled fire and read `uv run candybar history <name> -n 5`. Then confirm the job's actual effect.496. `uv run candybar resume <name>` to enable.507. `uv run candybar doctor --repo . --live --json` (read-only). Confirm no new bypass and no competing native clock.518. Commit and push the candybar file(s) in the job's repo.5253## Minimal manifests5455```toml56[candybar] # exec57name = "my-job"58schedule = "*/5 * * * *"59timezone = "America/New_York"60enabled = false61[candybar.runner]62kind = "exec"63argv = ["/abs/path/script.sh"] # absolute or bare command64timeout_s = 60065# on_failure = ["ntfy-publish", "--topic", "alerts"]66```6768```toml69[candybar.runner] # systemd: the .service stays70kind = "systemd"71unit = "my-job.service"72```7374```toml75[candybar.runner] # hermes: job already pinned scheduler=external76kind = "hermes"77profile = "33god-pm"78job_id = "a1b2c3d4e5f6"79```8081```toml82[candybar.runner] # n8n: webhook workflow, no Schedule Trigger83kind = "n8n"84webhook = "candybar/nightly-digest"85```8687New Hermes agent job (VERIFY FIRST, untested recipe): create it pinned external88so Hermes' own ticker is not a second clock, e.g.89`hermes -p <profile> cron create --scheduler external --paused '<schedule>' '<prompt>'`.90Check `hermes cron create --help` and read the job back before registering. A pin91on a running gateway may need `hermes-gateway-restart --reason`, never raw systemctl.9293## Migrating an existing cron line or timer9495The ledger is `deploy/migration/ledger.yaml`; one scheduler per job at every step.961. Add a ledger entry (id like `systemd:foo.timer`, `crontab:N`, `hermes:<profile>:<job>`), `status: planned`.972. Retire the re-enabler first: the owning repo's installer, mise task or README step must stop re-enabling the old clock. Commit and record it in `source_of_truth.commit`.983. `uv run candybar migrate plan <id> --write`; commit the ledger.994. `uv run candybar migrate cutover <id> [--wait 600]` (registers disabled, retires native, enables; auto-rolls back on failure).1005. `uv run candybar migrate verify <id>` (exit 3 until the first scheduled fire). Commit the ledger.1016. `migrate status [--probe]` to inspect; `migrate rollback <id>` to restore native; `migrate decommission <id> --reason '...'` to retire for good, then delete the job's old units and installers.102103## Exceptions104105The only standing exception is `candybar-watchdog.timer` (AD-22, a scheduler must106not watch itself). It does not exempt crank-watchdog or other agent schedules.107Any other exception is an exact entry in `deploy/scheduling-policy.json` that the108user approves with owner, scope and reason. Never self-grant one. Doctor findings109stay visible; do not auto-disable unfamiliar timers.110111## Done means112113Manifest committed and pushed; registration read back through the API; a terminal114invocation and its intended effect proven; competing native clocks off; doctor115shows no new bypass. Registration or dispatch alone is not proof.