Skip to content

feat: signals between bots start routines - #135

Merged
httpsphl merged 3 commits into
mainfrom
feat/routine-signals
Oct 3, 2026
Merged

httpsphl merged 3 commits into
mainfrom
feat/routine-signals

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Signals between bots that start routines (spec 20.13, roadmap item 18.7).

A routine can now wait for a signal instead of a time. When a bot of the crew says something happened (send_signal report-ready), every routine of the crew that waits for that signal runs right away, in its own bot's chat. Example: Writer saves the report and signals report-ready, and Reviewer's "Review the report" routine runs, without the owner relaying it and without Writer knowing who reviews.

Daemon

  • Schedule gains {kind: "signal", name}. The name is normalized like a slug ("Report Ready" becomes report-ready). A name with no letters or digits is refused with signal_invalid. These routines have no next_run_at, so the scheduler never fires them, and the time zone and the "computer was off" rule don't apply.
  • New MCP tool send_signal {name, note?}. It runs every enabled routine of an active bot in the sender's crew that waits for that signal, under the usual pause and overlap rules (20.3). Each routine runs from a signal at most once every 5 minutes; a signal that comes sooner is a skipped run with reason too_soon, so bots that signal each other in a loop cannot burn the owner's plan.
  • The routine's message says which signal and who sent it. The note comes after the owner's prompt, marked as written by a bot rather than the owner.
  • RoutineRun.signal keeps {name, fromBotId, note}; migration 0017 adds those columns to routine_runs.
  • crew_roster lists the signals the crew's routines wait for, and the bot rules say to send a signal once what it names is done. schedule_routine accepts the new kind, so a bot can ask the owner for a signal routine.

App

  • In the routine form, "When" has a new choice, When a bot signals, with a "Signal" field and a hint to tell the other bot, in its instructions, when to send it. Under More options only the overlap rule is left.
  • The list shows "When a bot signals “report-ready” · Waits for a signal". The last-run line names the bot that sent the signal; a signal that came too soon shows as skipped.
  • Texts in en, pt-BR and es; a signal routine is added to the pnpm dev preview.

Checks

  • cargo fmt, clippy -D warnings, cargo test --workspace and pnpm check (309 tests) pass.
  • New tests: the envelope; the daemon with FakeRuntime and a manual clock (tests/routine_signals.rs: normalized name, no clock runs, note and sender in the stdin line, the 5-minute spacing, crew scope, disabled routines, bad names and notes, and crew_roster / send_signal over MCP); the app (features/routines/signals.test.tsx).
  • Real Claude Code (done): two Haiku bots on a scratch dev daemon. Writer was asked to signal that a report was ready. It read crew_roster, found report-ready and sent it with a note. Reviewer's routine ran at once, used the note, and the run ended done. The daemon log had none of the message text.

Still to check by hand

  • In the real app: create a "When a bot signals" routine, have another bot send the signal, and see the run and "signal from " in the list.

Schedule gains kind signal, SkipReason too_soon, and RoutineRun keeps the
signal that made it run (name, sender, note); migration 0017 adds those
columns to routine_runs. The routine envelope says which signal and who
sent it, with the note apart, marked as a bot's. Spec 20.13.
A bot's send_signal runs every enabled routine of its crew that waits
for that signal, by the usual pause and overlap rules, at most once
every 5 minutes per routine. crew_roster lists the signals, the bot
rules say when to send one, and schedule_routine accepts the new kind.
"When a bot signals" in the routine form, with the signal's name and a
hint to tell the other bot when to send it; only the overlap rule stays
under More options. The list shows the signal, "Waits for a signal" and
who sent the last one.
@httpsphl
httpsphl merged commit 03ae424 into main Oct 3, 2026
4 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