# Routines and loops

> Let your assistants repeat work for you. What routines and loops are, how to make one, how assistants propose them, how to stop one, and why money still asks.

Some work comes back again and again: a Monday summary, a check on a build that keeps failing, a follow up on a thread. You do not have to ask each time. A **routine** or a **loop** does the asking for you, and your assistants will suggest one when they see work that repeats.

Both run in their own chat, so you can open it and read what happened on each run.

## A routine

A routine runs on a schedule you can read at a glance: every hour, every day at 6 pm, weekdays at 8:30, Mondays and Thursdays at 8:00 and 17:00, every 2 hours from 9 to 5, the 1st and 15th of the month. It keeps going until you pause or delete it.

Every routine has an assistant that does its runs. You choose it when you make the routine, and it works on every run in the routine's own chat.

Use a routine for work that belongs to a time:

- A summary of last week's pull requests every Monday morning.
- A look at the inbox for anything waiting every weekday at 8:30.
- A check of the open issues every day.

A routine runs at most once an hour. If you list several times they must be at least an hour apart and share the same minutes, such as 8:00 and 17:00. For times like 8:00 and 17:30, make two routines.

## Make a routine yourself

There are three ways in, and they all use the same form.

- **From the message box.** Choose **Schedule a routine** in the **+** menu next to the message box. If you already typed something like "Summarize open pull requests every Monday at 9am", the form opens with the name, what to do, and the schedule filled in as far as it could read them. If it could not read a time, your words become **What to do** and you set the schedule. Nothing is saved until you press **Create**, and your message is not sent.
- **From the Routines screen.** Choose **New routine** on [Routines](https://stellarfirm.ai/app/routines).
- **From a proposal.** Ask an assistant, or let it suggest one, as described [below](#your-assistants-will-suggest-them).

The form asks for:

| Field | What to put |
| --- | --- |
| **Name** | Up to 40 characters. Shown in Routines and as the title of the routine's chat. |
| **What to do** | Write it as you would to the assistant. The schedule sets when it runs, so you do not need "every Monday" here. Do not ask it to save a routine. |
| **Who runs it** | The assistant that does every run. If you have not hired one yet, the form says so and links to hiring one. |
| **When** | One of four choices, below. |

**When** can be:

- **On days of the week**: every day, weekdays, or the days you pick, at one or more times.
- **Every few hours**: every 1, 2, 3, 4, 6, 8, or 12 hours, from a start time until an end time or all day, on the days you pick. The form says about how many runs that is a week.
- **Monthly**: one or more days of the month and a time. A month without that day, such as the 31st in April, is skipped.
- **Custom (cron)**: five fields, for a schedule the others cannot say. For example `0 9 * * 1-5` is weekdays at 9:00.

Under the schedule the form shows the time zone ("Times are in Europe/Athens.", with **Change**) and the next three times it will run, so you can check it before you press **Create**. If a schedule is closer than an hour, or never comes, the form says why and **Create** stays off.

When you press **Create** in the form from the message box, a line under the box says when the routine first runs and links to its chat.

## A loop

A loop repeats every few minutes until the assistant says the work is finished, or until it has made all the runs it was allowed. Each run starts with the same fixed words: which run this is, and that the assistant should do the next part of the work and say when it is done.

Use a loop for work that has an end but needs several tries or some waiting:

- Keep checking a build and fix what breaks until it passes.
- Work through a long list a little at a time.
- Follow a slow process, such as a reply you are waiting on, until it arrives.

A loop runs every 10 minutes at the soonest and at most once a day. It always has a limit on its runs: 10 by default, and never more than 48. When the assistant finishes, it ends the loop. You can stop one yourself at any time. An assistant proposes a loop in the chat; you do not make one in the form above.

## Which one to use

| You want | Use |
| --- | --- |
| Something at the same time every day, week, or hour | A routine |
| Work that should keep going until it is done | A loop |
| Something that never ends | A routine |
| Something with a clear finish | A loop |

## Your assistants will suggest them

When you ask for something to happen repeatedly or at a set time, such as "every day at 6 pm" or "remind me at 9 every Monday", the assistant proposes a routine with the schedule you asked for. When it sees other work that repeats, or that would need you to ask again and again, it proposes a routine or a loop once, briefly, after it has helped with what you asked. The proposal is a card in the chat. It shows:

- The name and what the assistant will do on each run.
- When it runs. For a loop: how often, and that it repeats until the assistant says it is done or after the number of runs shown.
- Which assistant runs it.

**Nothing is created until you press Create.** On a routine's card you can change the name and the instruction, who runs it, the schedule (any of the four choices above), and the time zone. A loop's card lets you change the name and the instruction. **Dismiss** throws the proposal away, and the assistant does not suggest another in the same chat unless you ask. You can also ask for one yourself:

```prompt title="Ask for a routine"
CEO, I want a summary of last week's pull requests every Monday at 9:00. Propose a routine for it.
```

```prompt title="Ask for a loop"
CEO, keep checking the build every 30 minutes and fix what breaks until it passes. Propose a loop, with at most 12 runs.
```

When the card has done its job it says when the routine first runs ("Created. It first runs Mon 27 Oct at 9:00 am.") and links to the routine's own chat.

## Money and sends still ask, every time

A routine or a loop never gets more freedom than a message you type yourself.

- Anything that sends or publishes waits for your **Approve** on every run.
- Anything that spends your money asks every time, with no switch to turn that off. A routine or a loop cannot spend your money on its own.
- A routine or a loop never turns on auto-approve for itself.

If a run stops for an Approve, the run says it is waiting for you. A loop does not start another run while the last one is still waiting, so runs never pile up. When you have answered, it carries on at its next time.

A routine keeps to its own times. When its next time comes while a run still waits for you, that time is either skipped or starts a run that leaves another step to answer, depending on how the run is going. If steps are piling up on the Approvals screen, answer them or pause the routine.

## Each run works in the background

Pressing **Create** on a routine is your go-ahead for its runs. Each run works in the background as a long job, step by step, so you can close the page and it keeps going; the answer shows in the routine's chat when it is done. The assistant you chose leads the job. A long job may use a lot of credits, and it stops on its own when your spend budget or your credits run out. Anything it sends, spends, or publishes still waits for your Approve, and a routine never starts a second run while the last one is still working: if a run is still working at the next time, that time is skipped.

A loop is different: its runs are short. If one of a loop's runs does turn into a long job, it starts straight away, because pressing **Create** on the loop was your go-ahead.

## See them and stop them

Open [Routines](https://stellarfirm.ai/app/routines). Each routine shows when it runs next, how its last run went, and who runs it ("Run by" and the assistant's name). A loop shows where it is, for example **Loop · run 3 of 10 · every 30 minutes**.

| You want to | Do this |
| --- | --- |
| Pause a routine | Choose **Pause**. **Resume** starts it again. |
| Change what it does, when, the time zone, or who runs it | Choose **Edit**. |
| End a loop | Choose **Stop**. A stopped loop does not start again; make a new one if you need it. |
| Try a routine or loop once | Choose **Run now**. A trial still asks for your Approve before anything is sent. |
| Remove one | Choose **Delete**. Its chat stays, so you can read what it did. |

If you let the assistant that runs a routine go, the routine does not run in its place. Its runs are skipped, and the row says the assistant is no longer on your team. Choose **Edit** and pick another assistant.

## Limits

| | Routine | Loop |
| --- | --- | --- |
| How often | At most once an hour | Every 10 minutes to every 24 hours |
| How many runs | Until you stop it | Up to 48, 10 by default |
| At the same time | One run at a time | One run at a time |
| Name | Up to 40 characters | Up to 40 characters |

You can have up to 25 routines and loops in all, paused ones included.

## Next

- [Approvals](/docs/ceo/approvals)
- [House rules](/docs/ceo/house-rules)
- [Delegate work](/docs/ceo/delegate-work)

---

Source: https://stellarfirm.ai/docs/ceo/routines-and-loops
