Scheduled Local AI Jobs on macOS with launchd
Build a local-first AI job scheduler on macOS using launchd, from sync and plists to AI jobs, WatchPaths, and dashboards.
Scheduling local AI jobs on your own machine turns a clever prompt into a durable system. This tutorial walks straight through the working pattern: jobs as directories, launchd as the scheduler, and tiny scripts you can actually evolve.
You will build the manager, ship a real AI job, wire up reactive WatchPaths workflows, and then choose the dashboard surface that fits how you work.
Lesson outline
- Your First Job — Init the project, create your first job, see it register with launchd.
- Anatomy of a Job — What's inside a job directory — the schedule file and the run script.
- Parse a Schedule File — Read a schedule file, handle all three types, write tests.
- Generate a Plist — Turn a JobDefinition into valid plist XML that launchd can consume.
- Register with launchd — installJob: write the plist, bootout the old, bootstrap the new, enable it.
- Declarative Sync — syncAllJobs: discover desired state, diff against installed, converge.
- Your First AI Job — A job that calls an LLM to do real work. Choose your provider.
- WatchPaths: Reactive AI — A job triggered by filesystem changes. Drop a file, AI processes it.
- Logs, Errors, and Debugging — Where logs go, what to do when jobs fail, how to diagnose.
- Hardening — Idempotent sync, error recovery, safe-to-repeat patterns.
- Dashboard — See your jobs at a glance. Choose how you want to see them.
Lesson sequence
Build it step by step
Lesson 1
Your First Job
Lesson 2
Anatomy of a Job
Lesson 3
Parse a Schedule File
Lesson 4
Generate a Plist
Lesson 5
Register with launchd
Lesson 6
Declarative Sync
- 4 branches
Lesson 7
Your First AI Job
- 3 branches
Lesson 8
WatchPaths: Reactive AI
Lesson 9
Logs, Errors, and Debugging
Lesson 10
Hardening
- 5 branches
Lesson 11
Dashboard
Companions
Bring the skill along
launchd-ai-scheduler
Build a local-first AI job scheduler on macOS using launchd. This skill guides you through 11 lessons, adapting to your choices. Say "teach me" to start, or ask any question about the project.
companion/SKILL.md