schedule · diff

git:20260720.a5c6d0f to git:20260801.ba2fd67

42 added, 287 removed. Audit A to A.

---
namespace: aiwg
name: schedule
platforms: [all]
- description: Create, update, list, or run scheduled remote agents (triggers) that execute on a cron schedule
+ description: Route recurring work to a provider-native scheduler or an explicitly external host scheduler
commandHint:
- argumentHint: "create|list|delete [--name <name>] [--cron <expr>] [--task <prompt>] [--provider <provider>]"
- allowedTools: Bash, Read, Write, CronCreate, CronDelete, CronList
+ argumentHint: "create|list|delete [provider-native options]"
+ allowedTools: CronCreate, CronDelete, CronList
model: haiku
category: scheduling
modelRole: efficiency
modelTier: economy
---
# Schedule
- **You are the Cross-Provider Scheduler** — creating, listing, and deleting scheduled agent tasks using the best available backend for the current platform.
-
- ## Core Philosophy
-
- Scheduling should work identically regardless of provider. Detect native cron capability first; fall back to the AIWG CLI scheduler when not available. Always check `chrony` installation and recommend it for precise timing.
-
- ## Natural Language Triggers
-
- Users may say:
- - "schedule X to run every day at 9am"
- - "run aiwg sync every morning"
- - "set up a daily health check"
- - "schedule a recurring task"
- - "create a cron job for X"
- - "list my scheduled tasks"
- - "delete the daily-sync schedule"
- - "show scheduled agents"
- - "what's scheduled?"
- - "aiwg schedule create/list/delete"
-
- ## Parameters
-
- ### Operation (positional, required)
- - `create` — Create a new scheduled task
- - `list` — List all scheduled tasks
- - `delete` — Delete a scheduled task by name
-
- ### --name (required for create/delete)
- Unique identifier for the scheduled task. Example: `daily-sync`
-
- ### --cron (required for create)
- Standard 5-field cron expression. Examples:
- - `"0 9 * * *"` — every day at 9:00 AM
- - `"*/30 * * * *"` — every 30 minutes
- - `"0 0 * * 1"` — every Monday at midnight
- - `"0 9 * * 1-5"` — weekdays at 9 AM
-
- ### --task (required for create)
- The prompt or command to run. Examples:
- - `"aiwg sync"` — sync AIWG to latest version
- - `"aiwg doctor"` — run health check
- - `"npm test"` — run test suite
- - Any natural language task description
-
- ### --provider (optional)
- Override the detected provider backend:
- - `native` — force native CronCreate (Claude Code only)
- - `aiwg-cli` — force AIWG daemon CLI
-
- ## Backend Detection
-
- ### Step 1: Detect Native Cron Capability
-
- Try to use the `CronCreate` tool. This tool is natively available only on Claude Code (agent runtime). On all other providers it will not be present.
-
- ```
- Detection order:
- 1. CronCreate available? → use native-cron backend
- 2. CronCreate unavailable? → use aiwg-cli backend
- ```
-
- ### Step 2: Check Chrony Installation
-
- Before scheduling anything, check whether `chrony` (or `chronyd`) is installed. Chrony provides precise NTP time synchronization — more accurate than the standard `cron` daemon's built-in timekeeping, especially on servers that wake from sleep or have clock drift.
-
- ```bash
- which chronyc 2>/dev/null || which chronyd 2>/dev/null
- ```
-
- If chrony is NOT installed, display a recommendation:
-
- ```
- ⚠️ Chrony not detected
-
- For more precise cron scheduling (especially on long-running servers),
- install chrony for accurate NTP time synchronization:
-
- Ubuntu/Debian: sudo apt install chrony
- RHEL/Fedora: sudo dnf install chrony
- macOS: brew install chrony
- Alpine: apk add chrony
-
- This prevents clock drift that can cause scheduled tasks to run at
- unexpected times. Proceeding with current system clock.
- ```
-
- ## Execution: CREATE
-
- ### Backend: Native CronCreate (Claude Code)
-
- When CronCreate is available:
-
- ```
- CronCreate({
- name: "<name>",
- schedule: "<cron-expression>",
- prompt: "<task>"
- })
- ```
-
- **Output on success**:
- ```
- ✓ Scheduled task created (native-cron backend)
-
- Name: daily-sync
- Schedule: 0 9 * * * (every day at 09:00)
- Task: aiwg sync
- Backend: native-cron (CronCreate)
-
- To list: /schedule list
- To delete: /schedule delete --name daily-sync
- ```
-
- ### Backend: AIWG CLI (all other providers)
-
- When CronCreate is NOT available, delegate to the AIWG daemon scheduler:
-
- ```bash
- # Check if daemon is running
- aiwg daemon status
-
- # Create scheduled job via daemon config
- aiwg daemon schedule create --name "<name>" --cron "<expr>" --task "<task>"
- ```
-
- If the daemon is not running, start it first or guide the user:
+ Route scheduling requests without inventing an AIWG scheduler backend.
- ```
- ⚠️ AIWG daemon not running
+ ## Capability boundary
- The aiwg-cli scheduler requires the AIWG daemon. Start it with:
- aiwg daemon start
+ AIWG's production CLI does **not** expose `aiwg schedule`, `aiwg daemon`, or
+ `aiwg daemon schedule`. Never recommend or execute those commands.
- Then retry: /schedule create --name <name> --cron "<expr>" --task "<task>"
- ```
+ There are three distinct states:
- **Output on success**:
- ```
- ✓ Scheduled task created (aiwg-cli backend)
+ 1. **Provider native** — use the provider's scheduling tools directly. In a
+ Claude Code agent session these are `CronCreate`, `CronList`, and
+ `CronDelete`.
+ 2. **AIWG implemented** — no production scheduler implementation currently
+ exists. Do not label this state as emulated.
+ 3. **External trigger** — system cron, a systemd timer, or CI owns time and
+ launches a reviewed, non-interactive provider command. AIWG may document the
+ contract, but it does not own the clock.
- Name: daily-sync
- Schedule: 0 9 * * * (every day at 09:00)
- Task: aiwg sync
- Backend: aiwg-cli (daemon)
+ ## Routing
- To list: /schedule list
- To delete: /schedule delete --name daily-sync
- ```
+ - When `CronCreate`/`CronList`/`CronDelete` are available, use them.
+ - Otherwise, explain that scheduling is external and ask which host mechanism
+ the operator controls.
+ - Do not create a cron entry or CI workflow without explicit authorization.
+ - Keep prompts and reviewed configuration in files; do not place credentials,
+ session material, or sensitive prompt text in process arguments.
- ## Execution: LIST
+ ## Provider-native operations
- ### Backend: Native CronList (Claude Code)
+ For Claude Code inside an agent session:
- ```
+ ```text
+ CronCreate({ name: "daily-sync", schedule: "0 9 * * *", prompt: "Run the reviewed daily sync" })
CronList()
- ```
-
- Display results as a table:
-
- ```
- Scheduled Tasks (native-cron backend)
-
- NAME SCHEDULE NEXT RUN TASK
- daily-sync 0 9 * * * 2026-03-28 09:00:00 aiwg sync
- health-check 0 */6 * * * 2026-03-27 18:00:00 aiwg doctor
- ```
-
- ### Backend: AIWG CLI
-
- ```bash
- aiwg daemon schedule
- ```
-
- Parse and display in the same table format.
-
- If no tasks are scheduled:
- ```
- No scheduled tasks found.
-
- Create one with: /schedule create --name <name> --cron "<expr>" --task "<task>"
- ```
-
- ## Execution: DELETE
-
- ### Backend: Native CronDelete (Claude Code)
-
- ```
- CronDelete({ name: "<name>" })
- ```
-
- ### Backend: AIWG CLI
-
- ```bash
- aiwg daemon schedule delete --name "<name>"
- ```
-
- **Output on success**:
- ```
- ✓ Scheduled task deleted
-
- Name: daily-sync
- Backend: native-cron
-
- No more scheduled tasks. Create one with: /schedule create
- ```
-
- **Output if not found**:
- ```
- ✗ Task not found: daily-sync
-
- Available tasks:
- health-check (0 */6 * * *)
+ CronDelete({ name: "daily-sync" })
```
- ## Backend Routing Table
-
- | Provider | Native CronCreate | Fallback |
- |----------|------------------|---------|
- | Claude Code | ✓ CronCreate/CronList/CronDelete | — |
- | Warp Terminal | — | aiwg daemon |
- | GitHub Copilot | — | aiwg daemon |
- | Cursor | — | aiwg daemon |
- | Windsurf | — | aiwg daemon |
- | OpenCode | — | aiwg daemon |
- | Factory AI | — | aiwg daemon |
- | OpenCode (Codex) | — | aiwg daemon |
- | OpenClaw | — | aiwg daemon |
-
- ## Chrony Setup Recommendations
-
- Always check and report chrony status when creating schedules. Include platform-specific install instructions if missing.
-
- | Priority | When chrony is missing |
- |----------|----------------------|
- | HIGH | Server environments, long-running containers |
- | MEDIUM | Developer workstations |
- | LOW | Short-lived CI/CD agents |
-
- Chrony is especially important when:
- - Tasks are scheduled at exact times (not just intervals)
- - The host may sleep/hibernate between runs
- - Sub-minute precision is needed
- - The system runs in a VM or container with clock drift
-
- ## Error Handling
-
- | Error | Action |
- |-------|--------|
- | CronCreate unavailable | Fall back to aiwg-cli, no error shown |
- | Daemon not running | Show start instructions, stop gracefully |
- | Invalid cron expression | Validate and show examples |
- | Name conflict | Show existing task, offer to update |
- | Delete non-existent | Show available tasks |
-
- ## Cron Expression Quick Reference
-
- ```
- ┌───────────── minute (0 - 59)
- │ ┌───────────── hour (0 - 23)
- │ │ ┌───────────── day of month (1 - 31)
- │ │ │ ┌───────────── month (1 - 12)
- │ │ │ │ ┌───────────── day of week (0 - 6, Sunday=0)
- │ │ │ │ │
- * * * * *
+ Outside that tool surface, report:
- Examples:
- "0 9 * * *" every day at 9:00 AM
- "*/30 * * * *" every 30 minutes
- "0 0 * * 0" every Sunday at midnight
- "0 9,17 * * 1-5" weekdays at 9 AM and 5 PM
- "0 0 1 * *" first of every month at midnight
+ ```text
+ No provider-native scheduler is available in this session.
+ Use an external scheduler (system cron, systemd timer, or CI) to launch a
+ reviewed provider command. AIWG does not provide a resident scheduler command.
```
- ## Examples
-
- ```bash
- # Create a daily sync at 9 AM
- /schedule create --name daily-sync --cron "0 9 * * *" --task "aiwg sync"
-
- # Create a health check every 6 hours
- /schedule create --name health-check --cron "0 */6 * * *" --task "aiwg doctor"
-
- # List all scheduled tasks
- /schedule list
-
- # Delete a scheduled task
- /schedule delete --name daily-sync
+ ## Safety
- # Natural language — parsed and routed automatically
- "run aiwg sync every day at 9am"
- "schedule a health check every 6 hours"
- "show me what's scheduled"
- "delete the daily-sync schedule"
- ```
+ - Treat external scheduler configuration as an operator-owned deployment.
+ - Use absolute, reviewed workspace and prompt paths.
+ - Never embed tokens, cookies, browser profiles, or session data.
+ - Prefer stdin for provider prompts and use the platform's approved secret
+ store or file-backed reference mechanism.
+ - Require an idempotency strategy and lock for mutation-capable jobs.
- ## References
+ ## Discovery terms
- - #597 — Issue: intelligent cross-provider scheduler design
- - @.aiwg/planning/issue-driven-ralph-loop-design.md — Scheduling context
- - CronCreate / CronList / CronDelete — Claude Code native cron tools
- - `aiwg daemon schedule` — AIWG daemon CLI fallback
- - `aiwg runtime-info` — Reports active scheduler backend
+ scheduled recurring task, cron, systemd timer, external trigger, provider-native scheduler