AgentSkillsCN

scheduling

安排周期性或定时任务。适用于设置闹钟、提醒事项、定期复盘、自动生成报告,或任何应在特定时间或固定间隔内自动运行的任务。

SKILL.md
--- frontmatter
name: scheduling
description: Schedule recurring or time-based tasks. Use for alarms, reminders, periodic reviews, automated reports, or any task that should run at specific times or intervals.

Scheduling

Daycare supports two scheduling mechanisms: cron for precise timing and heartbeats for periodic check-ins.

When to Use Cron

Use cron when:

  • Exact timing matters (e.g., "every day at 9am")
  • Tasks need their own isolated agent and memory
  • One-off scheduled tasks (with deleteAfterRun)
  • Tasks that produce artifacts in a dedicated workspace

Cron tools: cron_add, cron_read_task, cron_read_memory, cron_write_memory, cron_delete_task

Cron Routing

Cron tasks run in their own dedicated cron agent by default. If you want the cron notification to land in an existing agent (e.g. a user chat), include agentId in cron_add to route the prompt to that agent instead.

When to Use Heartbeats

Use heartbeats when:

  • Approximate timing is acceptable (~30 minute intervals)
  • Tasks need ongoing context from the main agent
  • Prompts evolve over time and need periodic review
  • Lightweight status checks or reminders

Heartbeat tools: heartbeat_add, heartbeat_run, heartbeat_remove (use topology to inspect tasks)

Optional Exec Gate

Both cron and heartbeat tasks can define an optional gate command to decide whether to run the LLM. The command runs first; exit code 0 means "run" and non-zero means "skip." This keeps checks cheap (ex: HTTP health check before notifying). Trimmed gate output is appended to the prompt under [Gate output]. Gates run within the target agent permissions. If gate.permissions are not already allowed, a system message is posted and the task still runs (the gate is treated as successful).

gate supports:

  • command (required)
  • cwd, timeoutMs, env
  • permissions (required tags; must already be allowed by the target agent)
  • packageManagers (dart | dotnet | go | java | node | php | python | ruby | rust; auto-adds language ecosystem hosts; requires @network)
  • allowedDomains (network allowlist; requires @network)

Examples

Cron with routing + gate (TASK.md frontmatter):

yaml
---
name: API health
schedule: "*/10 * * * *"
agentId: cu3ql2p5q0000x5p3g7q1l8a9
gate:
  command: "curl -fsS https://api.example.com/healthz >/dev/null"
  packageManagers:
    - node
  allowedDomains:
    - api.example.com
---
If the API is down, notify me with a short summary.

Selection Examples

Choose Cron

User InputWhy Cron
"Remind me every day at 9am to check my emails"Specific time (9am daily)
"Run a backup script every Sunday at midnight"Exact schedule needed
"Send me a weather report every morning at 7:30"Precise daily timing
"Every hour, check if the server is up"Strict hourly repetition
"At 5pm on weekdays, summarize my tasks"Complex schedule (weekdays only)
"Once tomorrow at noon, remind me about the meeting"One-off scheduled task
"Every 15 minutes, poll the API for updates"Precise interval timing
"On the 1st of each month, generate a report"Calendar-based schedule

Choose Heartbeats

User InputWhy Heartbeat
"Periodically check on my project status"Ongoing review, flexible timing
"Keep an eye on my git branches"Continuous monitoring, evolving context
"Remind me about my todos from time to time"Lightweight, approximate timing
"Check in on code quality occasionally"Periodic review that needs reasoning
"Monitor my open PRs and update me"Ongoing task that evolves
"Review my notes and suggest improvements"Needs main agent context
"Periodically summarize what I've been working on"Flexible interval, ongoing
"Keep track of my daily progress"Continuous, evolving check-in

Ambiguous Cases

User InputResolution
"Remind me about X regularly"Ask: need exact times? Cron. Flexible? Heartbeat.
"Check something every day"Ask: specific time? Cron. Anytime during day? Heartbeat.
"Monitor Y"Heartbeat (monitoring implies ongoing, evolving context)
"Schedule Z"Cron (scheduling implies specific timing)

Workflow

For cron tasks:

  1. Determine the schedule (cron expression: minute hour day month weekday)
  2. Use cron_add with name, schedule, and prompt (optional agentId + gate)
  3. Each task gets isolated agent, memory file, and workspace

For heartbeats:

  1. Run topology to see existing heartbeat tasks and ownership
  2. Use heartbeat_add with title and prompt (optional gate)
  3. Use heartbeat_run to trigger immediately
  4. Use heartbeat_remove for cleanup

Key Differences

FeatureCronHeartbeats
TimingExact (cron expression)~30 minute intervals
AgentIsolated per taskShared main agent
MemoryPersistent MEMORY.mdMain agent context
WorkspaceDedicated files/ dirNone
One-offYes (deleteAfterRun)No
Best forTime-sensitive tasksOngoing reviews