Skip to content

Routines (2/2): routines in the app - #24

Merged
httpsphl merged 4 commits into
mainfrom
feat/routines-app
Sep 29, 2026
Merged

httpsphl merged 4 commits into
mainfrom
feat/routines-app

Conversation

@httpsphl

Copy link
Copy Markdown
Owner

Routines, part 2 (R2): the screens. Stacked on #23; once it merges, this diff shrinks to its own commits.

What changes

  • Chat and Routines tabs on each bot's page ("Routines (2)" with the count). The list shows each routine's on/off switch, its schedule in plain words ("Weekdays at 09:00", "Every 2 hours", "Monday and Thursday at 14:30"), the next time in its zone ("tomorrow at 09:00", or "Off"), how the last run went (running, went fine, failed, or skipped and why), Run now, and a menu with edit and delete (confirmed). With none, a short explanation and "New routine".
  • The form: name, "What should do?" and When: every day, weekdays, chosen days (seven day buttons, named in the app's language) or every N minutes or hours. Under More options: the time zone (the system's by default, by city), what to do when the last run hasn't finished, what to do when the computer was off (with a note that Botloft doesn't wake it) and a cron expression. Day and time words come from Intl.
  • Refusals in the owner's language: the daemon now sends data.reason with schedule problems (too_often, timezone_unknown, cron_invalid…), and the form words them.
  • A routine's message shows "Routine · name" in the chat; the crew's page has a Routines tab with every bot's routines; a failed run marks the taskbar until the owner opens that bot (when each bot was last opened is kept in localStorage).
  • The store loads routines.list on every connection and follows routine.changed and routine.run.

Spec: 20.8 (reason codes), 20.9 (the app as built) and section 19.

Tested

  • cargo fmt, clippy -D warnings, cargo test (reason codes on the wire) and pnpm check: 108 tests, 9 new ones for the schedule in words, creating daily, chosen-day, interval and cron routines, a worded refusal, on/off, run now, edit and delete, the chat tag, the crew tab and the taskbar mark.
  • With the real Claude Code 2.1.284 (dev daemon and app): a routine "every 5 minutes" created in the app on a chief running Haiku ran at 09:10 and 09:15. Each message arrived with the routine's envelope, showed "Routine · Teste 5 min" in the chat and closed as done with the turn's result. Turned off, it did not run at 09:20. The debug log held only ids.

Routines are the first item after the MVP: a bot works on its own on a
weekly schedule, an interval or a cron expression, in the routine's own
time zone. Each run is a message the owner wrote, delivered into the
bot's one conversation through the courier like any other, so it is
durable and needs no second session. A run ends with the turn its
message started; overlapping runs are skipped (or one waits), paused bots
skip, and missed times run once when the computer is back.

The schedule is stored as structured JSON so the app can show and edit
it in plain words; cron stays behind "Advanced". Milestones R1 (daemon)
and R2 (app) start once M5 is closed.
A routine makes a bot work on its own: weekly at a time, every N minutes
or on a cron expression, in its own time zone. When its time comes, the
daemon posts the owner's request to the bot on the usual message path,
with an envelope that names the routine, the local time it is for and
that nobody is watching. The run ends with the turn that began with
that message: done, or failed on an error, a dead message, a process
that ended mid-turn or a daemon that stopped mid-turn.

A run still open skips the next time (or lets one wait, with queue), a
paused bot skips its times, and times missed while the daemon was away
run once for the latest (or not at all). Run now fires outside the
schedule. Archiving a bot archives its routines.

Zones use jiff with the IANA database it bundles on Windows. The daemon
evaluates cron itself, walking the days in the routine's zone: a time
the clock skips runs right after the jump, one it repeats runs once.

The app gets the protocol (routines.* and two notifications) and a fake;
its screens come in R2. The spec also records the M5 reboot check.
Each bot's page gets Chat and Routines tabs. The list shows each
routine's switch, its schedule in plain words ("Weekdays at 09:00",
"Every 2 hours"), the next time in its zone ("tomorrow at 09:00") and
how the last run went, with Run now, edit and delete. The form asks for
a name, what the bot should do and when: every day, weekdays, chosen
days or every N minutes or hours; the zone, overlap, missed times and a
cron expression sit under More options.

A routine's message shows "Routine · name" in the chat, the crew's page
lists every bot's routines, and a failed run marks the taskbar until the
owner opens that bot. The daemon now sends a reason code with schedule
problems, which the app words in the owner's language.
@httpsphl httpsphl mentioned this pull request Sep 29, 2026
@httpsphl
httpsphl enabled auto-merge September 29, 2026 12:25
@httpsphl
httpsphl merged commit 4a82f99 into main Sep 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant