본문으로 건너뛰기
Skillpedia
자동화31k · #9297

cron-scheduler

하는 일

이 스킬은 일일 보고서나 주간 점검 같은 반복 작업을 계획합니다. 작업 사이에 간격을 두고, 조용한 시간을 지키며, 각 결과를 날짜가 붙은 보고서로 저장합니다.

사용하는 경우

  • ✓일일 보고서처럼 반복 작업을 일정에 따라 실행하고 싶을 때.
  • ✓조용한 시간 동안 알림이 오지 않게 하고 싶을 때.
  • ✓예약 작업이 여러 개여서 서로 겹치지 않게 하고 싶을 때.

스킬 링크

https://github.com/garrytan/gbrain/blob/master/plugin/skills/cron-scheduler/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/garrytan/gbrain/blob/master/plugin/skills/cron-scheduler/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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_HOME and keeps stderr and the exit code (the wrapper)

Phases

  1. Define job. Name, schedule (cron expression), skill to run, timeout.
  2. 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
  3. 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
  4. Register with host scheduler. OpenClaw cron, Railway cron, crontab, or process manager. Each registered entry should execute via Minions, not agentTurn. 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.
  5. Write thin prompt. Job prompt is one line: "Read skills/{name}/SKILL.md and run it."
  6. Call gbrain through the wrapper. Cron runs with another HOME and environment than your shell, so a bare gbrain (or bun run src/cli.ts) can find no database (every lookup silently empty) or act as a second host (refresh_not_owner). Register gbrain-run <args>, the wrapper in cron-schedule.md: it sets GBRAIN_HOME (never HOME), 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 write gbrain-run; doctor prints the bare command. gbrain doctor --only cron_gbrain_home warns about any crontab line or script that runs src/cli.ts directly or calls gbrain without the brain's GBRAIN_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시까지이며, 그 동안의 결과는 아침까지 기다립니다.

조용한 시간을 무시할 수 있나요?

네. 내가 활동 중이면 조용한 시간 설정이 일시 중단됩니다.

작업이 두 번 실행되어 문제가 생기나요?

작업은 두 번 실행되어도 중복된 결과가 생기지 않도록 설계되어 있습니다.

상세 정보

작성자의 원본 설명

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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬