cron-scheduler
できること
このスキルは、日次レポートや週次の確認などの定期的なジョブを計画します。ジョブの時間をずらし、静かな時間帯を守り、各結果を日時つきのレポートとして保存します。
使う場面
- ✓日次レポートのような定期タスクを、スケジュールどおり実行したいとき。
- ✓静かな時間帯には通知を避けたいとき。
- ✓スケジュール済みのジョブが複数あり、重なるのを防ぎたいとき。
スキルのリンク
https://github.com/garrytan/gbrain/blob/master/plugin/skills/cron-scheduler/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“毎朝7時に日次レポートを実行してください。夜の静かな時間帯には、メッセージを保留してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、他のジョブとの重なりをスケジュール上で確認し、必要なら空いている時間帯を提案します。各ジョブは短い指示ファイルを実行し、その出力は日時つきのレポートとして保存されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Cron Scheduler
Convention: See
skills/conventions/test-before-bulk.md— test every cron job on 3-5 items first.
Contract
This skill guarantees:
- Schedule staggering: max 1 job per 5-minute slot, no collisions
- Quiet hours gating: timezone-aware, with user-awake override
- Thin job prompts: jobs say "Read skills/X/SKILL.md and run it" (no inline 3000-word prompts)
- Idempotency: jobs can run twice without duplicate side effects
- Results saved as reports:
reports/{job-name}/{YYYY-MM-DD-HHMM}.md - One entry point: every job, workspace script and hook calls gbrain through
one wrapper that sets
GBRAIN_HOMEand keeps stderr and the exit code (the wrapper)
Phases
- Define job. Name, schedule (cron expression), skill to run, timeout.
- Validate schedule. Check no collision with existing jobs (5-minute offset rule).
- Slots: :05, :10, :15, :20, :25, :30, :35, :40, :45, :50
- If collision detected, suggest the next available slot
- Check quiet hours. Default: 11 PM - 8 AM local time.
- Override: user-awake flag (if user is active, quiet hours suspended)
- During quiet hours: save output to held queue
- Morning contact releases the backlog
- Register with host scheduler. OpenClaw cron, Railway cron, crontab, or process manager. Each registered entry should execute via Minions, not
agentTurn. Seeskills/conventions/cron-via-minions.mdfor the rewrite pattern (PGLite uses--follow, Postgres uses fire-and-forget +--idempotency-keyon the cycle slot). GBrain's v0.11.0 migration auto-rewrites entries for built-in handlers; host-specific handlers need a code-level registration perdocs/guides/plugin-handlers.md. - Write thin prompt. Job prompt is one line: "Read skills/{name}/SKILL.md and run it."
- Call gbrain through the wrapper. Cron runs with another
HOMEand environment than your shell, so a baregbrain(orbun run src/cli.ts) can find no database (every lookup silently empty) or act as a second host (refresh_not_owner). Registergbrain-run <args>, the wrapper in cron-schedule.md: it setsGBRAIN_HOME(neverHOME), loads the brain's env file and runs the installed binary. Log stderr to a file, check the exit code, keep hook output off stdout, and give each call a timeout of at least 10 s. The lines below writegbrain-run; doctor prints the bare command.gbrain doctor --only cron_gbrain_homewarns about any crontab line or script that runssrc/cli.tsdirectly or calls gbrain without the brain'sGBRAIN_HOME.
Idempotency Requirement
Every cron job MUST be idempotent:
- Running the same job twice produces the same result (no duplicate pages, no duplicate timeline entries)
- Use checkpoint state files to track progress and resume interrupted runs
- Check for existing output before creating new output
Output Format
Job configuration saved. Report: "Job '{name}' scheduled at {cron expression}. Next run: {time}."
Multi-source brains: use sync --all, not per-source entries
When 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):
*/5 * * * * gbrain-run sync --all --parallel 4 --workers 4 --skip-failed >> /tmp/gbrain-cron.log 2>&1
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.
Managed br
よくある質問
静かな時間帯とは何ですか?
初期設定では、現地時間の午後11時から午前8時までです。その間の結果は朝まで待機します。
静かな時間帯を上書きできますか?
はい。あなたが活動中であれば、静かな時間帯の設定は一時的に停止されます。
ジョブが2回実行されて問題になりませんか?
ジョブは、2回実行されても結果が重複しないように設計されています。
詳細
作者による元の説明
Schedule management with staggering, quiet hours, and wake-up override. Validates schedules, prevents collisions, and gates delivery during quiet hours.
repo: garrytan/gbrain
人気
- GitHubのスター
- 31k
- ランキング
- #9297
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
gbrain
31kエージェントが、共有の社内ナレッジブレインで人、プロジェクト、決定事項についての事実を検索し、永続的なメモを保存できるようにします。
brain-ingest-gate
31k重複を避け、名前付きのエンティティを先に解決するため、新しい内容をナレッジブレインに追加する前に、既存のブレインと照合するようエージェントを支援します。
brain-link-discipline
31kエージェントが報告する各ブレインのページについて、同じメッセージの中で動くリンクを必ず含め、すぐに開けるようにします。
brain-ops
31kナレッジブレインの基本的な手順をエージェントに与えます。まず既存の文脈を確認し、出典つきで明示的なメモを保存し、関連するページをリンクします。