TemprTempr
Docs
CLI

Scheduled tasks & /loop

Last updated

Have the agent run a prompt again later without you typing it: every few minutes in an open chat with /loop, or on a schedule with Tempr Code's scheduled tasks. Both run on your computer.

Availability

/loop is in the CLI from 0.9.25. Tempr Code has /loop and scheduled tasks from its first release, the preview. Scheduled tasks are in Tempr Code only.

/loopScheduled tasks
WhereThe CLI and Tempr CodeTempr Code
Runs inThe chat you started it inA new chat each time, in a new worktree by default
How oftenEvery 1 minute to 7 daysA schedule, at most once an hour
LastsUntil the chat closes, at most 7 daysUntil you pause or delete it
Good forWatching a build, a deploy or a pull requestA morning test run, a weekly dependency check

/loop

/loop runs a prompt again and again in the chat you're in, for as long as the chat stays open.

/loop 5m check whether the CI run for this branch has finished, and say how it went
/loop check the deploy                  every 10 minutes, the default
/loop                                   list this chat's loops
/loop stop 2                            stop loop 2
/loop stop all                          stop every loop in this chat
  • Intervals are a number and a unit: m for minutes, h for hours, d for days (90s works too). From 1 minute to 7 days; 10 minutes when you give none.
  • The first run is one interval after you start the loop.
  • A run waits for the chat to be free. If a turn is running when a loop is due, the loop runs after it. A chat that was busy for an hour runs a 5-minute loop once, not twelve times.
  • Loops end with the chat. They're kept in memory, never saved, so closing the chat or leaving the CLI session ends them.
  • Limits: a loop ends after 7 days, or after 500 runs or 5 USD of model cost, whichever comes first, and the chat says so. A chat can have up to 50 loops.

Every run sends the whole conversation to the model again, on your provider key, so a long chat with a short interval adds up. Pick the longest interval that does the job.

Asking the agent instead

You can also just ask: "check the deploy every 10 minutes" or "look at this PR again in an hour". The agent has three tools for this, schedule_create, schedule_list and schedule_delete, and makes the same loops /loop does, including one-off reminders that run once and are gone. Creating a loop asks for your approval, as a command does, unless the chat is in Autopilot (Auto in Tempr Code). A loop's own runs can't create more loops. Hooks see these tools as CronCreate, CronList and CronDelete, Claude Code's names for them.

Nobody is watching a run

A loop's run, and a scheduled task's, is a turn nobody is there to approve. So anything in it that would ask for approval is refused, and the model is told why: it carries on without it and says in its reply what it would need approved. What the chat's mode lets run without asking still runs. See Agent modes for what each mode asks about.

Write the prompt so it needs no approval: "read the CI status and tell me" works, "fix whatever is failing" in a mode that asks before edits will mostly be refused. A message you send yourself in the same chat runs as usual, and asks as usual.

Scheduled tasks in Tempr Code

A scheduled task is a prompt Tempr Code runs on a schedule, each run in a chat of its own. Open Settings > Scheduled tasks and choose New scheduled task:

FieldWhat it's for
NameShown in the list and in the run's chat title, such as "Morning test run (scheduled)".
What it should doThe prompt each run sends. Write it to stand on its own: the run starts a new chat with no history.
FolderThe project each run works in.
WhenEvery hour, every day at a time, weekdays at a time, every week on a day at a time, or a five-field cron (0 9 * * 1-5 is weekdays at 09:00). In this computer's time zone, at most once an hour. For something more often, use /loop.
ModeThe mode each run uses, which decides what it can do without asking.
Run in a new worktreeOn by default. Each run works on a branch of its own, tempr/scheduled-<name>-<date>-<time>, so it never touches your folder. The folder must be in a git repository for this; otherwise the run works in the folder itself.
ModelEmpty uses your default model.
Most a run may spendIn US dollars, 2.00 unless you change it. A run stops when it reaches this.

The list shows each task's schedule, its next run, and when it last ran and how many times, or why its last run didn't start. Each has Run now, Pause (or Resume), Edit and Delete.

When a task runs

  • Tempr Code must be open and the computer awake. A run missed while the app was closed or the computer asleep runs once when it's back, not once for every time it missed.
  • One Tempr Code runs the schedules. With several open, the first one started runs them.
  • Each run opens in the background. It doesn't take over the chat you're in. When it finishes, a run in a worktree that changed nothing closes itself; it stays in the sidebar's history. A run that changed something stays open for you to look at.
  • If the computer sleeps during a run, the run is stopped after five minutes. The next due time runs as usual.
  • Anything that needs approval is refused, as above. A message you send in the run's chat afterwards is yours: it runs as usual, outside the task's spending cap.

Scheduled tasks are stored in ~/.tempr-code/schedules.json on your computer. Nothing about them is sent to Tempr; a run's turns go through Tempr like any chat's.