# Schedules

A schedule runs a prompt on a cron timetable: when it comes due, the deck opens a tab in the schedule's working directory, starts an agent there (or an orchestration, if that directory defines one) and sends it the prompt. To have agents work through a repository's open issues, see [Work through a repository's open issues](#work-through-a-repositorys-open-issues). This page shows how to create, check, change and troubleshoot schedules, and ends with a complete [reference](#reference) for the schedules file, the cron syntax and the `dot-agent-deck schedule` command.

Schedules run inside the deck's daemon, not inside the TUI or the desktop app. Each daemon runs the schedules in the schedules file on its own machine (`~/.config/dot-agent-deck/schedules.toml` by default; see [The schedules file](#the-schedules-file)), and only while it is running; see [Keep schedules running](#keep-schedules-running).

Which client can do what:

| What | TUI | Desktop app | CLI |
|---|---|---|---|
| Create a schedule with a guided authoring agent | yes: the Schedules manager, or the **schedule** mode in the New Agent form | yes: the **schedule** chip in **New agent** | — |
| Create or change a schedule directly | — | — | `dot-agent-deck schedule add` / `update` |
| List, pause, resume, run now, delete | yes: the Schedules manager | no schedule manager | `dot-agent-deck schedule …` |
| See the agents a run starts | yes, as cards and tabs | yes, on the Dashboard | `dot-agent-deck daemon status` |

The Schedules manager exists only in the TUI. In the desktop app, a schedule's runs appear on the Dashboard like agents you started yourself, but the schedules themselves are not listed there.

## Before you start

- **A running daemon.** Starting the TUI (`dot-agent-deck`) starts one if none is running. The `schedule` subcommands do not start one. Check with `dot-agent-deck daemon status`, which reports a missing daemon rather than starting it.
- **An agent command.** A plain schedule needs the command that launches your agent, for example `claude`, `opencode`, `pi`, `codex`, `devin` or `agy`, or a wrapper that ends up running one of them (`devbox run agent`). Any other command runs, but the deck cannot show its status.

## Schedule a prompt with the CLI

This creates a schedule that runs every weekday at 09:00 in `~/scheduled/morning-digest`:

```bash
dot-agent-deck schedule add \
  --name morning-digest \
  --cron "0 9 * * MON-FRI" \
  --working-dir ~/scheduled/morning-digest \
  --command claude \
  --prompt "Summarize the GitHub issues opened in the last 24 hours in vfarcic/dot-agent-deck."
```

On success the command prints nothing and exits 0. It validates the cron expression, expands `~` and `$VAR` in the working directory, writes the schedules file, and asks the running daemon to reload it. If no daemon is running, it still writes the file and prints ``note: wrote <path> but could not reload the daemon (…); it will load on next `daemon serve` ``; the schedule loads the next time a daemon starts.

Check each step:

1. **The file has it.** `dot-agent-deck schedule list` prints one line per schedule, for example `enabled   morning-digest  cron="0 9 * * MON-FRI"  next=2026-09-30 09:00:00 CEST  shape=config-derived  dir=/home/you/scheduled/morning-digest`. `next=` is the next time the cron matches, whether or not the schedule is enabled.
2. **The daemon has it.** `dot-agent-deck schedule reload` prints `reloaded; registered: <names>`, the enabled schedules the daemon is now running. If your schedule is missing from that list, it is disabled or the daemon rejected it; see [When a schedule does not run](#when-a-schedule-does-not-run).
3. **It works.** `dot-agent-deck schedule run-now --name morning-digest` runs it immediately and prints `ran morning-digest`. A new card (or tab) opens in the TUI and a new row on the desktop Dashboard, and the prompt is sent once the agent is ready.

The working directory is created (including missing parents) when the schedule runs, if it does not exist yet.

## Schedule a prompt with an authoring agent

Instead of writing the command yourself, you can describe the job to an agent that writes it for you. The authoring agent asks for each field, offers to try the prompt in its own session first, confirms the whole schedule with you, and then runs `dot-agent-deck schedule add` (or `schedule update` when editing). When it is done it tells you its pane can be closed.

The authoring agent runs the command in the form's **Command** field, which is pre-filled from [`default_command`](configuration.md#set-the-command-new-agents-start-with); if that is empty, `claude` is used.

It saves the schedule by running `schedule add` (or `schedule update` when editing) by the deck's full path, such as `/home/you/.local/bin/dot-agent-deck schedule add …`, so the schedule reaches this deck whatever the agent's own `PATH` holds. If you let the agent run commands through a permission rule, write the rule against the path shown in its pane: a Claude Code allow rule such as `Bash(dot-agent-deck schedule:*)` does not match it.

**TUI, from the Schedules manager.** Press `s` on the dashboard (`S` also works, and the key can be remapped as `open_scheduled_tasks`; see [Keyboard Shortcuts](keyboard-shortcuts.md)), or click **[Schedules s]**. Press `a` (**[Add a]**), pick a directory (it becomes the schedule's default working directory), confirm the **New Schedule** form's **Dir** and **Command** fields, and the authoring agent starts in that directory. `Esc` or **[Cancel]** returns to the manager.

**TUI, from the New Agent form.** Press `Ctrl+n`, choose a directory, and cycle the **Mode** field past your project's orchestrations to **schedule** (shown with the hint `authoring (one-off)`).

**Desktop app.** Open **New agent**, choose the daemon and a directory, and pick the **schedule** chip under **Mode**. The schedule is written on the machine of the daemon you chose. See [New Agent](desktop/new-agent.md).

Check the result the same way as for the CLI: `dot-agent-deck schedule list` on that machine, or the TUI's Schedules manager.

## Manage schedules

In the CLI, every command selects the schedule by `--name`:

| Task | Command |
|---|---|
| List schedules | `dot-agent-deck schedule list` |
| Change fields | `dot-agent-deck schedule update --name <name> [--cron …] [--working-dir …] [--command …] [--prompt …] [--new-tab-per-fire true\|false] [--enabled true\|false] [--shape …]` |
| Pause | `dot-agent-deck schedule disable --name <name>` |
| Resume | `dot-agent-deck schedule enable --name <name>` |
| Run now | `dot-agent-deck schedule run-now --name <name>` |
| Delete | `dot-agent-deck schedule remove --name <name>` |
| Re-read a hand-edited file | `dot-agent-deck schedule reload` |

Things to know when changing schedules:

- **A schedule cannot be renamed.** `update` has no rename flag. Remove it and add it again under the new name.
- **Pause rather than delete** when you only want it to stop for a while: `disable` keeps every field.
- **Run now needs an enabled schedule.** The daemon only holds enabled schedules, so `run-now` on a disabled one fails with `run-now failed: no schedule named "<name>"`.
- **Deleting does not close tabs.** A tab a schedule already opened stays open.
- **Prompt, cron and `new_tab_per_fire` changes apply from the next run.** A change of `working_dir` or `command` also applies to the next run that opens a new tab. While the schedule reuses a tab whose agent is still running (the default), the next prompt goes into that existing tab, in its old directory with its old command. Close that tab to make the change take effect. For a schedule that opens an orchestration, a changed prompt opens a new orchestration instead, whose orchestrator takes the new prompt as its task; the earlier one keeps running with its own.

### The TUI's Schedules manager

Each row shows the schedule's name, a status and its next run time. The statuses are taken when the dialog opens and refreshed after a run-now:

| Status | Meaning |
|---|---|
| `live` | Enabled, and a tab or agent this schedule started is still running. |
| `idle` | Enabled, with nothing it started running now. |
| `disabled` | Paused (`enabled = false`). Its next-fire cell shows `—`. |
| `refused` | Its last run was refused because the orchestration it opens is not approved. With the schedule selected, the refusal and the command that approves it are shown beneath the list ([Runs refused as not approved](#runs-refused-as-not-approved)). |

| Key / button | Action |
|---|---|
| `a` / **[Add a]** | Add a schedule through the authoring agent (see above). |
| `Enter` / `e` / **[Edit e]** | Edit the selected schedule: the directory picker opens at its working directory, and the authoring agent starts with its current values and saves with `schedule update`. |
| `d`, then `y` / **[Delete d]** | Delete the selected schedule after confirmation (`n` or `Esc` cancels). |
| `r` / **[Run now r]** | Run the selected schedule now. The status line says `Ran schedule '<name>'`, `'<name>' already running — skipped`, or `Run-now failed: …`. |
| `t` / **[Toggle t]** | Pause or resume the selected schedule, without confirmation. |
| `j` / `k` (or `↓` / `↑`) | Move the selection. Rows can also be clicked. |
| `Esc` / `q` / `s` / `S` | Close the manager. |

The manager reads and writes the schedules file on the machine the TUI runs on.

## Choose what a run opens

Without a `shape`, a run looks at the `.dot-agent-deck.toml` in the schedule's `working_dir` itself (parent directories are not searched):

- If it defines an `[[orchestrations]]` block with at least one role, the run opens that directory's default orchestration (the one with `default = true`, otherwise the first one with roles; see [Which orchestration a schedule opens](orchestration.md#which-orchestration-a-schedule-opens)) and sends the prompt to its orchestrator as its task. The orchestrator knows its team and delegates to the other roles, as when you start the orchestration yourself. The schedule's `command` is not used. Every role starts with nobody at its pane, so an agent that asks whether to trust a folder the first time it runs there waits for an answer nobody gives: start each role's agent once in that directory yourself and accept, before the first scheduled run.
- Otherwise the run opens one agent running `command` and sends the prompt to it.

Set `shape` to decide it yourself:

| `shape` | What a run opens |
|---|---|
| *(unset)* | Decided from the directory, as above. `schedule list` shows `shape=config-derived`. |
| `single` | One agent running `command`, even where the directory defines orchestrations. Use it when the job needs the repository (its skills, its git remote) but not the team. |
| `orchestration` | The directory's default orchestration. |
| `orchestration:<name>` | The orchestration with that name. |

```bash
dot-agent-deck schedule update --name morning-digest --shape single
dot-agent-deck schedule update --name morning-digest --shape ""   # back to config-derived
```

A run that opens an orchestration starts it only once you have approved that orchestration's commands and prompts; see [Runs refused as not approved](#runs-refused-as-not-approved).

If a `shape` cannot be satisfied when the run comes due (the named orchestration no longer exists, more than one orchestration with roles uses that name, none has roles, or the directory's `.dot-agent-deck.toml` cannot be parsed), the run is skipped and nothing opens in its place. The reason, including the orchestrations that do exist, goes to the [daemon's output](#where-schedule-errors-are-reported).

## Reuse one tab or open a new one per run

- **`new_tab_per_fire = false` (default):** a run sends its prompt into the tab the previous run opened, if that tab's agent is still the one the schedule started. The agent receives the prompt in the same session, so it still has the previous run's conversation. If that tab was closed, its agent exited, or the daemon restarted since, the run opens a new tab.
- **`new_tab_per_fire = true`:** every run opens a new tab, so you keep one tab per run.

An orchestration a run starts is named after the orchestration and its working directory, for example `team · my-repo`. The TUI shows that name on the run's tab, and the desktop app as the title of the run's group on the Dashboard. If another run of the same orchestration is still running in that directory, started by this schedule or another one, the new run gets the next free number instead (`team · my-repo · 2`, then `· 3`), so you can tell the runs apart in both clients. The run is never skipped because of its name.

A run's prompt waits in the agent's inbox, including when the schedule reuses a tab. The TUI card and desktop tile show `✉N queued`, then `✉ delivered` after receipt, or `not delivered: …` with **Error** (desktop **error**) if delivery fails. Native delivery leaves your input box alone. When the doorbell is needed, it waits for an idle agent and a clear input box; it does not force submission after a timeout. See [Delivery in the TUI and desktop app](orchestration.md#delivery-in-the-tui-and-desktop-app).


## Work through a repository's open issues

To have agents pick up a repository's open GitHub issues, let an agent do the picking: it reads the issues and starts each piece of work as a separate unit with [`dot-agent-deck dispatch`](dispatcher-mode.md). Each unit gets its own git worktree next to the clone, starts as one agent or as a whole [orchestration](orchestration.md), and reports back to the agent that started it when it finishes. There are two ways to set that up.

**Ask a dispatcher.** Start a [dispatcher](dispatcher-mode.md#start-a-dispatcher-pane) in a clone of the repository: the **dispatcher** Mode in the TUI's New Agent form, or the **dispatcher** chip in the desktop app's **New agent**. It already knows how to dispatch. Tell it what you want, for example *"check this repository's open issues labelled agent-eligible every hour, and dispatch each one nobody is working on yet as a separate unit, at most three at a time"*. Its units appear on your deck as they start, and their reports arrive in its conversation.

**Schedule it.** For checks on a timetable that do not depend on a conversation you keep open, create an ordinary schedule whose working directory is a clone of the repository and whose prompt tells its agent to check the issues and dispatch the work:

```bash
dot-agent-deck schedule add \
  --name issue-sweep \
  --cron "0 9 * * MON-FRI" \
  --working-dir ~/code/my-repo \
  --command claude \
  --shape single \
  --prompt "Pull the latest main, because each unit starts from the commit checked out here. List this repository's open issues labelled agent-eligible with gh issue list. For each issue that has no open pull request and no agent/dispatch-issue-<number> branch, start a unit with: dot-agent-deck dispatch issue-<number> --single --task 'Work on GitHub issue #<number> and open a pull request.' Start at most three units per run."
```

- `--shape single` keeps the sweep itself to one agent even when the clone defines orchestrations; the units it starts can still be orchestrations (`--orchestration '<name>'` instead of `--single` in the prompt).
- The agent runs unattended, so allow it to run `gh` and `dot-agent-deck dispatch` without asking, or it waits for an answer nobody gives. A unit started as an orchestration also needs that orchestration [approved](project-trust.md) first.
- Leave `new_tab_per_fire` at its default, so a run goes to the agent the previous run started while that agent is still running. The units report back to that agent.

Each unit works in `../<repo>-dispatch-<name>` on the branch `agent/dispatch-<name>`, which is why the prompt above can skip an issue whose branch exists. See [Dispatcher Mode](dispatcher-mode.md) for checking that a unit started, hearing back from it, and [closing and cleaning up](dispatcher-mode.md#finish-up).

## Keep schedules running

- **Closing the TUI or the desktop app does not stop schedules**, and the daemon keeps running while at least one enabled schedule exists.
- **Nothing runs while the daemon is stopped.** A run whose time passed while the daemon was stopped, or while the machine was asleep for more than a minute, is not made up later.
- **A reboot or a crash stops schedules until something starts the daemon again.** For schedules that must run without you opening the deck, run the daemon as a service with `dot-agent-deck daemon install`; it then starts at boot or login and after a crash. See [Run the Daemon as a Service](daemon-service.md).
- **Stopping the daemon stops the agents it runs**, including those schedules started. `dot-agent-deck daemon stop` may refuse while agents are running unless you pass `--force`. After a restart, the next run of each schedule opens a new tab.
- **A run that comes due while the daemon is restarting** (for example during an upgrade) is not reported as failed. If the restart is called off, the run goes ahead; if it happens, the run is skipped and the schedule's next run happens on the new daemon.
- **Your schedules are kept.** A daemon loads the schedules file when it starts. The `schedule` subcommands do not start a daemon; start the TUI (`dot-agent-deck`), or run `dot-agent-deck daemon serve` to run one in the foreground.
- **Time zone.** Cron times use the daemon's local time zone; there is no per-schedule time zone. On a daylight-saving change, a run inside the skipped hour does not happen and a run inside the repeated hour happens twice.
- **One run at a time per schedule.** If a schedule comes due while its previous run is still starting its agent or waiting to deliver the prompt, the new run is skipped, and `run-now` prints `skipped <name>: previous run still active`.

## When a schedule does not run

### Where schedule errors are reported

Apart from a [run refused as not approved](#runs-refused-as-not-approved), schedule problems are not shown in the TUI or the desktop app. The daemon writes one line per problem, each starting with `[scheduler]`, to its output. For a daemon the deck started in the background, that output is appended to `daemon.log` in the state directory: `$XDG_STATE_HOME/dot-agent-deck/daemon.log`, or `~/.local/state/dot-agent-deck/daemon.log` when `XDG_STATE_HOME` is unset (on Windows, `%LOCALAPPDATA%\dot-agent-deck\daemon.log`). `DOT_AGENT_DECK_STATE_DIR` moves it. For a daemon started with `dot-agent-deck daemon serve`, the lines go to that terminal.

```bash
grep '\[scheduler\]' ~/.local/state/dot-agent-deck/daemon.log | tail -20
```

For more detail, see [Troubleshooting](troubleshooting.md#enabling-debug-logs).

### Runs refused as not approved

A run that would start an orchestration, from its schedule or **Run now**, starts nothing when you have not approved that orchestration as its `.dot-agent-deck.toml` now reads: never approved, or its roles changed since. Instead, the deck asks you to approve it in the TUI and the desktop app attached to it, with the same **Review project commands** review the New Agent form shows, naming the scheduled task that asked. If no client is attached, the review appears when one attaches. Approve there, and the next fire, or `dot-agent-deck schedule run-now --name <name>`, starts it ([Answering the deck's request](project-trust.md#answering-the-decks-request)). If you deny it, the schedule's runs are refused without asking again until the text changes or the daemon restarts. The refusal is also reported:

- `dot-agent-deck schedule list` prints `last fire refused at <time>: <message>` beneath the schedule;
- the TUI's [Schedules manager](#the-tuis-schedules-manager) shows the status `refused`, and the message while the schedule is selected;
- the daemon log has the same message.

The message names the orchestration, the project and the command that approves it, such as `dot-agent-deck trust approve /home/you/code/demo --orchestration team`. Instead of the review in a client, you can run it from a terminal outside the deck, read what it prints, approve, then `dot-agent-deck schedule run-now --name <name>`. See [Approving Project Commands](project-trust.md).

### Symptoms

| Symptom | Cause | What to do |
|---|---|---|
| `schedule list` says `last fire refused`, or the Schedules manager says `refused` | The orchestration the run opens is not approved, or its roles changed. | Approve from the review the deck opens in a client, or run the approve command in the message; see [Runs refused as not approved](#runs-refused-as-not-approved). |
| `schedule add` fails with `invalid cron expression: …` | The cron expression does not parse. | Fix it using [Cron syntax](#cron-syntax). |
| `schedule add` fails with `--command is required: …` | A plain schedule has no `--command`. | Pass `--command`. |
| `schedule add` fails with `a schedule named "<name>" already exists; …` | Names are unique. | Use `schedule update`, or another name. |
| `schedule reload` does not list the schedule | It is disabled, or the daemon rejected the entry (missing `command`, bad `shape`, invalid cron, or a `[scheduled_tasks.issue_dispatch]` table). | Run `schedule enable`, or read the `[scheduler] config error …` line in the [daemon log](#where-schedule-errors-are-reported) and fix the entry. |
| `schedule` commands print `warning: skipped malformed entry…` | An entry in the file does not parse or is invalid. | Fix it by hand. **A command that changes the file (`add`, `update`, `remove`, `enable`, `disable`) rewrites it without the malformed entry**, so fix the entry first. |
| The log or a `schedule` command reports ``schedule "<name>" is a scheduled issue dispatch (`[scheduled_tasks.issue_dispatch]`), which this version no longer runs`` | The entry has a `[scheduled_tasks.issue_dispatch]` table, written for scheduled issue dispatch, which the deck no longer has. The entry is skipped. | Remove the entry, and set up an agent that dispatches the issues instead; see [Work through a repository's open issues](#work-through-a-repositorys-open-issues). |
| `schedule run-now` or `reload` fails with a connection error | No daemon is running (or the CLI and the daemon use different sockets). | Start the TUI or `dot-agent-deck daemon serve`; check with `dot-agent-deck daemon status`. |
| A schedule runs on the wrong days | Numeric days of the week count from `1` = Sunday, not `0` = Sunday. | Use day names (`MON-FRI`); see [Cron syntax](#cron-syntax). |
| A run opened the whole team instead of one agent | The working directory defines `[[orchestrations]]` and the schedule has no `shape`. | `schedule update --name <name> --shape single`. |
| A run opened one agent instead of the team | The directory's `.dot-agent-deck.toml` is missing, has no role-bearing orchestration, or does not parse (without a `shape`, a file that does not parse counts as no file). | Run `dot-agent-deck validate` in that directory, or set `--shape orchestration` to get an error instead of a single agent. |
| Nothing opened, and the log has `[scheduler] task "<name>": spawn failed: shape …` | The `shape` could not be resolved in that directory. | The line names the orchestrations that exist; fix the `shape` or the directory's config. |
| The log has `could not create working_dir` | The working directory cannot be created. | Fix the path or its permissions. |
| A changed `working_dir` or `command` is ignored | The run reused the tab the previous run opened. | Close that tab; see [Manage schedules](#manage-schedules). |

## Worked examples

### A daily single-agent digest

```toml
[[scheduled_tasks]]
name = "morning-digest"
cron = "0 9 * * MON-FRI"          # 09:00 Monday to Friday, daemon local time
working_dir = "~/scheduled/morning-digest"
command = "claude"
prompt = """
Summarize the GitHub issues opened in the last 24 hours
in vfarcic/dot-ai and vfarcic/dot-agent-deck.
"""
new_tab_per_fire = false
enabled = true
```

`~/scheduled/morning-digest` has no `.dot-agent-deck.toml`, so each run uses one `claude` agent, reusing its tab.

### A schedule that opens an orchestration

`~/work/release-audit/.dot-agent-deck.toml`:

```toml
[[orchestrations]]
name = "release-audit"

[[orchestrations.roles]]
name = "orchestrator"
command = "claude"
start = true

[[orchestrations.roles]]
name = "reviewer"
command = "claude"
```

The schedule:

```toml
[[scheduled_tasks]]
name = "weekly-release-audit"
cron = "0 8 * * MON"               # 08:00 every Monday
working_dir = "~/work/release-audit"
command = "claude"                 # required, but not used: the roles' commands are
prompt = "Audit everything merged into main since last Monday and delegate the per-area review."
shape = "orchestration:release-audit"
```

The `shape` is optional here; setting it makes a missing orchestration an error instead of a single agent.

## Reference

### The schedules file

One file per user holds every schedule on a machine:

| Platform | Path |
|---|---|
| Linux, macOS | `$XDG_CONFIG_HOME/dot-agent-deck/schedules.toml`, or `~/.config/dot-agent-deck/schedules.toml` when `XDG_CONFIG_HOME` is unset, empty or not an absolute path |
| Windows | `%APPDATA%\dot-agent-deck\schedules.toml` |

`DOT_AGENT_DECK_SCHEDULES` replaces the whole path. The CLI and the daemon each read it from their own environment, so set it for both or for neither. A missing file means no schedules. The deck writes the file with owner-only permissions (`0600` on Unix), because prompts may contain secrets.

You can edit the file by hand. A running daemon does not notice the edit until you run `dot-agent-deck schedule reload` or it restarts. When a `schedule` command or the TUI's Schedules manager later changes the file, it rewrites the whole file: comments and formatting are not kept, and every `working_dir` is stored with `~` and `$VAR` already expanded.

The file contains an array of `[[scheduled_tasks]]` tables. An entry that does not parse or is invalid is skipped and reported; the other entries still load. If two entries share a name, only one of them runs.

### `[[scheduled_tasks]]` keys

| Key | Type | Required | Default | Meaning |
|---|---|---|---|---|
| `name` | string | yes | — | Unique name. `schedule` commands select by it, and it identifies the tab a run reuses. Cannot be renamed. |
| `cron` | string | yes | — | When to run; see [Cron syntax](#cron-syntax). |
| `working_dir` | string | yes | — | Where the run opens. `~`, `$VAR` and `${VAR}` are expanded (an undefined variable becomes empty), and a relative path is taken relative to your home directory. Created when a run needs it. |
| `command` | string | yes | — | The command a single-agent run starts, for example `claude --model opus`. Must be non-blank. Not used when the run opens an orchestration. |
| `prompt` | string | yes | — | Sent to the agent, or to the orchestrator. |
| `shape` | string | no | unset | `single`, `orchestration` or `orchestration:<name>`; see [Choose what a run opens](#choose-what-a-run-opens). Any other value, or `orchestration:` with an empty name, makes the entry invalid. |
| `new_tab_per_fire` | boolean | no | `false` | `false` reuses the previous run's tab; `true` opens a new one each run. |
| `enabled` | boolean | no | `true` | `false` keeps the entry but does not run it. |

### Cron syntax

A `cron` value has 5, 6 or 7 space-separated fields. The 5-field form is the usual one; the deck adds a seconds field of `0` in front of it.

| Form | Fields |
|---|---|
| 5 fields | `minute hour day-of-month month day-of-week` |
| 6 fields | `second minute hour day-of-month month day-of-week` |
| 7 fields | `second minute hour day-of-month month day-of-week year` |

| Field | Values |
|---|---|
| second, minute | `0`–`59` |
| hour | `0`–`23` |
| day-of-month | `1`–`31` |
| month | `1`–`12` or `JAN`–`DEC` |
| day-of-week | `1`–`7` where **`1` is Sunday** and `7` is Saturday, or `SUN`–`SAT` |
| year | a year, for example `2027` |

Each field accepts `*` (any), a value, a range `a-b`, a list `a,b,c`, and a step `*/n` or `a-b/n` or `a/n`. Day-of-month and day-of-week also accept `?`, meaning any. Names are case-insensitive, and ranges of names work (`MON-FRI`, `JAN-MAR`).

Differences from classic Unix cron that matter when you write an expression:

- **Day-of-week numbers start at 1 for Sunday.** `0` is rejected, and `1-5` means Sunday to Thursday. Prefer names: `MON-FRI`.
- **Day-of-month and day-of-week must both match** when both are restricted. `0 9 1 * MON` runs at 09:00 on the 1st of the month only when that day is a Monday, not on every Monday and every 1st.
- `L`, `W` and `#` are not supported.

The shorthands `@yearly`, `@monthly`, `@weekly`, `@daily` and `@hourly` are accepted. `@weekly` runs at 00:00 on Sunday.

| Expression | Runs |
|---|---|
| `0 9 * * MON-FRI` | 09:00, Monday to Friday |
| `30 7 * * *` | 07:30 every day |
| `0 */2 * * *` | every two hours, on the hour |
| `0 8 * * MON` | 08:00 every Monday |
| `0 0 1 * *` | midnight on the 1st of each month |
| `0 18 * * SAT,SUN` | 18:00 on Saturday and Sunday |

`dot-agent-deck schedule list` prints each schedule's next run time, which is the quickest way to check an expression after adding it.

### `dot-agent-deck schedule` subcommands

Every subcommand that changes the file (`add`, `update`, `remove`, `enable`, `disable`) validates its input, writes the file atomically, and then asks the running daemon to reload. Errors are printed to stderr with a non-zero exit status.

| Subcommand | Flags | Notes |
|---|---|---|
| `add` | `--name <NAME>` `--cron <CRON>` `--working-dir <DIR>` `--prompt <TEXT>` (all required); `--command <CMD>` (required); `--new-tab-per-fire <true\|false>` (default `false`); `--enabled <true\|false>` (default `true`); `--shape <SHAPE>` | |
| `update` | `--name <NAME>` (required); `--cron`, `--working-dir`, `--command`, `--prompt`, `--new-tab-per-fire <true\|false>`, `--enabled <true\|false>`, `--shape <SHAPE>` | Omitted flags leave the value unchanged. `--shape ""` clears the shape. No flag renames a schedule. Fails with `no schedule named "<name>"` for an unknown name. |
| `remove` | `--name <NAME>` | Does not close tabs the schedule opened. |
| `enable` | `--name <NAME>` | |
| `disable` | `--name <NAME>` | |
| `list` | — | Reads the file only; prints `No schedules.` when empty. |
| `run-now` | `--name <NAME>` | Needs a running daemon and an enabled schedule. Prints `ran <name>`, or `skipped <name>: previous run still active` (exit 0 for both). |
| `reload` | — | Needs a running daemon. Prints `reloaded; registered: <names>`. |

`--new-tab-per-fire` and `--enabled` take a value (`--enabled false`), not a bare flag.

### Environment variables

| Variable | Read by | Effect |
|---|---|---|
| `DOT_AGENT_DECK_SCHEDULES` | CLI, TUI, daemon | Path of the schedules file. |
| `XDG_CONFIG_HOME` | CLI, TUI, daemon (Linux, macOS) | Base directory of the default schedules file path. An empty or relative value is ignored. |
| `DOT_AGENT_DECK_STATE_DIR` | daemon | Where `daemon.log` goes. |
