Concepts
Target-agnostic durable schedule core: cron cadence, occurrence identity, missed-tick and retry policy
Most people want Oyster to run their Apps or Shiitake to run their Agents. Almanac gives host authors a pure schedule core for cron cadences, occurrence identity and retries. The host owns storage, its timer and what a firing does.
Core concepts
Section titled “Core concepts”A schedule is a ScheduleCore record plus the host’s own target fields.
Transitions return a new record. Nothing starts a timer or writes storage.
nextOccurrence(cadence, after): the first occurrence strictly afterafterfor a cron expression in an IANA zone (effect/Cron). A bad expression or zone isinvalid; a cadence that never occurs again isexhausted.occurrenceKey(schedule)isid:nextDueAt. A retried firing of the same occurrence has the same key, so the host can admit that occurrence idempotently.- Missed ticks coalesce. After a firing, and on resume, the next occurrence is computed from now, so a schedule that was down or paused runs once, not a backlog.
afterAdmittedfinishes a one-shot or moves a recurring schedule on (pausing it with the reason if its cadence is exhausted).afterRefusedkeeps the same occurrence, records why and backs off (30 s doubling to 1 h by default).paused,resumedandcancelledare the state changes; paused and settled schedules are never due.
See the API reference for the complete root export.
Shared backoff
Section titled “Shared backoff”BackoffDelay fixes the pure (attempt, policy) => delayMs contract, reusing
RetryPolicy. Attempt one (and attempts below one) uses the initial delay,
bounded by the cap; later attempts double up to that cap. The caller supplies
its own policy, and the calculation owns no clock, storage or retry execution.
afterRefused uses this calculation after incrementing the refusal attempt.
Maintainer checks
Section titled “Maintainer checks”pnpm --dir packages/almanac run testpnpm --dir packages/almanac run lintpnpm --dir packages/almanac run typecheckpnpm --dir packages/almanac run buildpnpm --dir packages/almanac run docspnpm --dir packages/almanac run strangerpnpm --dir packages/almanac run stranger:browserBrowser proof commands use the repository’s heavy scheduler. Build cleans old output before emitting declarations. The archive ships the runtime, types, license, README, API reference and example. Maintainer tests stay in the source checkout. Licensed under MIT.