# Routine Create Tool

Sets up a routine: an instruction delivered to an agent session on a schedule. At each run the session wakes with the instruction as a `<system origin="Routine · <name>">` message and carries it out with its tools.

## When to Use

The agent uses this when the user wants something done regularly ("every weekday at 07:30, go through my email and tell me what needs a reply"). For one check later today, use `timer_set`. A main agent can also give a routine to a session it opened for a teammate, so that session wakes on the schedule.

## Parameters

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | yes | Short name shown in the routines list |
| `instruction` | string | yes | What the woken agent does on each run |
| `rule` | string | yes | iCalendar RRULE without the `RRULE:` prefix, e.g. `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` |
| `starts_at` | string | yes | First run and time of day: RFC 3339 with an offset, or a local time without one read in `timezone` |
| `timezone` | string or null | no | IANA timezone the schedule follows; null is the workspace timezone |
| `session_id` | string or null | no | Session to wake; null is the calling session. A caller that is not a session must pass one |

## Returns

| Field | Type | Description |
|-------|------|-------------|
| `routine` | object | The routine, with `next_runs` (UTC), `next_runs_local` (in its timezone) and `finished` |
| `next_action` | string | What to tell the user about the schedule |
| `warning` | string or null | Advice to shorten the instruction when the stored instruction is over 300 words; null otherwise. The routine is saved as written. |

## Notes

- A routine does not run when it is created. Its first run is the first occurrence at or after `starts_at`, or the next one after now when `starts_at` is past.
- The agent confirms the schedule in its reply, in words and with the timezone.
- For a brief, wrap-up or review, the instruction says what it covers, and the built-in Briefing skill carries how to write it.
- The rule is expanded in the timezone from the anchor, so a 07:30 routine stays at 07:30 across daylight saving.
- A bad rule, an unknown timezone, an unreadable `starts_at`, a rule that never fires, or an archived or unknown session is refused with a message saying what to fix.
