# `SuperPi.Durable.Schemas.Schedule`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/durable/schemas/schedule.ex#L1)

A scheduled or webhook-triggered run (`schedules` table).

- `kind`: `"cron"` (fires at `cron` read in `timezone`) or `"webhook"` (fires on
  `POST /v1/triggers/:token`).
- `mode`: where a run happens. `"fork"` branches the owning conversation at its latest entry,
  `"append"` adds the turn to the owning conversation, `"fresh"` starts a new conversation from
  the stored `agent` snapshot.
- `status`: `"active"`, `"paused"` (three consecutive failed runs, see `SuperPi.Schedule`) or
  `"cancelled"`.
- `next_fire_at`: the next scheduled minute of a cron schedule, moved forward by the tick.
- `last_fire_at`: the latest scheduled minute that a run claimed. The claim is a conditional
  update on this column, which makes a run idempotent.

Rows are keyed by `conversation_id`, not stored in a conversation document, so forking a
conversation does not copy its schedules.

# `t`

```elixir
@type t() :: %SuperPi.Durable.Schemas.Schedule{
  __meta__: term(),
  agent: term(),
  catch_up: term(),
  claimed_at: term(),
  consecutive_failures: term(),
  conversation_id: term(),
  cron: term(),
  harness: term(),
  id: term(),
  inserted_at: term(),
  kind: term(),
  last_conversation_id: term(),
  last_error: term(),
  last_fire_at: term(),
  last_task_id: term(),
  mode: term(),
  name: term(),
  next_fire_at: term(),
  principal: term(),
  prompt: term(),
  status: term(),
  timezone: term(),
  token_hash: term(),
  updated_at: term()
}
```

# `kinds`

# `modes`

# `statuses`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
