Tide · API

tide.advance

tide.advance executes one pass: due clock occurrences become runs, facts are matched to reflexes, runs fan out into tasks, and tasks execute. Tide reads no clock, so the host passes the current time as now. limit (default 100) bounds the work of one pass: the example sets it to 2 for six members and calls advance until a report shows no work done.

Reflex
{
  id: 'theatre.reminders',
  intent: 'Remind every member at 18:00.',
  on: {
    clock: { every: 'day', at: '18:00', tz: 'Europe/Vienna' },
  },
  select: {
    query: { table: 'members' },
    mode: 'each',
    unitKey: 'id',
  },
  effect: {
    name: 'mail.send',
    input: { to: { $ref: '$.row.id' } },
  },
}
Call
await tide.advance({ now, limit: 2 }) // now: 2026-10-23 18:00 in Vienna
advance, pass by pass
Report
{
  now: 1792771200000,
  materialized: 1,
  skippedOccurrences: 0,
  factsMatched: 0,
  runsCreated: 1,
  tasksCreated: 6,
  executed: 2,
  succeeded: 2,
  failed: 0,
  retrying: 0,
  reclaimed: 0,
  runsSettled: 0,
  parked: 0,
}
Tasks
{
  done: ['ada', 'alan'],
  pending: ['grace', 'linus', 'mia', 'ruth'],
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.