npx skills add ...
npx skills add garrytan/gbrain --skill cron-scheduler
Schedule management with staggering, quiet hours, and wake-up override. Validates schedules, prevents collisions, and gates delivery during quiet hours.
npx skills add garrytan/gbrain --skill cron-scheduler
Convention: See
skills/conventions/test-before-bulk.md— test every cron job on 3-5 items first.
This skill guarantees:
reports/{job-name}/{YYYY-MM-DD-HHMM}.mdagentTurn. See skills/conventions/cron-via-minions.md for the rewrite pattern (PGLite uses --follow, Postgres uses fire-and-forget + --idempotency-key on the cycle slot). GBrain's v0.11.0 migration auto-rewrites entries for built-in handlers; host-specific handlers need a code-level registration per docs/guides/plugin-handlers.md.Every cron job MUST be idempotent:
Job configuration saved. Report: "Job '{name}' scheduled at {cron expression}. Next run: {time}."
sync --all, not per-source entriesWhen the brain has 2+ active sources (anything gbrain sources list shows
with a non-null local_path that isn't archived), use one consolidated
cron line instead of N per-source entries.
Preferred (multi-source):
This replaces N per-source lines AND auto-picks-up future sources without
a crontab edit. Concurrency budget: parallel × workers × 2 ≈ 32
connections during the wave (each per-file worker opens its own
2-connection pool). Stay under your Postgres max_connections setting.
Avoid (legacy): separate gbrain sync --source default and
gbrain sync --source zion-brain entries staggered by 5 minutes. They
require manual deconfliction every time a new source is added, and a
slow source can race a fast source on the legacy global gbrain-sync
lock (v0.40.3.0+ uses per-source gbrain-sync:<sourceId> locks but the
per-source cron pattern doesn't benefit from the parallelism that
--all --parallel actually delivers).
gbrain doctor surfaces the recommended line as a sync_consolidation
check whenever it detects 2+ active sources. Paste-ready from there.
A managed brain refuses the line above: managed sync needs --no-pull and
rejects --skip-failed (writer_coordinator_required). Check the mode first:
gbrain sources writer status --json reports "mode": "managed" or
"mode": "classic", and its bindings name each source's owner host.
On a managed brain, install this line instead, on the host that owns the sources:
gbrain sources refresh <id> is the only way a managed checkout takes
upstream commits (a fetch and git merge --ff-only, then a managed sync of
the sources on that checkout). Add one refresh per checkout that tracks a
remote, with its real source id; drop it for checkouts with no remote. The
; is deliberate: the sync still runs when a refresh refuses.--hard-deadline 13m stays under the 15-minute interval. Managed sync takes
no per-source lock, so a run that outlives the interval would overlap the
next tick. A run stopped at its deadline ends resumable and the next tick
continues it. Sources drain one at a time, so --parallel does not apply.owner_unavailable for a source: read its detail. unbound_source on a
classic Postgres brain is normal and does not stop classic sync; keep the
sync line. Any other detail means another host owns the source: install a
per-source line on that host (gbrain sync --source <id> --no-pull --hard-deadline 13m, plus its refresh) instead of claiming it here.--retry-failed command the failure prints
(gbrain sync --source <id> --no-pull --retry-failed …) after fixing the
files; never add --skip-failed.gbrain doctor prints this managed line in sync_consolidation on a managed
brain with 2+ active sources.
Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:
gbrain sync hits sync_in_progress / lock_busy: an earlier tick still runs. Widen the interval or stagger the job; never add a second overlapping schedule.gbrain sources status <id> for held items or errors before changing the schedule again.checkpoint_validation_timeout in a sync log: run the retry command the error prints; do not cancel the request.writer_coordinator_required from a scheduled sync: the brain is managed. Replace the line with the managed brain recipe; never retry with --skip-failed or without --no-pull.sync_in_progress from gbrain sources refresh: a managed sync cursor is unfinished, and the refresh never waits on it. Run the gbrain sync --source <id> --no-pull … command the refusal prints; the next tick's refresh then runs.worktree_refreshing from a sync: a refresh is draining or merging that checkout. Leave it; the next tick syncs it.gbrain sync --source <id> cron entries when
gbrain sync --all --parallel N --workers N would replace them with
one line that auto-picks-up future sources.*/15 * * * * gbrain sources refresh <id>; gbrain sync --all --no-pull --hard-deadline 13m