Manage Scheduled Tasks
Use this skill to manage Markdown-defined Pi scheduled tasks. The scheduled_tasks tool is for inspection, validation, manual runs, logs, and scheduler health. Create and edit task definitions with normal file tools, then validate with scheduled_tasks.
Workflow
- Inspect the scheduler root with
scheduled_tasksactiondoctor. The first line reportsrootDir. - List or read existing tasks with
scheduled_tasksactionlistorreadwhen modifying an existing task. - Create or edit only
<rootDir>/tasks/<task-id>.mdfor task definitions. - Validate after every create or edit with
scheduled_tasksactionvalidateand the task ID. - Fix validation errors before enabling or manually running a task.
- Use
scheduled_tasksactionrunonly after validation passes or when explicitly debugging a failing task. Manual runs launch asynchronously and do not advance schedulernextRunAt. - Use
scheduled_tasksactionlogsafter a manual or scheduled run to inspect results. Run summaries report launch outcomes such aslaunched; final success/failure appears later in logs and lifecycle artifacts.
Task file rules
Task files use YAML frontmatter plus a Markdown body:
---
id: dependency-audit
description: Check dependencies weekly
enabled: false
schedule: "0 9 * * 1"
cwd: /absolute/path/to/project
tools:
- read
- grep
envFiles:
- .env
env:
NODE_ENV: production
executionShell: bash-login
timeoutMinutes: 30
precheck:
script: network-and-broker.sh
timeoutSeconds: 15
skipExitCodes: [78]
catchup: false
handoff: false
---
Review dependency status and summarize any issues.
Follow these constraints:
- Use task IDs containing only letters, numbers, underscores, and hyphens. Do not use slashes or dots.
- Prefer omitting
id; when present, it must match the filename without.md. - Keep new or uncertain tasks
enabled: falseunless the user explicitly asks to schedule them. - Enabled tasks require a five-field cron
schedule, an absolute existingcwd, and a non-empty body. - Keep
toolsas an explicit allowlist. If omitted, the extension's configureddefaultToolsapply. - When a task uses MCP broker tools (
mcp_search,mcp_describe, ormcp_call), also include readonly filesystem toolsread,ls,find, andgrepunless there is a specific reason not to. Broker results can spill large outputs to local files, and scheduled runs need these tools to inspect spillover paths and local diagnostics. - Set
catchup: trueonly when one coalesced make-up run is useful after downtime; missed occurrences are not replayed one-by-one and global config caps catchups per tick. Active scheduled runs are also capped globally bymaxConcurrentScheduledRuns. - Use
precheckwhen a task should skip cleanly unless a condition is met, such as internet access, VPN, or MCP broker availability. Put reusable scripts in<rootDir>/scripts/;precheck.scriptis a relative path under that directory, not the projectcwd, and absolute paths or..segments are rejected. Prechecks run with processcwdset to the taskcwd, default tointerpreter: bash,args: [],timeoutSeconds: 30, andskipExitCodes: [78], and use exit0to continue, a configured skip code to mark the runskipped, and other failures to mark the runfailed. Do not use inline shell snippets in task Markdown. - Set
handoff: trueonly when cross-run memory is useful. Thescheduled_task_handofftool is added automatically for scheduled child runs. - Write task prompts to be idempotent where practical: inspect current external state before creating tickets, branches, reports, deployments, or other irreversible changes, because crash recovery may retry work and cron-style systems cannot promise exact-once execution.
- Use
envFilesfor dotenv-style bulk environment defaults. Relative env file paths resolve againstcwd, and listed files are required in v1. - Use inline
envfor explicit overrides; inlineenvwins overenvFiles, and scheduled-run marker variables win over both. - Use
executionShell: bash-loginonly when the task needs bash login startup files for development environment setup; omit it for direct Pi execution. Task env is present when bash starts, but shell startup files may change it. - Do not put secrets in
envor env files; child processes and run logs can expose values. - Use only simple YAML supported by the extension: scalars, arrays with
- item, inline arrays such asskipExitCodes: [78], and one-level object maps such asenv:andprecheck:.
Safety boundaries
Do not edit scheduler-owned runtime data during normal management:
<rootDir>/state/<rootDir>/runs/<rootDir>/locks/<rootDir>/sessions/
<rootDir>/scripts/ is user-managed scheduler configuration, not runtime data; edit it when creating or updating reusable prechecks.
Read run artifacts only when needed for debugging. Do not delete locks or run artifacts unless the user explicitly asks and the failure mode has been investigated.
More detail
For more detail on user-facing behavior, read ../../README.md. Only inspect source files in ../.. if validation output or README behavior is insufficient.