Timekeeper
Decides when an agent is due, so no agent needs a clock running inside its container. Each minute the Timekeeper looks at every cartridge cron and every schedule an agent created, and tells the Landlord who is due.
- Design rules
- §6.15
- Contracts offered
- 1
- Key flows
- 2
On the job
- Checks cartridge cron expressions each minute
- Stores schedules agents create, with time zones
- Validates cron and time zone input
- Calls fire with a request for each due item
Not my job
- Start a run. fire is the Landlord’s side.
- Import the control plane. Only the composition root calls it.
What Timekeeper does, step by step
Fire a cartridge cron
The cron lives in the cartridge. The clock lives in the factory.
Every minute createTimekeeper asks which agents’ cron expressions match the current time in their time zone.
For each due agent it calls fire with a cartridge request.
The Landlord wakes the agent, unless it is already running, in which case that tick is skipped.
Let an agent schedule itself
An agent creates a schedule through the schedules API with its run token.
The request is checked against the run token’s scope.
The route asks for its privilege.
cronIssue and isTimeZone validate the input. The schedule is saved to schedules.json.
The creation is ledgered.
When the schedule is due, checkDue yields it once and fire wakes the agent.
Contracts Timekeeper keeps 1 offered
- createTimekeeperused by Landlord