How to schedule recurring AI tasks

The useful AI work in an office is rarely a one-off question. It is the same check every Monday, the same summary at month end, the same review whenever a new export lands.

Short answer

Write the task as a fixed instruction, choose a trigger — a schedule, a watched folder or a webhook — and run it with a tool that records every run: the instruction, the model, the answer and the cost. Start with tasks that report rather than act, check the first week of runs by hand, and keep a way to stop everything at once.

Which trigger fits the job?

TriggerFires whenExample
Schedule (cron)At set timesEvery weekday at 07:30, produce the day's follow-up list from the notes in the instruction
File watchA watched file or folder changesWhen the month-end export is replaced, run the month-end review
WebhookAnother program sends an HTTP requestA script posts this week's hours; the task works out the overage and explains it

Cron schedules in two minutes

A cron schedule is five fields: minute, hour, day of month, month and day of week. An asterisk means "every".

ScheduleRuns
30 7 * * 1-507:30, Monday to Friday
0 9 1 * *09:00 on the first day of every month
0 17 * * 517:00 every Friday
0 */2 * * *On the hour, every two hours

Times are the computer's local time. A scheduler on a laptop only runs while the laptop is awake: a trigger due while the lid was closed is missed. Put important schedules on a machine that stays on, or let an automation catch up when the machine wakes.

Write instructions that survive running unattended

  • Be specific about the input. Say exactly what the task works from, not "the latest figures".
  • Say what done looks like — the format, the length, the headings.
  • Tell it what to do when something is missing: say so and stop, never guess.
  • Keep arithmetic out of the model. Let a calculation engine produce the figures and the model explain them. See how to stop AI getting numbers wrong.
  • Report first, act later. A task that writes a summary for a person is safe to schedule; one that sends, files or deletes is not, until you have watched it for a while.

Setting it up in OpenClerq

Open Settings → Triggers in the desktop app and add a schedule, a watched path or a webhook, each with the instruction it should run. Triggers are stored in OpenClerq's local database, and a schedule that is not valid cron is rejected when you save it, with the reason. The same configuration can be sent to the gateway directly:

POST /triggers
{
  "cron": [
    { "id": "monday-review", "schedule": "0 8 * * 1",
      "message": "List the recurring month-end checks and who owns each." }
  ],
  "file": [
    { "id": "month-end-export", "path": "/Users/you/Exports/month-end.csv",
      "message": "The month-end export has changed. Run the month-end review." }
  ],
  "webhooks": {
    "weekly-hours": { "message": "Weekly hours received." }
  }
}

A script on the same machine fires the webhook with the gateway token, and can send the data with it — the message in the body replaces the stored one:

curl -X POST http://127.0.0.1:18790/webhook/weekly-hours \
  -H "Authorization: Bearer $(cat ~/.clerq/gateway-token)" \
  -H "Content-Type: application/json" \
  -d '{"message": "calculate (logged - included) * rate where logged=46.5 included=40 rate=95"}'

Every firing runs the instruction through the same pipeline as the Task runner on the Developer page — the calculation engine first when the instruction contains a calculation, then the model — and is recorded as a run with a step trace, the model used, tokens and cost. A webhook call returns the run id so the script can look the run up.

To stop things: cancel a single run from the run list, or use the kill switch, which refuses pending approvals, cancels everything running and pauses all triggers until you resume them.

A trigger runs a fixed instruction. For work that needs an agent, with files, commands, a budget and catch-up for a missed schedule, use an automation, next.

Scheduled agents with gates: automations

An automation is a YAML file that runs a coding agent — Claude Code, Codex, Cursor, or OpenClerq's own — against a git repository, on a schedule or on demand. Each run gets a fresh git worktree. When the agent has finished, your gates run (commands that must pass, and limits on the size of the diff). Only if they pass does the run ask to push, and it opens a draft pull request. New automations are saved switched off, a push waits in the approvals inbox unless the spec says otherwise, and an automation's first push always waits.

name: nightly-dependency-triage
on:
  schedule: '0 3 * * 1-5'   # weekday 03:00
  catch_up: true            # run once on wake if a slot was missed
targets:
  repos: [github:your-org/your-repo]
agent:
  driver: claude-code
prompt: Apply patch and minor dependency updates. Do not touch source files.
gates:
  - run: npm test
  - assert: diff.files_changed <= 5
publish:
  pull_request: draft
budget:
  max_usd_per_run: 2.00
  max_usd_per_month: 60.00

Apply it from the desktop's Automations page, or with clerq automation apply -f nightly.yaml. catch_up is opt-in: without it, a slot missed while the machine slept is skipped and recorded. The spec can also set retries with backoff, models to escalate to when a gate fails, and models to fall back to when one is unavailable. Isolation is opt-in as well: a spec that names no sandbox runs as you, and profile: seatbelt (macOS) or profile: container confines the agent and its gates.

An automation needs a repository to work in. For a clerical instruction that needs none, use a trigger.

Rules for AI that runs on its own

  1. Every automation has an owner who reads its runs.
  2. Every automation has a limit — on time, on spend, or both.
  3. Nothing arms itself. A new automation runs manually until someone has checked its output.
  4. A person approves anything irreversible: sending, filing, paying, deleting.
  5. There is one switch that stops everything, and everyone knows where it is.

Frequently asked questions

Can I schedule prompts in a chatbot instead?

Some assistants offer scheduled prompts. They run in the provider's cloud, on its terms, and the record of each run lives in the provider's account. A local scheduler keeps the instruction, the data and the log on your own machine.

What happens if my computer is asleep when a task is due?

A trigger due while the computer slept is missed. An automation with on.catch_up: true runs once when the machine wakes, however many slots it missed; without it, the missed slots are skipped and recorded. Put important triggers on a computer that stays on, or on a server.

How do I stop an automation that is misbehaving?

Cancel its run, or use the kill switch, which cancels every running run, refuses pending approvals and pauses all triggers in one step. Triggers stay paused until you resume them; you can still run tasks by hand.

How much does a scheduled AI task cost?

It depends on the model and on how much text goes in and out. OpenClerq records the tokens and cost of every model call against its run, so you can see the cost of each automation rather than one monthly total. A local model has no per-token cost. See how to track AI costs per task.

Run it yourself — or have us build it

OpenClerq is free and MIT-licensed: install it and bring a local model or your own API key. If you would rather not, we build custom automation on the same core, around your workflow, and install it on your machines — pilots from €900.

Get a custom build Get OpenClerq free