MosaicMosaicTerminal

Scheduler

Automate tasks with cron schedules, file watchers, and Claude CLI prompts.

Scheduler

Scheduler panel showing automated tasks with cron schedules and run history

The Scheduler automates recurring tasks inside Mosaic. Set up cron jobs, file watchers, or interval timers that execute shell commands or Claude CLI prompts -- with run history, timeout enforcement, webhook notifications, and git auto-commit on completion.

Opening the Scheduler

Toggle the Scheduler panel with Ctrl+J. It appears in the sidebar dock alongside other panels.

Trigger Types

Each scheduled task uses one of three trigger types that determine when the task runs.

Cron

Standard five-field cron expressions: minute hour day-of-month month day-of-week.

ExpressionRuns
*/15 * * * *Every 15 minutes
0 9 * * 1-59:00 AM on weekdays
0 0 * * *Midnight daily
0 */4 * * *Every 4 hours
0 2 * * 02:00 AM every Sunday
30 12 1 * *12:30 PM on the 1st of each month

Cron triggers are best for tasks that need to run at specific times or on a calendar-based schedule.

Interval

Run a task every N seconds. Simpler than cron when you just need "every X minutes."

IntervalRuns
60Every minute
300Every 5 minutes
3600Every hour
86400Once per day

Interval triggers start counting from when the task is enabled or the app starts.

File Watch

Trigger when files matching a glob pattern are created, modified, or deleted.

PatternWatches
./src/**/*.tsAny TypeScript file in src/
./tests/**/*.test.tsTest files only
./package.jsonA specific file
./**/*.{css,scss}CSS and SCSS files anywhere

File watch triggers use debouncing to avoid firing repeatedly during rapid saves (e.g., when a formatter runs across many files).

Tip: File watch triggers are the foundation for "auto-run on save" workflows. Watch your source files and run the test suite, linter, or formatter automatically whenever you save. No more forgetting to run tests.

Action Types

Each task executes one of two action types when triggered.

Shell Command

Run any shell command. The command executes in the workspace's default working directory and supports full shell syntax including pipes, redirects, and chained commands.

Examples:

npm run test
npm run build && npm run lint
git status | head -20
./scripts/deploy.sh --env staging

Claude CLI Prompt

Send a prompt to the Claude Code CLI. Mosaic spawns a Claude session, passes your prompt, waits for completion, and records the output.

Examples:

Summarize yesterday's git commits and note any breaking changes
Review the files changed in the last hour for potential bugs
Generate API documentation for src/api/

Claude CLI prompts turn the scheduler into an autonomous code review and maintenance system. The agent runs on your schedule, examines your code, and produces reports or makes changes.

Tip: Combine cron triggers with Claude prompts for powerful automated workflows. Schedule a nightly prompt that reviews the day's changes for code quality issues, or a weekday morning prompt that summarizes what happened overnight.

Run History and Timeline

Every task execution is recorded with full details:

FieldDescription
Start timeWhen the run began
End timeWhen the run finished
DurationHow long the run took
Exit code0 for success, non-zero for failure
OutputFull stdout and stderr content
StatusSucceeded, failed, or timed out

Timeline View

The timeline view provides a visual representation of scheduled and completed runs on a horizontal timeline. This makes it easy to:

  • Spot patterns (does the linter always fail at 2 AM?)
  • Identify failures at a glance
  • See how long runs typically take
  • Verify that scheduled runs are actually firing

Timeout Enforcement

Set a maximum execution time per task. If a task exceeds its timeout:

  1. The process is terminated (the shell command or Claude session)
  2. The run is recorded as timed out
  3. Webhook notifications fire with the timeout status

This prevents runaway scripts from consuming resources indefinitely. A deploy script that normally takes 2 minutes but hangs for 30 minutes gets caught and stopped.

Tip: Set timeouts generously at first (2-3x the expected run time), then tighten them once you have baseline timing data from the run history.

Webhook Notifications

Each task can send notifications when it completes, through one or more webhook providers:

ProviderNotification Format
DiscordRich embeds showing task name, status, duration, and output excerpt
ntfyPush notifications to your phone or desktop via ntfy.sh
TelegramBot messages to a Telegram chat

What Gets Sent

Webhook notifications include:

  • Task name and description
  • Status -- succeeded, failed, or timed out
  • Duration -- how long the run took
  • Output excerpt -- first/last lines of output (for Discord embeds)
  • Error details -- error content on failure

Configure webhook URLs per task in the task settings. You can enable notifications for all runs, or only for failures.

Tip: Use ntfy for phone push notifications when monitoring critical scheduled tasks. A failed nightly backup or a broken test suite sends a notification directly to your phone, so you know about it before you start working the next morning.

Git Auto-Commit

Enable automatic git commits after successful task completion. When a scheduled task finishes and there are uncommitted changes in the working directory:

  1. Mosaic stages the changed files
  2. Creates a commit with a descriptive message referencing the task name
  3. The commit appears in your git history with clear provenance

This is useful for tasks that generate or modify files:

TaskAuto-Commit Use Case
Code formattingCommit formatted files automatically
Dependency updatesCommit package-lock.json after npm update
Code generationCommit generated API clients or types
DocumentationCommit auto-generated docs

Tip: Combine git auto-commit with webhook notifications: the task runs, commits changes, and notifies you that the commit was made. You can review it at your convenience.

Enable and Disable

Toggle individual tasks on or off without deleting them. Disabled tasks:

  • Retain their full configuration (trigger, action, timeout, webhooks)
  • Keep their run history intact
  • Do not fire their triggers
  • Can be re-enabled at any time

This is useful for temporarily pausing a task during development, debugging, or when you need to reduce system load.

Example Use Cases

Here are practical scenarios for each trigger type:

File Watch Examples

PatternActionPurpose
./src/**/*.tsnpm run testAuto-run tests on save
./src/**/*.{ts,tsx}npx prettier --write changed filesAuto-format on save
./openapi.yamlnpx openapi-generator ...Regenerate API client on spec change
./docs/**/*.mdnpm run build:docsRebuild docs on content change

Cron Examples

ScheduleActionPurpose
0 9 * * 1-5Claude: "Summarize yesterday's commits"Morning git summary
0 2 * * *./scripts/deploy.shNightly deployment
0 */4 * * *curl -f http://localhost:3000/healthHealth check every 4 hours
0 0 * * 0Claude: "Review this week's TODOs and open issues"Weekly review

Interval Examples

IntervalActionPurpose
300 (5 min)git fetch --allKeep local refs updated
3600 (1 hr)npm audit --productionHourly security check
60 (1 min)curl -s http://localhost:8080/metricsMetrics polling

Keyboard Reference

ShortcutAction
Ctrl+JToggle scheduler sidebar panel