> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecadence.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Routines

> Work a bot does on a schedule, or when something happens.

A **routine** is a saved instruction a bot runs on its own. It starts on a schedule, when a webhook fires, when a message arrives, or when something changes.

Examples:

* "Every weekday at 9am, check yesterday's orders and post a summary."
* "When the price list file changes, tell the team what changed."
* "When our store sends a webhook, check the new order and confirm stock."

## Create a routine

The easy way is to ask the bot: "Every Monday at 8am, send me the week's bookings." It creates the routine for you.

To create one yourself:

1. Open the bot's **Routines** panel beside its chat and click **Create Routine**.
2. Give it a **Name** and an **Instruction**: what the bot should do each time.
3. Under **When to run**, click **Add trigger**.
4. Switch it **Active** and click **Save**.

Click **Test run** to try it straight away. Files you attach under **Files** go with every run.

## Triggers

| Trigger | When it runs |
| - | - |
| **On a schedule** | Every hour, every day, on weekdays, every week, every month, at an interval, or on a cron expression under **Advanced**. Use **Run at** for a one-time run. |
| **Webhook** | When another system sends a `POST` to the bot's webhook URL. See [Webhooks](https://docs.usecadence.gg/api/reference/webhooks.md). |
| **Git event** | When GitHub sends an event for a connected repository. |
| A message (for example **Slack message**) | When the bot receives a verified message from that channel. |
| **When something changes** | When a watched file, command output or app result changes. |

Schedules use your time zone.

## When something changes

A change trigger checks something on an interval (every 15 minutes by default, at least every 5) without using the model. The routine only runs when the result is different from last time. It can watch:

* **Files or folders on the computer**: names, sizes and modified times.
* **A command's output**: a shell command run on the bot's computer.
* **An integration tool**: a read-only tool from a connected app.

For a command or tool that returns a list, set **Fields that mark a change** so only real changes count, not things like a fetch time. Turn on **Post "No changes" in chat** to see every check.

## Advanced options

| Option | Effect |
| - | - |
| **Model** and **Thinking** | Run on a different model from the bot's. |
| **Time limit** | Stop a run after 5 to 240 minutes. Default: no limit. |
| **If the last run is still going** | **Skip this time** (default) or **Run it afterwards**. |
| **Catch up a missed run when the app starts** | Run once on startup if the last scheduled run was missed. |

## Run history

Each routine has a history of its runs. You can open a run's chat, stop a run that is still going, and see how many times a run was skipped because the previous one was still working.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.