Tide · API

tide.ledger

tide.ledger reads the rows that record everything Tide did: a fact for each input received, a run for each time a reflex was triggered, a task for each unit of work. Its runs, tasks and facts methods each accept a filter. A settled run also writes a fact of kind run that carries its counts.

Reflex
{
  id: 'reminders.nightly',
  intent: 'Every night at 21:00, text each member about tomorrow’s show.',
  on: {
    clock: { every: 'day', at: '21:00', tz: 'Europe/Vienna' },
  },
  select: {
    query: { table: 'members' },
    mode: 'each',
    unitKey: 'id',
  },
  effect: { name: 'sms.send', input: { to: { $ref: '$.row.id' } } },
  policy: { retry: { max: 1, backoff: 'fixed', baseMs: 300000 } },
}
Scenario
Linus’s carrier was down on Friday night.
His text was attempted at 21:00 and at 21:05, and failed.
Results, selected columns
{
  runs({ reflexId: 'reminders.nightly' }): [
    {
      cause: 'occurrence:2026-10-23',
      state: 'settled',
      selected: 6,
      total: 6,
      done: 5,
      failed: 1,
    },
  ],
  tasks({ state: 'failed' }): [
    {
      unit: 'linus',
      attempt: 2,
      error: 'the SMS gateway timed out',
    },
  ],
  facts(): [
    {
      kind: 'run',
      reflex: 'reminders.nightly',
      occurrence: '2026-10-23',
      stats: { total: 6, done: 5, failed: 1 },
    },
  ],
}
Output matches the expected value

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