| name | new-routine |
| description | Create a new routine for the routines scheduler. Use when user says "create routine", "new routine", "aggiungi routine", "nuova routine", or "/new-routine". |
You are creating a new routine for this project's automated scheduler.
Project Context
Routines live under the routines/<routine-name>/ directory relative to the project root.
The scheduler (in src/scheduler/) discovers directories there, reads config.json, and runs Claude via claude_agent_sdk.
Each routine directory contains:
config.json โ scheduler config + Claude agent options
PROMT.md โ the prompt sent to the Claude agent (filenames PROMT.md, PROMPT.md, promt.md, prompt.md all accepted)
env/ โ working directory for the agent (agent's cwd is set here)
setup.sh โ optional startup script (runs before agent; use .sh not .bat on Linux)
logs/ โ auto-created output directory
Steps
1. Gather requirements from user
Ask the user:
- Routine name (kebab-case, e.g.
notion-backlog-report) โ used as directory name
- What the routine should do โ this becomes the
PROMT.md content
- Schedule โ cron expression (default: ask when and how often)
- Model โ default
sonnet
- MCP servers needed โ e.g.
["notion"] or empty list
- Startup script needed? โ default no
2. Create directory structure
routines/<routine-name>/
routines/<routine-name>/env/
routines/<routine-name>/logs/
3. Create config.json
Use this template, filling in the gathered values:
{
"model_config": {
"mcp_servers": [],
"model": "sonnet",
"allowed_tools": [],
"load_timeout_ms": 60000
},
"scheduler": {
"enabled": true,
"timezone": "Europe/Rome",
"tasks": [
{
"job_name": "<routine-name>",
"schedule": {
"type": "cron",
"expression": "<cron-expression>",
"metadata": {
"description": "<short description>",
"retry_on_failure": false
}
},
"startup_script": "setup.sh"
}
]
}
}
Key model_config fields (all optional, include only what's needed):
mcp_servers: list of MCP server names, e.g. ["notion"]
model: "sonnet" (default), "opus", "haiku"
allowed_tools: list of tool names the agent can use, default ["Bash", "Read", "Edit"]
disallowed_tools: tools to explicitly block
max_turns: max conversation turns
max_budget_usd: cost cap
4. Create PROMT.md
Write the prompt in the user's language (Italian or English based on context).
Be specific and actionable โ this is what the Claude agent executes autonomously.
5. Create setup.sh (if needed)
#!/usr/bin/env sh
set -eu
echo "Routine <routine-name> avviata in $(pwd)"
Make it executable with chmod +x.
6. Verify
- Confirm all files exist
- Validate
config.json is valid JSON
- Show the user a summary of what was created
Cron Expression Quick Reference
โโโโโโโโโโโโโโ minute (0-59)
โ โโโโโโโโโโโโโโ hour (0-23)
โ โ โโโโโโโโโโโโโโ day of month (1-31)
โ โ โ โโโโโโโโโโโโโโ month (1-12)
โ โ โ โ โโโโโโโโโโโโโโ day of week (0-6, Sun=0)
โ โ โ โ โ
* * * * *
Common patterns:
0 9 * * * โ every day at 09:00
0 9 * * 1-5 โ weekdays at 09:00
*/30 * * * * โ every 30 minutes
0 9,18 * * * โ twice daily at 09:00 and 18:00