Scheduling
The Scheduler (internal/schedule) lets an agent, or a whole unit, own
recurring work without an external cron emitting webhooks into the engine
(a QA smoke-test pipeline every morning, an async standup at 9:30, a weekly
Confluence audit), all declared in the YAML org config.
Schedules hang off a role (a roles: entry’s schedules) or a unit (a
units: entry’s schedules), share one Schedule model
(org.Schedule), and change live when a config revision is applied.
How it works
Section titled “How it works”A single loop ticks on a short interval (default 10s). Each tick:
- Enumerates every
Scheduleacross the current organization (all roles and units, read fresh each tick, so an applied revision takes effect on the next tick). - Works out which schedules are due since the previous tick.
- Resolves the runner(s) for each due fire.
- Claims the fire in the fleet’s
firesslot (at-most-once) and publishes aTaskAssignedto each runner’s inbox topic (crewlet.agent.{seat-id}.inbox), stamped with the schedule’s conversation.
It reuses TaskAssigned, so a scheduled turn runs executor then reviewer like
any other and the full learning loop (episodes, diary, reflection) runs on
it. A schedule is a conversation of each seat that runs it: each fire’s turn
continues the session the schedule’s last fire left on that seat, and is told
how the earlier fires ended
(Each fire continues the last fire’s session).
The Schedule model
Section titled “The Schedule model”schedules: - name: morning-smoke # unique within the role/unit; part of the idempotency # key and of the schedule's conversation cron: "0 9 * * 1-5" # standard 5-field cron (see below) timezone: Europe/Amsterdam # IANA tz; falls back to the company's `timezone` task: "Run the smoke-test pipeline and triage failures" target: each # unit schedules only — each | lead enabled: true # set false to keep it in config without firing timeout_seconds: 1800 # hard wall-clock cap on the turn, its run included # (default 1800 s — twice a slow ritual's box, run # and review, so reaching it means stuck) catchup: true # fire one recent missed tick on restart (see Catchup)| Field | Default | Meaning |
|---|---|---|
name | — (required) | Identifier, unique within the role/unit. Renaming lets a same-minute fire re-run once and starts the schedule’s conversation afresh (Each fire continues the last fire’s session). At most 400 bytes as the conversation key spells it, escaped as a URL path segment (a space, slash and most punctuation take three bytes, a non-ASCII letter six or more). It also labels each fire (swe was assigned scheduled work morning-smoke), so every fire of one schedule reads and is recalled alike; the run id stays in the event’s detail. |
cron | — (required) | 5-field cron expression, evaluated in timezone. |
task | — (required) | The task prompt handed to the runner agent. |
timezone | the company’s timezone | IANA timezone the cron is evaluated in. |
target | each | Unit schedules only; ignored for role schedules. Who runs it (Delivery). Human seats never run schedules: each fans out to direct agent roles only, an enabled lead schedule under a (possibly inherited) human lead is a config error, and human seats cannot define role schedules. |
enabled | true | false keeps the schedule in config but never fires it. An enabled schedule nothing can run (each on a unit with no direct agent member, lead under a person, a schedule on a human seat, a member made a person’s seat included) is refused in the company document. A lead schedule on a unit nothing leads is admitted and skipped, and the scheduler logs schedule_no_runners whenever it is due. |
timeout_seconds | 1800 | Hard wall-clock cap on the scheduled turn, its executor’s run included. See Hard wall-clock timeout. |
catchup | true | Whether to fire a recent missed tick on (re)start. |
Config load (and so crewlet validate) checks each schedule’s shape: a
non-empty name and task, a name of at most 400 bytes once escaped, a cron
with exactly five fields, a timezone that loads and is not Local or
localtime, a non-negative timeout_seconds, a target of each or lead,
and names unique within the owning role or unit. A written document is also held
to the cron grammar, the parser the scheduler uses, so five fields with an
invalid value (61 * * * *, 0 9 * * MON-FRY) is refused at that schedule’s
cron, naming the field and value. The grammar is an
admission rule: a revision
being applied that carries one (a newer peer’s) still applies, its node logs
org_admission_warning, and that schedule is skipped on every tick with
schedule_parse_failed naming it while the rest of the company runs.
The name is bounded escaped because the conversation key is filed in the
runner seat’s executor log,
which refuses a key over 512 bytes rather than cut it (a cut key would merge two
conversations). The key spends at most 79 bytes before the name (schedule/,
scope, a unit key of at most 64 bytes or a 36-byte agent id, two separators).
Any name of at most 133 bytes is admitted; so is any name up to 400 bytes that
escapes nothing: ASCII letters and digits, -, ., _, ~, and the :, @,
&, =, +, $ a path segment keeps, which covers every Kubernetes object
name. A longer name that escapes is refused (forty-five Japanese characters are
135 bytes, 405 escaped).
Which clock a schedule fires on
Section titled “Which clock a schedule fires on”A schedule with no timezone fires on the company’s clock, the top-level
timezone of the
company document (UTC when absent), the clock every “today”, due band and
overdue mark in the tracker is cut on. So 0 9 * * 1-5 on a Berlin company
fires at 09:00 Berlin, on the day the board calls today. There is no
scheduler-wide default zone: it would be a second company clock that could
disagree with the board about which day a 09:00 was on.
A schedule’s own timezone is that one piece of work’s wall clock (the Tokyo
team’s 09:30 standup on a Berlin company); nothing else is cut on it. Local and
localtime are refused for both: each is the zone of whichever host reads it,
and the scheduler is a singleton
duty that moves between hosts, so the
standup would move too.
The company’s clock is read at every tick, so an apply that changes
timezone moves the next tick’s fires without re-arming the loop.
Cron syntax
Section titled “Cron syntax”Standard five fields, minute hour day-of-month month day-of-week, with *,
ranges (1-5), steps (*/15, 0-30/10), lists (9,17), and three-letter
month / day names (JAN, MON). Day-of-week accepts 0-7 (0 and 7 are
Sunday). Vixie semantics: when both day-of-month and day-of-week are
restricted, a day matches if either matches.
"30 9 * * 1-5" 09:30, Monday–Friday"0 9,17 * * *" 09:00 and 17:00 every day"*/15 * * * *" every 15 minutes"0 14 * * 5" 14:00 every Friday"0 2 1 * *" 02:00 on the 1st of each monthRole vs unit schedules
Section titled “Role vs unit schedules”units: - name: Backend id: backend # the unit's key; `name` above is display type: team lead: backend-lead # the lead seat's handle channel: backend # a channel NAME, not an id or `#backend` schedules: # target defaults to `each` → every direct member posts their own update - name: daily-standup cron: "30 9 * * 1-5" timezone: Europe/Amsterdam task: "Post your standup: shipped yesterday / on today / blockers." # opt-in lead-coordinated variant (gather + summarize) - name: weekly-report cron: "0 16 * * 5" timezone: Europe/Amsterdam target: lead task: "Collect the week's progress from your reports and post a summary to the team channel." roles: - name: Backend Lead - name: Backend Dev schedules: # role-scoped — runs as this role - name: morning-smoke cron: "0 9 * * 1-5" task: "Run the smoke-test pipeline and triage failures"A role schedule always runs as that role (its target is ignored). A
unit schedule resolves its runner(s) from target.
Runners are resolved from the org, never from the agents in the ticking
process: a fire goes to the runner seat’s inbox and is consumed by whichever
node owns that seat, rarely the node whose tick won the claim. The seat’s agent
id is org.Organization.AgentIDFor, the UUIDv5 over (company name, handle)
every node derives, so the TaskAssigned names the identity the turn runs
under.
Schedules are not inherited. Unlike lead and channel, a schedule on a
department does not cascade to child units (it would silently multiply a
standup across every squad). Declare it on each unit that should run it.
Delivery: who runs it
Section titled “Delivery: who runs it”target | Runner(s) | Use it for |
|---|---|---|
each (default) | every direct role of the unit | async standups, “everyone files their own status” |
lead | the unit’s effective lead (org.Organization.EffectiveLead) | gather-and-post standups, weekly reports, “review overnight Jira for the team” |
These are the only two unit targets. There is no “specific role” target: that
is what a role schedule is, so to run a recurring task as one person, put a
schedule on that role. lead is dynamic: it follows whoever leads the unit
(inherited leads included), so the schedule survives a leadership change
untouched. The session does not move with it: a session is the seat’s that kept
it, so a new lead’s first fire starts the conversation afresh on that seat
(Each fire continues the last fire’s session).
each fans out one independent task per member, each with its own dedup
identity and its own conversation on that member’s seat, so a slow or failing
member never blocks the others and none continues another’s session. It
resolves direct roles only, never descendant units.
A standup is just a scheduled task: the runner does any fan-in with the tools it
has (a2a_ask, Slack reads, the roster). There is no “standup” primitive; the
same shape covers retros, sprint kickoffs, demo-prep, on-call handoffs and
manager 1:1s (an each schedule where each report opens a
private A2A review with its manager).
Guarantees
Section titled “Guarantees”At-most-once
Section titled “At-most-once”Every fire is claimed in the coordination store’s fires
slot before publishing, a first-writer-wins key per dispatch identity, so a
restart, a slow tick, a re-evaluated minute, or the scheduler duty moving to
another node never fires the same run twice.
scope_type · scope_id · schedule_name · fire_label · target_handleThe claim is shared, not node-local, because the scheduler is a singleton duty that moves (lease lapse, drain, rolling upgrade): a peer reading its own database would find an empty ledger and its catchup pass would re-fire everything the previous holder claimed.
fire_label is the schedule’s local wall-clock stamp (YYYYmmddTHHMM in
its timezone), not the UTC instant, so dedup is DST-correct (see
DST & cron edge cases). The key escapes each of the five
components, so a delimiter inside a unit or schedule name cannot make two fires
claim one key. The first four name the minute and lead the key, runner last,
so every claim on one minute sits under one prefix: that is how catchup asks
whether anybody holds a minute (Missed-tick catchup).
scope_id is the scope’s identity, not the name you wrote: a seat’s agent id
for a role schedule, a unit’s key for a unit one. Neither moves when a team is
relabeled, so two teams sharing a display name cannot share a fire. Every
surface that shows a scope shows scope_name beside it (the handle, or the
unit’s key, resolved through the running company).
The claim fails closed: a coordination store that cannot be read yields no dispatch and the next tick retries. This is the opposite polarity to the completion ledger, deliberately: that one asks “has this work been done” (safe answer: re-run), this one “may I start” (safe answer: wait).
scheduled_runs (the node’s own table) is this node’s audit record of what
it dispatched, purged after a week; the fleet agrees only on “may I start” and
whether a minute was started, as the token counter’s shared budgets slot does.
The node derives every fire in it into the replicated usage history
(Observability), which the dashboard reads. Its outcome is
fired, fired_manually (a person ran it now),
skipped_catchup or skipped_paused; the history also reports a sent run its
seat did not run as skipped_superseded (see Fires that wait in a seat’s inbox
below). The turn result (done, failed, timed out) is in the turn telemetry
(agent_turn_completed, and turn.guard_breach when a guard fired) under the
same trace: every fire starts a trace of its own and the turn restores it.
A schedule whose fires keep failing the same way does not fail silently. Its
fires are one conversation, so a failure a retry cannot cure (a context that
does not fit, work past its box’s memory, a request the provider refuses) holds
the conversation on its second fire in a row and stands as a
conversation.held notice for the administrators until somebody writes on it or
the settings it failed on change
(A session its provider refuses is retired too).
The guarantee lives in the coordination store, not the node’s file: a node
whose scheduled_runs cannot be read still schedules correctly and loses only
the history of its own fires in the dashboard.
Missed-tick catchup
Section titled “Missed-tick catchup”Catchup runs only on the first tick after (re)start. If the engine was down
across a fire, the single most-recent missed fire runs if it falls inside
the catchup window: half the schedule’s period, clamped to
[catchup_min_seconds, catchup_max_seconds] (default 120s–7200s). Older misses
are never backfilled; a missed fire outside the window is recorded as
skipped_catchup. catchup: false opts a schedule out entirely.
The most recent fire is usually one the engine ran before going down, so it is
recorded as missed only when nobody holds its minute in the fires slot:
- A fire claimed for any runner, as
firedorskipped_paused, ran or was held back on purpose; the restart records nothing. - A minute an earlier restart recorded as
skipped_catchupis not recorded or logged again. - A fire older than the
firesslot’s retention (a week) is neither run nor recorded: the fleet no longer remembers whether it ran.
The skip names no runner, so it never takes the claim a runner’s fire for that
minute needs. The question is asked of the fleet, not the node’s own
scheduled_runs, because the node holding the duty after it moves has none of
its predecessor’s rows.
Fires that wait in a seat’s inbox
Section titled “Fires that wait in a seat’s inbox”A fire is sent to its runner’s inbox as soon as it is due. A seat that cannot work (parked on a provider’s usage limit, on its budget, or held by one of its executors) keeps its inbox held, so the fire waits, and a schedule that keeps firing queues one fire per tick behind the same hold.
Every fire of one schedule carries one inbox partition, the schedule’s
conversation (below), so the fires that waited reach the seat together and the
seat runs only the latest. Its brief says how many earlier fires it stands
for and when they were due, so the duty is done once, as of now. Each earlier
fire is recorded as scheduled_fire_superseded under its own trace, and the
schedule’s history shows it as skipped_superseded beside the run that took its
place. The seat’s node publishes that record in its own day of the replicated
usage history, joined to the fire by trace, so it reads as skipped whichever node
ran the scheduler and however many days the seat waited.
A person’s pause is different: a paused seat’s fires are not sent at all (below), so nothing waits for the resume.
Each fire continues the last fire’s session
Section titled “Each fire continues the last fire’s session”A schedule is a conversation of each seat that runs it. The scheduler stamps
every fire with the conversation key schedule/<scope>/<scope id>/<name> (scope
is role or unit, scope id is the seat’s agent id or the unit’s key, each part
escaped as a URL path segment) as both its inbox partition and its
conversation identity. A seat’s
executor sessions are kept per seat and conversation
(Conversation Sessions), so the schedule’s next fire
on a seat is that conversation’s next turn:
- its dispatch reads the session the schedule’s last fire left on the seat (the
conversation’s head: of the ended fires whose session is still kept, the one
that read the conversation last), and its first launch continues that session
in a box of its own, led by
## A new fire of this schedule begins here; - every brief of the fire carries
## How this schedule's earlier fires endedabove## Task(how each earlier fire ended, its reviewer’s last word, what landed, what blocked it), so a fire that starts fresh is still told; - once a fire that kept a session of its own ends, the earlier fires its brief told are gone from the log, as a conversation’s turns are (Read once, frozen, held).
So a health check reads what the last one found, in the session that found it.
What keeps the line, and what starts it afresh. The key is the schedule’s
identity and nothing else. An edit to its task, cron, timezone,
timeout_seconds, enabled or catchup keeps the conversation, and so does a
schedule deleted and redeclared under the same name on the same role or unit
while retention still holds its last session. A new key starts afresh, its next
fire continuing nothing:
- a schedule renamed;
- a schedule moved between a role and a unit;
- a role schedule of a company whose
namechanged, since a seat’s agent id is derived from it. The rename orphans what a seat keeps under that id, its diary and onboarding markers (The one thing to get right), but no other conversation’s session: sessions are kept under the seat’s handle, so its threads, issues, pull requests and unit schedules go on continuing theirs.
A session is the seat’s that kept it, so a seat that starts running a schedule (a
new lead of a lead schedule’s unit, a new member of an each one, a seat a
changed target reaches) starts the conversation on its own seat and continues
it from then on.
Kept for retention_days. A fire’s row lives
turn_engine.conversation_session.retention_days (30 by default) past its last
record unless the next fire took it up first, so a schedule whose fires are
further apart than retention_days never continues: every fire starts fresh.
A monthly schedule fires 28 to 31 days apart, which the default does not always
cover; set retention_days to 32 to keep its line, which keeps every seat’s
sessions that much longer, within each seat’s byte budget
(Configuration).
What it costs. A continued fire sends the schedule’s whole session context
before its brief, and every request of its run carries it again (mostly from the
prompt cache, all counted against the seat’s windows). Harness compaction bounds
it: Claude Code compacts at its model’s window less its own headroom, OpenCode
near its model’s window. So n Claude Code requests on a 1 000 000-token model
are charged up to about n × 967 000 input tokens before output, where a fresh
fire begins at its harness’s prompt and brief: an hourly check at that point
making ten requests is charged about 9.7 million input tokens a fire, some 232
million a day. The first launch is held to that context, as any continued launch
is, and waits for a window with room for it
(Budgets and Spend). There is
no per-schedule switch: the seat’s and company’s ceilings and that floor
bound the spend, and turn_engine.conversation_session.enabled: false starts
every fire fresh.
Fires that waited together run once, as above: the latest, which reads the schedule’s last session once for every fire it stands for.
Nobody can reply into it. Every fire carries the key and nothing a person writes does, so a fire is never the answer to the question the last fire parked on, and a fire’s run that parks on a question is answered by its turn (Answering a parked run), never in chat.
A fire parked on a question holds nothing up. A run parked on a person’s question frees its seat and no fire is its answer, so the next fires run beside it, each continuing the session the one before left. If the parked fire is later answered or stopped and ends after them, it does not take the line over: a conversation’s head is the turn that read it last (Read once, frozen, held), so the next fire continues the last of those fires’ session, is told how the parked one ended, and its end absorbs the parked fire’s session. The person’s answer is in that session alone, so the continuing fire does not read it; the ending tells what the parked fire did with it. If the seat’s session budget (which releases the oldest end first) releases the last of those fires’ session before the parked fire’s, the next fire continues the kept session that read last (the parked fire’s, answer included) and is told how the last of those fires ended (Code Sandbox). The schedule never waits for the answer: it fires whatever its last run is doing, as a failing or timed-out run never blocks its next tick (Hard wall-clock timeout).
Fires that wait for a seat’s mailbox
Section titled “Fires that wait for a seat’s mailbox”A fire is claimed only once its runner seat’s mailbox (inbox and priority lane)
is confirmed, because the claim is spent when written and a seat’s inbox drops
what is published while no mailbox covers it. If the broker refused to make the
mailbox, the fire is not claimed and the tick keeps its window open, as a
shedding tick does: the next tick evaluates the window again, leaves claimed
fires alone, and claims and sends the waiting fire once the mailbox is
confirmed. Fires of one schedule that waited this way reach the seat together
and run once, as above. The window is held at most catchup_max_seconds (two
hours by default); a fire still waiting past it is recorded skipped_catchup
under its runner, so it is never lost without a row saying so.
A paused seat’s fires are skipped
Section titled “A paused seat’s fires are skipped”A fire due while a person has its runner seat
paused is claimed and recorded
skipped_paused, and not sent. It is not queued, since a fire waiting in the
held inbox would run whenever somebody resumed the seat: a standup days late,
one per day of the pause. It is claimed under the fire’s own identity (runner
included), so a peer’s tick of the same minute, or this node’s after the resume,
does not send it; a resumed seat picks up at its next fire.
Each node reads the pauses from its own watched copy of the coordination record, so the answer follows the duty. A node that has not read the pauses yet (the seconds after a boot) dispatches the fire, the opposite polarity from the duty’s own unknown: a paused seat’s inbox holds a fire rather than running it, while a fire skipped on a failed read is a standup lost for a seat nobody paused.
Hard wall-clock timeout
Section titled “Hard wall-clock timeout”Each scheduled turn carries timeout_seconds (default 1800, half an hour; see
Half an hour, for a ritual below) on the fire’s own task_assigned payload.
The turn engine checks it between rounds: a turn past the cap starts no
further executor and reviewer round and ends failed, with a
turn.guard_breach event of kind scheduled_timeout and
error_kind: scheduled_timeout on its agent_turn_completed event, so a runaway
loop can’t monopolise the runner. A failing or timed-out run never blocks the
next tick.
Between rounds, never mid-phase. A running phase may already have fired side effects (a post, a comment, a status change), and abandoning it would leave one half-written with nothing recording it, the same reason a drain lets a running turn finish. A single round that outruns the cap is bounded by the phase timeouts beneath it. Round one always runs: a cap refusing before any work would report a turn timed out having done nothing, a misconfiguration rather than a slow turn.
The cap spans the whole turn, its executor’s run included. An agent seat’s
executor is its harness’s own run in a box, and the turn parks
while the run works, so a turn is several segments (the launch, then one per
collection; a reviewer’s send-back launches the run again). The cap is an instant,
measured from when the fire’s turn began and carried on the park: the round a
segment collects always runs, and none after it starts once the instant has
passed. The run itself can outlast the cap by hours, so the instant is written on
its row too (PendingRun.Deadline): the completion poll ends
a run still working past it as if it had finished, logging
sandbox_run_past_deadline, and the collection that follows
ends its job as a person’s stop does
(harness told to stop, session packed as its own end packs it), reads what it did
up to then and resumes its turn to judge it, rather than cutting it off
unrecorded.
Half an hour, for a ritual. The clock runs from the fire’s turn start, so
everything up to the end of the run is on it: the turn-start prefetch (each
auxiliary call held to thirty seconds), a seat’s first-turn
onboarding pass, the box’s start (a
container’s within the two minutes its runtime is given, a cold image pull
included), the seat’s setup,
then the run itself (for a standup, five to ten harness rounds, ten minutes at
the slow end) and the reviewer. A slow ritual that is not stuck takes about a
quarter of an hour; half an hour is twice that, so a reviewer’s send-back still
fits and a turn reaching the cap is stuck rather than slow. A longer cap is not
free: a seat at its run cap (sandbox.max_concurrent_runs, two by default)
takes no other work, so messages to a seat whose ritual is wedged wait until the
cap ends it. Give a schedule whose runs routinely
need longer (each one that does logs sandbox_run_past_deadline) a
timeout_seconds of its own.
A schedule that fires every few minutes. The cap is also what frees a seat
before its next fire, which half an hour does for a daily or weekly ritual but
not for a more frequent schedule. The scheduler fires on time whatever the seat
is doing; a fire due while the previous turn still holds the seat waits on the
inbox, and once that turn ends the fires that waited run as one turn, the latest,
the rest recorded skipped_superseded
(Fires that wait in a seat’s inbox). So such
a schedule runs late whenever a turn outlasts its period, and runs fewer turns
than it fires while that continues: fire it less often, or give it a
timeout_seconds comfortably below its period, which cuts a long turn before the
next fire is due (the reviewer still judges what its run did by then).
Running a schedule now
Section titled “Running a schedule now”A person can run one schedule now, off its cron: the dashboard’s Run now
on the schedule’s page, or the operator tool run_schedule
(Running a schedule now)
from their own assistant. The task goes to every seat it wakes as one more fire
of the schedule’s own conversation, so the run continues the session its last
fire left, is told how earlier fires ended, and is under the schedule’s
wall-clock cap. The brief says who asked and that it comes outside the schedule’s
own times. The next scheduled fire is unchanged.
- Its own claim. The run is claimed in the
firesslot like any fire (same scope, schedule and runner) but under afire_labelof its own derived from the request (manual-and a digest), never a local minute. So it never takes the claim the cron’s tick of the same minute needs, a tick never refuses it, and catchup’s question about a minute is never answered by it. The same request sent again (a retry after a lost answer, the dashboard’sIdempotency-Key) is the same claim and sends nothing twice. - Recorded as one. The ledger records it as
fired_manually, and the history shows it so; one that waited in the seat’s inbox while a later fire ran in its place readsskipped_superseded, as a tick’s fire does.scheduled_task_firedand the seat’stask_assignedcarry who asked, asrequested_by. - From any node. A run by hand is not the singleton duty’s and evaluates no
window. The node the person reached claims it on the fleet and publishes it to
each seat’s inbox, which the node holding the seat consumes, as for a tick. Its
row is in that node’s own
scheduled_runsand reaches the history through that node’s usage day. - Refused, in the engine’s words, with nothing claimed or sent: on a company
with
scheduling.enabled: falseor no model provider (the conditions the loop is armed under, When the loop runs); for a schedule switched off (enabled: false), since running it would overrule that decision without changing it, so switch it on first; for a schedule nothing can run; and where every seat it wakes is paused. A seat paused among others is not woken, and the answer names it while the rest run. - Decided on every seat it wakes. Waking a seat is a decision its lead makes, as pausing it is: the run is allowed to whoever may pause every seat the schedule wakes (each one’s lead, or an administrator), asked about each, so a team’s standup is its lead’s to run, and an agent never runs one.
Configuration
Section titled “Configuration”System-level knobs live under a top-level scheduling: block:
scheduling: enabled: true # master switch tick_seconds: 10 # scheduler poll interval jitter_seconds: 0 # max per-schedule deterministic spread (see below) catchup_min_seconds: 120 # lower clamp on the catchup window (at least 1) catchup_max_seconds: 7200 # upper clamp on the catchup window work_pickup: enabled: true # hand an idle agent seat its next ready item cooldown_seconds: 600 # least time between two pickups of one seat, 60..1800There is no zone here: a schedule naming none fires on the company’s clock (see Which clock a schedule fires on).
Nor is there a switch for continuing the last fire’s session: that is
turn_engine.conversation_session’s, for every conversation alike. enabled
keeps and continues sessions, and retention_days is how long a schedule’s last
session waits for its next fire
(Conversation Sessions;
Each fire continues the last fire’s session).
The scheduler auto-enables when enabled is not false and the org declares
at least one schedule (see When the loop runs): orgs with
no schedules never spin up the tick loop.
Thundering herd (jitter)
Section titled “Thundering herd (jitter)”When many schedules share a popular minute (0 9 * * *), they all become due at
once. Each node’s turn concurrency gate (node.max_concurrent) already queues
the burst, so this is smoothing, not correctness. Set scheduling.jitter_seconds
non-zero to give each schedule a deterministic offset in
[0, jitter_seconds] derived from its scope + name, fanning the 9am wave across
that window. The canonical fire minute still forms the idempotency key, so dedup
is unaffected. Default 0 fires exactly on the minute.
The work pickup
Section titled “The work pickup”A schedule fires on a clock. The work pickup is the engine’s cadence for work a seat already holds: when an agent seat is idle and holds ready assigned work, the node holding it hands it its next item (ADR-0112). Every other wake comes from a change, so a turn that did not start the work (seat busy, answered chat first, said it would come back) would be the last word about the item.
- Idle is decided once a minute by the node holding the seat: no turn dispatching; no executor run holding it or waiting on a person’s answer with its box still paused (within the role’s
pause_ttl_seconds; a run past its pause still takes its answer but no longer blocks the seat’s ready work); nothing in its inbox; not paused; not parked on a token budget or provider limit; no budget window or provider limit that would refuse its next launch; node neither shedding nor draining. This must hold on two passes in a row, so the last turn’s writes are on the node’s copy: a seat is handed its next item about two minutes after going idle. Urgent and due work do not wait for idle: if the next ready item is urgent or due (below), it is handed while a turn or executor run is in flight, mail waits, or before settle, on the inbox’s priority lane, so the next turn takes it ahead of earlier background wakes; every other condition still holds, a run waiting on a person’s answer included. Such a pickup goes on the lane only while nothing waits there, so at most one waits and a person’s message waits behind at most one such turn; a pass finding the lane holding a delivery hands nothing and asks again a minute later. The same pass ends a parked run nobody can continue: its Worklet item finished or removed while it waited (executor_failed, reasonitem_finished), or its saved state read by no live build (state_retired); its question is withdrawn and a reply goes back to the seat. - Ready is Worklet’s: assigned to the seat,
in_progressortodo, no open blocker, past its start date, not held on the seat’s own unanswered question on the item. Also ready:- Work in review, on the same terms, for the seat holding it when somebody else moved or filed it into review; the pickup names who asked.
- The seat’s own item in review, only while nobody reviews it (no question of its own open); a seat never reviews what it submitted. The pickup says so, so the seat acts on the review it was given or names a reviewer (ADR-0124).
- Before its date, an agent’s wait whose reason names a person (by
@handle, or the org chart’s name) the setter has not asked on the item. A wait on a person is an ask: the holder is handed the item before the date, naming the person, however the wait was written, and once more when the date comes (ADR-0122). - A dead wait: every open blocker is a pull request nothing is moving (below).
- Next is urgent work, then due work, then the rest
(ADR-0159,
ADR-0162),
each in this order: work already started; reviews held; own items in review nobody reviews; waits on a person nobody asked; dead waits; the lead’s priority list in its order; the rest by priority and due date, as
my_worklists them. So urgent beats non-urgent started work, and below urgent a seat finishes what it started first. An item in progress is due once the start it was set aside until has passed with nothing of the seat’s on it since (no turn of the seat on it ended, nothing written after the start). A check parked until a release’s health check thus comes before every non-urgent item once its date passes, however long the backlog, and is ordinary started work again once a turn of the seat on it ends. - Once per item version. A pickup is made once per seat, item, last change that would have woken the seat, status and, for started work, the seat’s own last progress other than a comment. That change is the newest notice the seat was told of the item that started a turn, so pickup and wake share one rule: another agent’s comment that asks nothing, or an added watcher, hands nothing again. The fleet’s completion ledger remembers it seven days whichever node holds the seat, and a fleet claim keeps two nodes from both sending it during a move. A seat that gives a typed answer taking the item out of its ready work (a question, what blocks it, a wait, another assignee) is not handed it again until a change that would wake it lands or the date it set comes. Started work the seat progresses (a field it changes, never a write of the value already there) is handed back when idle again, at most once per cooldown (the next ready item is handed meanwhile); a turn that changed nothing does not bring it back.
- Words hold an item for a day, not for good. An item still ready, left with a comment that it still waits, a content edit that leaves it ready, or nothing, comes back once a day: a day after it went quiet (the latest of the change that last woke the seat, the date it waited until and the seat’s own last write on it), the pickup is new work, handed once more, saying so. A recheck is never handed within a day of the end of the item’s last pickup. A day is the stand-up rhythm and is not configurable. An item answered in words before this rule comes back by it too (ADR-0122).
- A wait nothing moves comes back, once per head. A typed wait on a pull request (
waiting_onits URL) holds the item until the pull request merges or closes (ADR-0121), which never happens where nobody reviews or merges it. So the open-pull-request poll also reads whether anything moves each one: a reviewer or team asked for, a review on its current head by anybody but its author, a merge armed on GitHub, or anask_to_mergecall held for it. Where nothing does and the item has waited at least 15 minutes, the engine records a dead wait on the item at that head (Worklet). An item whose every open blocker is a dead wait is ready for its holder, unless a reviewer holds it in review (somebody else moved it there) or its holder’s own question on it is open; its holder’s own item in review with nobody reviewing is ready too. The pickup names the pull request, head and opener, and the next step: move the item to review naming itsreviewer(and ask for their review on the pull request), ask the reviewer on the item withask, or ask to merge withask_to_merge. It is handed once per head: its key is the heads nothing moves and nothing else, so other changes, a day’s wait or the seat’s edits hand it no second time, while a new unmoved head hands it once more. It is never rechecked daily. The completion ledger remembers a pickup seven days, so a head unmoved for a week comes back once more. A pull request the engine cannot read records nothing and wakes nobody (ADR-0128). - Past the first page. Ready work is read twenty items at a time; item twenty-one onwards is handed over once the first twenty were, and a seat whose whole ready set was handed over is not asked again until the set changes. Each status is read to its first 200 items.
- Declines are spaced, work is not. A fleet claim on the seat spaces a pickup by
cooldown_secondsonly when it passes over an item the seat was handed and left unchanged: a seat declining item after item is offered the next at most once per cooldown; one that finishes an item is handed the next at once. - Worked for whom the item is for. The turn is held to the apps of the writer of the item’s last assignment by somebody else, else of whoever filed it, and a credential to the apps it wrote under, as the turn its assignment woke (ADR-0109).
- An assignment is any change that moved the assignee, whatever else the write changed: handing an item over and setting it to
todoin one update is an assignment by whoever made it. Naming the current assignee is none. - A seat the organisation no longer holds is worked for as a stranger; a write an older build recorded carries no apps.
- An agent’s assignment or filing in a turn somebody woke is worked for that somebody; the history row keeps whom (
working_for). - Work the seat filed for itself is its own, unless filed in a turn for somebody; its own take of an item counts only when made for somebody, so a take-back on its own initiative still works for whoever assigned it before.
- An assignment is any change that moved the assignee, whatever else the write changed: handing an item over and setting it to
The wake is a work_pickup naming the item, its status and why it was chosen, stamped with the instant of the change its key names and filed under the item’s Worklet conversation (work:task:<id>, the key every wake about the item carries), so the turn continues the item’s session. It carries that change’s log position (trigger_position), so the turn reads the item no older, and its completion moves the seat’s
seen-through mark on the item, so queued state notices the turn read past start no turn
(ADR-0162).
A pickup’s turn is delivered only by a typed answer on its item; its brief names the five: change the item’s own fields (start, finish, move to review, edit content); ask whoever must answer or decide first, with comment_on_work_item and ask, which puts the question in their Inbox; record the item or pull request that blocks it (waiting_on); set it aside until a real date with why (wait_until and wait_reason); or reassign it. A comment alone is not an answer: the engine cannot tell when the condition its words name is met, so nothing would hand the item back. The engine reads the answer off the tracker’s record, the seat’s rows on the item since the turn began, never the model’s account, so a merge queue’s close of the item, made as the seat after its turn enqueued the change, answers too; a submission, a round or a reviewer’s done over words alone is sent back naming the five
(ADR-0122).
An item that leaves the seat while the turn runs (trashed, finished, or handed to another seat or nobody by somebody else) owes it nothing: the turn ends as it is, and its turn_completed record says how the item was left (pickup_answer: typed, removed, finished, reassigned, unanswered, or unread where the read failed and the turn fell back to the delivery every turn owes). A run lost or stopped before its turn ends is held to the same reading: its delivery on the executor log stands only where the item was answered typed or left the seat. A typed answer, ask included, counts as work moved in the advisor’s turn ledger, so work.pickup_still_waiting counts only pickups nothing typed answered. A dead wait handed back is counted under its own wake, work_item:dead_wait, beside work_item:pickup, so the spend screen shows how often items came back because nobody moved their pull requests; the advisor counts it among pickups.
An item set aside until a date is handed once when the date comes; its brief says the wait ended, names the date and quotes the wait’s reason in a fence labelled with whoever set it
(ADR-0040). A company on a vendor tracker, or with no model, gets no pickups.
crewlet.work.pickups{outcome} counts what each pickup decided for an idle seat (woken, nothing_ready, all_offered, cooldown, claimed, unknown); every pickup logs work_pickup_woken with the seat, item and why; one that could not be sent logs work_pickup_skipped at warn. A busy seat whose lane already holds a delivery is not counted: its pass logs work_pickup_skipped with reason lane_waiting at debug.
The poll logs dead_wait_recorded and dead_wait_ended per item it marks, and dead_wait_asks_unread at warn, once, while the held merge asks cannot be read (no wait is judged then).
When the loop runs
Section titled “When the loop runs”The engine arms the tick loop when four things hold, re-checked on every config apply:
scheduling.enabledis notfalse,- this node reaches the fleet’s coordination store and the stream: the at-most-once claim lives there, because a process-local claim looks correct until there are two nodes, and then every company gets two standups. The node’s own store is not a condition; without one the node only loses the history of its own fires,
- the company declares at least one role or unit schedule,
- the company configures at least one model provider under
providers.llm. With none its seats hold every delivery until a provider exists (A Company With No Model Provider), so a firing loop would stack every missed standup and run the backlog when the provider arrived. Each node logsschedules_waiting_for_a_modelinstead.
Adding the first schedule to a running company, or the first provider to a company with schedules, arms the loop on that apply; removing the last disarms it and releases its fleet duty. No restart. A freshly armed loop starts with the missed-tick catchup described above, so a late provider catches up at most the most recent missed fire. The tick knobs (tick_seconds, the catchup clamps) are read when the loop is armed, so changes land at the next arm, like the retention sweep’s horizons.
Whether this node has the loop armed shows as Engine.SchedulerRunning, and the scheduler_armed / scheduler_disarmed log lines say when it changed. An armed loop fires only on the node holding the scheduler fleet duty.
Observability
Section titled “Observability”- Dashboard. Company › Schedules (
#/company/schedules) lists every configured schedule (name, scope (a role’s seat by handle, or a unit by key, each labelled with its name), cron in words, task, whom it wakes, next fire, how it last went) and the company’s recent fires below it, both sortable. A schedule’s page (#/company/schedules/{scope_type}/{scope_id}/{name}) adds its whole definition, the fires after the next in the schedule’s own zone, and its own fires (theschedule_runsquery, fifty to a page), since the company-wide list is only the newest fifty. The list is backed byGET /schedules, which servesschedules(resolved list with next-run times, projected from the current organization per request) andrecent_runs(the company’s 50 most recent fires). Times are drawn on the clock the schedule fires on, zone named, with the reader’s own time beside where it differs; relative times tick on one shared clock. New schedule, and on a schedule’s page Edit, Pause or Resume and Delete, rewrite the seat or team declaring it through the configuration routes (Admin, or a lead inside their own team); Run now is running it now. A schedule’s Cap says when it is the engine’s default rather than its owntimeout_seconds, and the form’s empty time limit names that default, both read from the answer (timeout_default,default_timeout_seconds). - The history is the replicated usage domain’s
(ADR-0020), not the answering node’s ledger. Each data node derives the fires its scheduler recorded, and those its seats did not run, into its own usage day, and every data node applies every node’s days: the history is the whole fleet’s, outlives a node that leaves, and is kept 181 days. Each fire carries its tick (
scheduled_at,fire_label) and its outcome:fired,fired_manuallyfor a run a person asked for now (Running a schedule now),skipped_catchup,skipped_paused, orskipped_supersededfor a fire its seat did not run because a later fire ran in its place (see Fires that wait in a seat’s inbox). A node publishes its day every 15 seconds while it moves, so a fire reaches the history within about that long; the screen asks again every 30 seconds. - A seat’s sessions. Each fire’s turn is a row of its runner seat’s Sessions (the Memory section of the seat’s Activity tab, and
GET /agents/{id}/sessions) under the schedule’s conversation key, which the dashboard prints decoded (schedule/unit/eng/weekly report); an ended fire’s row says whether the next fire would continue it (continued_by: next_fire). The fire’s turn telemetry and episode carry the same key (conversation_key), so a schedule’s turns on a seat can be queried by it. A fire that starts fresh where a session could continue logsexecutor_session_not_continued; one whose dispatch could not read the schedule’s last session logsexecutor_conversation_unread. ScheduledTaskFiredevent (crewlet.events.scheduled_task_fired) is emitted per dispatch withscope_type,scope_id,scope_name,schedule_name,target_handle,scheduled_at, andrequested_byfor a run a person asked for now; it surfaces in the dashboard and event store.- The coordination store’s
firesslot is the at-most-once claim; the node’sscheduled_runstable records what it dispatched, kept a week, and its usage day derives from it. - Structured logs:
scheduler_armed,scheduler_disarmed,schedules_waiting_for_a_model,schedule_fired,schedule_catchup_skipped,schedule_no_runners,schedule_parse_failed,schedule_claim_failedandschedule_publish_failed(a claimed fire whose publish failed is not retried, because the broker may already hold it).
DST & cron edge cases
Section titled “DST & cron edge cases”- Fall-back (clocks repeat an hour): a cron time in the repeated hour maps to two UTC instants but one local fire-label, so the run fires once. (The claim identity uses the local wall-clock minute.)
- Spring-forward (clocks skip an hour): a cron time in the skipped hour has no instant that day, so it does not run and, nothing being “missed”, leaves no
skipped_catchuprow. For a critical daily run usetimezone: UTCor avoid the skipped hour, which differs by zone: 01:00–02:00 inEurope/London, 02:00–03:00 across most of the EU and the US, and other hours or dates in zones that shift differently. Check your zone; a30 1 * * *schedule onEurope/Londonis in the gap and silently skips one day a year. - Day-of-week ranges don’t wrap:
sat-sunis rejected as a descending range (Sunday is0). Write6-7,sat,sun, or0,6for weekends. - Catchup window is a bounded heuristic (half the period, clamped to
[catchup_min, catchup_max]); for irregular cadences (e.g.0 9 * * 1,5) it approximates the inter-fire interval.
Out of scope
Section titled “Out of scope”- Multi-platform delivery. The runner owns its outbound surfaces (Slack channel, Jira project), so delivery routing is the agent’s job.
- Script-only monitors. A cheap monitor runs as a low-budget role; the scheduler always dispatches to an agent turn.
Part of Crewlet. Generated from crewlet/crewlet main at 3f5565e.