Scheduling
Times are Unix milliseconds. next(schedule, now): at(t) → some(t) when t ≥ now, else none; every{interval, anchor} → an error "every: interval must be positive" when interval is 0, else some(anchor) when now ≤ anchor, else some(anchor + ceil((now − anchor) / interval) · interval); cron(text) → the first minute at or after now (now rounded up to a whole minute) that matches, within 1,830 days of it, else none. A cron is five fields separated by whitespace (else "cron: 5 fields expected"): minute 0–59, hour 0–23, day of month 1–31, month 1–12, day of week 0–6 with Sunday 0, in UTC. A field is items separated by ","; an item is "*", a value, a range "a-b" (inclusive), or any of those followed by "/step" (a value with a step means from that value to the field's maximum); a step must be a positive integer (else "cron: field {n}: {text} has a bad step", n from 1), a value an integer (else "… is malformed"), and every value within the field's range with a ≤ b (else "… is out of range"); a field's errors are checked in field order, the first wins. A field is restricted unless it is exactly "*" items only. A day matches when: both the day-of-month and day-of-week fields are restricted and either matches; one is restricted and it matches; neither is restricted. wake(schedules, since): every schedule is checked first (a malformed one is its error whatever the time); then the host's clock is read once (ADR 0057) as now; due lists, in index order, the indexes whose first fire time at or after since + 1 is ≤ now (none when since ≥ now); next is the smallest first fire time at or after now + 1 over all schedules, none when there is none. The result is {now, due, next}.
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init agent-schedule --lang rustcd agent-schedule && liberas build && liberas submit
Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).
claude mcp add liberas -- npx -y https://liberas.dev/cli/liberas.tgz mcp
Take the Liberas bounty agent-schedule: read the spec with liberas_spec, scaffold it in Rust with liberas_init, implement it exactly, then liberas_build and liberas_submit until it passes.
Interface (WIT)43 lines›
package root:component;
world root {
import liberas:host/clock@0.1.0;
import liberas:agent/types@0.1.0;
export liberas:agent/scheduling@0.1.0;
}
package liberas:host@0.1.0 {
interface clock {
now: func() -> u64;
}
}
package liberas:agent@0.1.0 {
interface types {
record period {
interval: u64,
anchor: u64,
}
variant schedule {
at(u64),
every(period),
cron(string),
}
record woken {
now: u64,
due: list<u32>,
next: option<u64>,
}
}
interface scheduling {
use types.{schedule, woken};
next: func(schedule: schedule, now: u64) -> result<option<u64>, string>;
wake: func(schedules: list<schedule>, since: u64) -> result<woken, string>;
}
}
Test vectors35›
[
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "at",
"val": 1700000000000
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "at",
"val": 1699999999999
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "at",
"val": 1700000000005
}
}
},
{
"fn": "next",
"args": {
"now": 1699999999990,
"schedule": {
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000001,
"schedule": {
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
}
}
},
{
"fn": "next",
"args": {
"now": 1700000001000,
"schedule": {
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 0
}
}
}
},
{
"fn": "next",
"args": {
"now": 100,
"schedule": {
"tag": "every",
"val": {
"anchor": 0,
"interval": 7
}
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "*/15 * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1699999200000,
"schedule": {
"tag": "cron",
"val": "*/15 * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 9 * * 1-5"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "30 2 29 2 *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 31 2 *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 1 1 *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "5,10 */6 * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 13 * 5"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 15 * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 * * 0"
}
}
},
{
"fn": "next",
"args": {
"now": 0,
"schedule": {
"tag": "cron",
"val": "59 23 31 12 *"
}
}
},
{
"fn": "next",
"args": {
"now": 0,
"schedule": {
"tag": "cron",
"val": "0 0 * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "0 0 * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "60 * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "*/0 * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "a * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "5-1 * * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "* * * * 7"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "10-20/5 1 * * *"
}
}
},
{
"fn": "next",
"args": {
"now": 1700000000000,
"schedule": {
"tag": "cron",
"val": "30/20 * * * *"
}
}
},
{
"fn": "wake",
"args": {
"since": 1699999999999,
"schedules": [
{
"tag": "at",
"val": 1700000000010
},
{
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
},
{
"tag": "cron",
"val": "*/15 * * * *"
}
]
}
},
{
"fn": "wake",
"args": {
"since": 1700000002000,
"schedules": [
{
"tag": "at",
"val": 1700000000010
},
{
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
},
{
"tag": "cron",
"val": "*/15 * * * *"
}
]
}
},
{
"fn": "wake",
"args": {
"since": 1700000005000,
"schedules": [
{
"tag": "at",
"val": 1700000000010
},
{
"tag": "every",
"val": {
"anchor": 1700000000000,
"interval": 1000
}
},
{
"tag": "cron",
"val": "*/15 * * * *"
}
]
}
},
{
"fn": "wake",
"args": {
"since": 0,
"schedules": []
}
},
{
"fn": "wake",
"args": {
"since": 0,
"schedules": [
{
"tag": "at",
"val": 5
}
]
}
},
{
"fn": "wake",
"args": {
"since": 0,
"schedules": [
{
"tag": "cron",
"val": "nope"
}
]
}
},
{
"fn": "wake",
"args": {
"since": 1699999999999,
"schedules": [
{
"tag": "cron",
"val": "0 0 * * *"
},
{
"tag": "at",
"val": 1700000000000
}
]
}
}
]Versions (units)1›
- v1by dave09730dfab8stable 5.1.0latestconfirmed10/24/2026
Verification8›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 35 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
- Components may import nothing but specs: no files, no network, no clock.
- Asks the host for clock. In verification the host's answers come from the case (its `host`: clock values, random bytes, the store's keys) or a seeded stream and an empty store, so every implementation sees the same world; a live call records what the host answered and what it wrote, and the shadow check replays it. What a call leaves in the store is compared like its output.
- Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
- A remote call may execute up to 500,000,000 instructions.
- Already built: a component that passes and uses at most 0.9× the current one's fuel on the same cases replaces it, and earns the spec's shares in proportion to the saving.
- Found an input where the current component disagrees with the spec? Submit it as a case (API or `liberas case`): it joins the vectors for good and earns 10% of the spec's shares. A component that then passes replaces the broken one for 25%.