← All guides

Claude Code /schedule Examples: A Cookbook

A schedule loop runs when the clock says so, not when a condition is met. It fits work that recurs and never stays done: issue triage, nightly test runs, dependency audits, drift checks. This cookbook gives you the harness once, then eight prompts to copy, point at your repo, and forget. The full collection lives at /type/schedule.

Schedule loops are the easiest type to under-specify: the clock starts a run, nothing in the mechanism ends it, and nothing limits what it may touch. Every recipe below fixes that with three fields: done-for-today, never, and budget.

The harness

A SCHEDULED ROUTINE — CRON FOR AGENTScron fires0 6 * * *wakefresh sessionrun tasktriage · auditreportemail / PRsleepuntil next tickno state kept between runs — each tick starts clean
A scheduled routine is cron for agents — a timer wakes a fresh session, it runs the task and reports out, then sleeps until the next tick, keeping no state in between.

Every recipe is the same three pieces: a cron entry, a prompt file, and a budget. The cron side is ordinary:

# crontab -e
0 9 * * 1-5  cd ~/code/myrepo && ./loops/run.sh triage.md >> ~/loops.log 2>&1

run.sh is a thin wrapper: per-run timeout, throwaway worktree, no dirty checkout.

#!/usr/bin/env bash
set -euo pipefail
PROMPT="$1"
git fetch origin && git worktree add /tmp/sched-run origin/main
cd /tmp/sched-run
timeout 30m claude -p "$(cat "loops/$PROMPT")" --dangerously-skip-permissions
cd - && git worktree remove --force /tmp/sched-run

A schedule loop has no exit condition: the clock starts it and the timeout kills it. The prompt governs everything in between, so each recipe states what done looks like for one run and what the agent must never do.

The recipes at a glance:

#RecipeCadenceBudgetOutput
1Morning issue triageweekdays 9:0030mlabels + one summary comment
2Issue dedup sweepMon/Thu 14:0020mdedupe comments
3Nightly e2e rundaily 02:0090mfailure diagnoses
4Weekly dependency auditMon 07:0045mreport + at most one PR
5Docs freshness checkFri 10:0030mone docs PR or one issue
6Weekly tech-debt reportFri 16:0040mreport only
7Stale branch reportMon 08:0015mreport only
8Config drift checkdaily 06:0015mreport only

1. Morning issue triage

The classic. Directory: morning-issue-triage.

/schedule weekdays 9:00
task: |
  Review all GitHub issues opened since the last run.
  For each: apply labels, check for duplicates against open issues,
  and flag anything that looks like a security report or prod outage.
  Post a one-comment summary on anything you triaged.
done-for-today: every new issue has at least one label or a dedupe comment
never: close an issue, assign a human, or edit issue bodies
budget: 30m per run

2. Issue dedup sweep

Runs less often than triage and looks deeper. Directory: issue-dedup-schedule.

/schedule mon,thu 14:00
task: |
  Scan open issues for duplicates using titles, bodies, and stack traces.
  For each candidate pair, comment on the newer issue linking the older one
  with a one-line justification. Confidence below "near-certain" → skip.
done-for-today: dedupe candidates list is empty or commented
never: close issues; a human confirms every dedupe
budget: 20m per run

3. Nightly e2e run with first-pass diagnosis

Directory: nightly-e2e-run.

/schedule daily 02:00
task: |
  Run the full e2e suite against staging. If green, log one line and exit.
  If red: rerun failures once to separate flakes from real breaks, then for
  each real failure write a diagnosis (failing step, likely commit range,
  suspect files) to reports/e2e/<date>.md.
done-for-today: suite ran; failures have diagnoses committed to the reports branch
never: modify test code or application code — diagnose only
budget: 90m per run

When the flake list gets long, hand it to a goal loop like kill-flaky-tests.

4. Weekly dependency audit

Directory: weekly-dependency-audit.

/schedule mon 07:00
task: |
  Run `npm audit` and `npm outdated`. For each advisory: severity, whether
  our code hits the vulnerable path, and the upgrade cost. Open one PR
  bumping safe patch-level security fixes (tests must pass). Everything
  else goes in the report with a recommendation.
done-for-today: report committed; at most ONE upgrade PR opened
never: bump majors; merge anything
budget: 45m per run

5. README and docs freshness check

Directory: readme-freshness-check; the continuous version is keep-docs-in-sync.

/schedule fri 10:00
task: |
  Compare README and docs/ against reality: do the setup steps still work,
  do documented commands exist in package.json, do referenced files exist?
  Fix small drift (renamed script, dead link) in a single docs-only PR.
  Structural rot goes in an issue instead.
done-for-today: one docs PR or one issue, or a "docs clean" log line
never: touch anything outside README* and docs/
budget: 30m per run

6. Weekly tech-debt report

Directory: weekly-tech-debt-report.

/schedule fri 16:00
task: |
  Sweep the repo: TODO/FIXME density, files over 500 lines, duplicated
  logic, circular imports, suppression comments added this week.
  Write reports/tech-debt/<date>.md ranked by blast radius, each item
  with file paths and a one-line suggested fix.
done-for-today: report committed and linked from the previous report
never: refactor anything — this loop only observes
budget: 40m per run

Feed its top item to a /type/goal loop like dead-code-elimination: observe on a schedule, fix with a goal.

7. Stale branch report

Directory: stale-branch-report.

/schedule mon 08:00
task: |
  List branches with no commits in 30+ days. For each: last author,
  ahead/behind counts, and whether an associated PR is open, merged,
  or abandoned. Group into "safe to delete", "needs owner decision",
  "active PR". Write the report; delete nothing.
done-for-today: report posted as a GitHub discussion comment
never: delete branches or close PRs
budget: 15m per run

8. Config drift check

Directory: config-drift-check.

/schedule daily 06:00
task: |
  Diff deployed environment config against the committed baseline:
  env var names (never values), service counts, cron entries, feature flags.
  Any drift → write the diff to reports/drift/<date>.md and stop.
done-for-today: drift report written, or "no drift" logged
never: change any config in either direction — report only
budget: 15m per run

Four rules the recipes share

DAILYMorning issue triageNightly e2e + diagnosisWEEKLYDependency auditTech-debt reportStale-branch sweepDocs freshnessConfig-drift check
A practical cadence: light triage runs daily, while heavier audits — dependencies, tech debt, stale branches, docs, config drift — run once a week.
  • State done-for-today. The run's definition of done is the only bound short of the timeout; leave it out and the agent drifts.
  • Separate observing from fixing. Most recipes here only report; a human or a goal loop acts. A loop that observes and fixes on the same schedule accumulates unreviewed changes.
  • Cap output, not just time. "At most one PR per run" is the difference between a normal Monday and fourteen dependency PRs.
  • Close the notification gap. A run that finds drift at 2am should tell someone. Sending a real email from the harness, report attached, human on reply-to, is one call with ConnectMyEmail, email infrastructure built for agents.

Tune one to your repo

The Builder takes any recipe here and emits the cron entry, prompt file, and budgeted wrapper with your test commands, labels, and cadence filled in.

Ready to run one? Browse the loop directory →
All MAINTENANCE loops

Draft a sprint plan from the backlog

Turn the open issue backlog into a proposed two-week sprint plan with estimates, a dependency ordering, and an explicit cut line, written as a document for the team to edit.

Open loop →

Complete goal with skill stack

Read goal.md, follow your skill guides, meet all acceptance criteria, and stop after 20 turns or verification passes.

Open loop →

Audit code diffs, ship clean

Run code review on each step's diff, stop when zero findings or after 3 rounds.

Open loop →

Backlog-clearing loop with a separate verifier

The four-settings loop template: a separate verifier model that never shares context with the writer, a hard stop rule, a state file re-read each cycle, and worktree isolation. Point it at a checkable backlog and let it run overnight.

Open loop →