Skip to content

Feature Request: Scheduled / cron task support #30646

Description

@chenyanchen

Summary

Add a built-in scheduler to Claude Code so that skills or commands can be triggered automatically on a cron-like schedule, without requiring a human to start each session.

Motivation

Claude Code already supports rich agentic workflows via skills (.claude/skills/). Many of these workflows are periodic in nature—daily diary writing, social media posts, content publishing, community engagement, etc. Currently, every run requires a human to open a terminal and type a command. This breaks the autonomous loop that makes agent-driven projects viable.

Example use case: I run a self-sustaining AI project (Silicon Series 1) that has a /daily skill combining several operations: writing a diary entry, checking for WeChat articles to publish, posting Reddit comments to build karma, and posting to X/Twitter. Today, this requires me to trigger it manually every day.

Proposed Design

Option A: CLAUDE.md schedule declaration (minimal, elegant)

Extend CLAUDE.md (or a new .claude/schedules.yaml) with a schedules block:

# .claude/schedules.yaml
schedules:
  - cron: "0 9 * * *"       # every day at 09:00 local time
    skill: daily
    description: "Run daily operations"
  - cron: "0 * * * *"       # every hour
    command: "check inbox"

A daemon (claude schedule start) reads this file, keeps running in the background, and fires sessions at the specified times.

Option B: CLI commands (explicit, composable)

# Register a scheduled job
claude schedule add --cron "0 9 * * *" --skill daily --name "daily-ops"

# List scheduled jobs
claude schedule list

# Remove a job
claude schedule remove daily-ops

# Start/stop the scheduler daemon
claude schedule start
claude schedule stop

Option C: OS-native integration (lightweight)

Claude Code generates native cron entries or launchd/systemd units, and the user installs them. Lower complexity, no daemon required.

# Generate and install a cron entry
claude schedule install --cron "0 9 * * *" --skill daily
# → installs: 0 9 * * * claude --skill daily --project /path/to/project

Key Requirements

  • Project-scoped: each schedule is tied to a specific project (working directory)
  • Skill/command agnostic: should be able to run any skill or arbitrary prompt
  • Non-interactive by default: scheduled runs should not require human input (or gracefully skip steps that do)
  • Logging: output from scheduled runs should be persisted somewhere inspectable
  • Safety: scheduled runs should respect the same permission model as interactive runs (no auto-approving destructive operations unless explicitly configured)

Alternatives Considered

  • OS cron + shell script: Works but requires the user to manage the cron entry manually, hardcode paths, and handle env vars. Fragile.
  • CI/CD (GitHub Actions etc.): Overkill for local workflows; requires a repo with secrets set up.

Additional Context

Scheduled execution would significantly increase the utility of Claude Code for autonomous, long-running agent projects—not just mine, but any project where periodic AI-driven actions are valuable (code health checks, dependency updates, report generation, etc.).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions