Title: Feature Request: Proactive, Scheduled Hooks for Automation (Cron-like Functionality)
Labels: feature-request, enhancement, hooks, automation
Body
Is your feature request related to a problem? Please describe.
The current hook system in Claude Code (PreToolUse, PostToolUse, UserPromptSubmit, etc.) is incredibly powerful for reacting to events that occur within an active, interactive session. This is perfect for augmenting a developer's real-time workflow.
However, the system is entirely reactive. There is currently no built-in mechanism for Claude Code to initiate tasks autonomously on a predefined schedule. This limits its potential as an automated agent for repository maintenance, periodic checks, and other DevOps tasks that don't require a user to be present.
Describe the solution you'd like
I propose the introduction of a new category of hooks for proactive, scheduled execution, similar to a cron job. This would allow developers to define automated tasks that Claude Code runs in headless mode at specified intervals.
This could be configured within the existing settings.json structure, making it easy to version control and share with a team.
Example settings.json configuration:
{
"scheduledTasks": [
{
"name": "Nightly Security Audit",
"description": "Runs a security audit on new dependencies and recent code changes.",
"schedule": "0 2 * * *", // Standard cron syntax for 2 AM every night
"command": "/project:run-security-audit", // Executes a custom slash command
"timeoutMinutes": 30,
"enabled": true
},
{
"name": "Weekly Stale PR Triage",
"description": "Finds stale PRs and asks for status updates.",
"schedule": "0 9 * * 1", // 9 AM every Monday
"prompt": "Find all open PRs in this repository that have not been updated in over 5 days. For each one, add a comment asking the author for a status update.",
"enabled": true
}
]
}
How it would work:
- A new top-level key like
scheduledTasks or cronHooks would be added to settings.json.
- Each task would have a
schedule (supporting cron syntax and/or human-readable intervals), a command (to run a slash command) or prompt (to run a raw prompt), and other metadata.
- A background daemon or a trigger mechanism within Claude Code would be responsible for executing these tasks.
- The tasks would run in headless mode, leveraging the existing
claude -p "..." functionality.
Describe alternatives you've considered
The primary alternative is to use an external system scheduler (cron on Linux/macOS, Windows Task Scheduler, or a schedule trigger in GitHub Actions) to execute a claude -p "..." command.
However, this approach has several disadvantages:
- Configuration is external: The automation logic is separated from the project's own configuration, making it harder to manage and discover.
- Platform-dependent: The setup process and syntax differ across operating systems.
- Less portable: A new team member would have to manually set up the scheduled tasks on their machine or rely on a central CI/CD system.
By integrating this functionality directly into Claude Code, it becomes a first-class, platform-agnostic feature that is version-controlled and shared seamlessly with the entire team via .claude/settings.json.
Additional context
This feature would significantly expand Claude Code's capabilities, elevating it from a powerful reactive assistant to a proactive, autonomous agent. It unlocks a wide range of valuable automation workflows:
- Repository Maintenance: Automatically fixing lint errors, updating boilerplate, or formatting code on a schedule.
- Reporting: Generating weekly dependency reports or summarizing project activity.
- Issue Management: Creating placeholder tickets for the next sprint or triaging stale issues.
- DevOps: Running nightly builds, smoke tests, or security scans.
This would be a natural extension of the powerful automation capabilities already present in the hooks system, as detailed in the existing documentation (en/docs/claude-code/hooks.md and en/docs/claude-code/hooks-guide.md).
Thank you for considering this feature. I believe it would be a game-changer for teams looking to automate their development and maintenance workflows.
Title: Feature Request: Proactive, Scheduled Hooks for Automation (Cron-like Functionality)
Labels:
feature-request,enhancement,hooks,automationBody
Is your feature request related to a problem? Please describe.
The current hook system in Claude Code (
PreToolUse,PostToolUse,UserPromptSubmit, etc.) is incredibly powerful for reacting to events that occur within an active, interactive session. This is perfect for augmenting a developer's real-time workflow.However, the system is entirely reactive. There is currently no built-in mechanism for Claude Code to initiate tasks autonomously on a predefined schedule. This limits its potential as an automated agent for repository maintenance, periodic checks, and other DevOps tasks that don't require a user to be present.
Describe the solution you'd like
I propose the introduction of a new category of hooks for proactive, scheduled execution, similar to a
cronjob. This would allow developers to define automated tasks that Claude Code runs in headless mode at specified intervals.This could be configured within the existing
settings.jsonstructure, making it easy to version control and share with a team.Example
settings.jsonconfiguration:{ "scheduledTasks": [ { "name": "Nightly Security Audit", "description": "Runs a security audit on new dependencies and recent code changes.", "schedule": "0 2 * * *", // Standard cron syntax for 2 AM every night "command": "/project:run-security-audit", // Executes a custom slash command "timeoutMinutes": 30, "enabled": true }, { "name": "Weekly Stale PR Triage", "description": "Finds stale PRs and asks for status updates.", "schedule": "0 9 * * 1", // 9 AM every Monday "prompt": "Find all open PRs in this repository that have not been updated in over 5 days. For each one, add a comment asking the author for a status update.", "enabled": true } ] }How it would work:
scheduledTasksorcronHookswould be added tosettings.json.schedule(supporting cron syntax and/or human-readable intervals), acommand(to run a slash command) orprompt(to run a raw prompt), and other metadata.claude -p "..."functionality.Describe alternatives you've considered
The primary alternative is to use an external system scheduler (
cronon Linux/macOS, Windows Task Scheduler, or ascheduletrigger in GitHub Actions) to execute aclaude -p "..."command.However, this approach has several disadvantages:
By integrating this functionality directly into Claude Code, it becomes a first-class, platform-agnostic feature that is version-controlled and shared seamlessly with the entire team via
.claude/settings.json.Additional context
This feature would significantly expand Claude Code's capabilities, elevating it from a powerful reactive assistant to a proactive, autonomous agent. It unlocks a wide range of valuable automation workflows:
This would be a natural extension of the powerful automation capabilities already present in the hooks system, as detailed in the existing documentation (
en/docs/claude-code/hooks.mdanden/docs/claude-code/hooks-guide.md).Thank you for considering this feature. I believe it would be a game-changer for teams looking to automate their development and maintenance workflows.