Routines
Run a task on a schedule with every app closed, try one task several ways at once, or keep an agent on duty.
A routine is a task your machine runs by itself: the project, the agent and the prompt, plus when it repeats. It’s saved on the machine, so it runs with Sesh closed on every device. Each run is an ordinary session, with its chat, its Changes and its notifications.
Make a routine
- Open New Session (⌘N). File › New Routine…, New Routine… in ⌘K, and the + on the sidebar’s Routines section open it with a schedule already set.
- Pick the project and type the task, as for any session.
- Open Options and set Repeat: Every Hour, Every Day, Weekdays, Every Week or Custom…, then the Time.
- The sheet becomes New Routine. Click Create Routine.
The routine shows in the Routines section of the sidebar, with when it runs next.
Tip. Routines are Autonomous unless you turn it off in Options, so they don’t stop to ask. A run that isn’t autonomous waits in Needs You at its first approval, like any session. See Approvals and Autonomous mode.
Change a routine
Click the routine in the sidebar to open its page. Changes save as you make them.
| Setting | What it does |
|---|---|
| On | Off, it doesn’t run on its own. Run Now still works. |
| Task | What the agent is asked each run. |
| Repeat | When it runs, in the machine’s time zone. |
| Run | Once, or several sessions per run. See Run a task several ways at once. |
| If machine is asleep or offline | Run when it’s back runs it once, late. Skip that run waits for the next one. |
| Each run | Starts a new session, or Continues one session for an always-on agent. |
| Notify me | Only when it needs me, or Every run to hear when each one finishes. |
| Stop a run after | A time limit for each run, up to 4 hours. |
Run Now in the toolbar starts a run straight away. Right-click the routine in the sidebar for Run Now, Turn Off and Delete….
See what it did
The routine’s page lists its Runs, newest first: when each started, how it went, the start of the agent’s last reply, and how long it took. Click one to open its session.
Runs are named after the routine and the day, like “Morning issue triage · Thu, Oct 16”. They stay out of the session list, but one that needs you shows in Needs You.
Run a task several ways at once
Start the same task more than once, each on its own branch, and keep the best. Or start one session per item in a list.
- In New Session, open Options and set Run to 2 Times, 3 Times or 4 Times.
- Or choose Once per Item… and type the items under the task, one per line. Put
{item}in the task where each one goes. - Click Start 3 Sessions.
The sessions sit under one row in the sidebar, with how many have finished (“2/3”). Up to 8 run at once on a machine; the rest show Waiting its turn. You get one notification for the batch, like “2 of 3 tries finished”.
Keep the best try
- Click the batch’s row. Each try has a card with what its branch changed and the start of its last reply.
- Use Open and Changes to look closer.
- Click Keep on the one you want.
Sesh archives the other tries and opens the one you kept. Their branches and worktrees stay, so nothing is lost.
Message All… sends one message to every session in the batch. A routine with Run set starts a new batch every time it runs.
Keep an agent on duty
An always-on agent is a routine that keeps one conversation going. It wakes on its schedule, does its task, and goes back to sleep, remembering what it did before.
- Make a routine, then open its page.
- Set Each run to Continues one session.
Its row in the sidebar has a purple dot and says “Sleeping · next 9:00 PM”, or “Awake” while it works. Clicking it opens the conversation.
- Wake Now in the toolbar wakes it straight away.
- A message you send while it sleeps waits for the next wake-up. Press ⌘↩ to wake it with the message now.
- Each wake-up is a line across the chat saying why it woke. Wake-ups where it found nothing to do fold into one line, like “3 checks Tue–Wed, nothing to do”.
- Edit Routine… in the ⋯ menu opens the routine’s page.
Tip. Tell it in the task to say so in one line when there’s nothing to do. Those runs then fold away in the chat.
From the command line
On the machine, sesh routines lists its routines and when each runs next, and sesh run NAME runs one now. sesh new --times 3 "task" starts three tries.
Good to know
- A routine runs even when Sesh is closed on every device, as long as the machine is on.
- A scheduled run is skipped while the last one is still going. Run Now isn’t.
- Deleting a routine keeps its runs, as sessions.
- On iPhone and iPad you can open and change routines and batches, but make them on the Mac.
- Routines aren’t in the Linux app yet.