> For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/llms-full.txt.

# Introduction

`ts-fsrs` is a TypeScript toolkit for building spaced repetition systems with FSRS. Its declarative API creates a reusable scheduler definition from a model, a chronology, and optional middleware.

## Building blocks

A **model** is the FSRS algorithm and its parameters. `FSRS7Model` is the current one; FSRS-3 through FSRS-6 stay available for review histories built on them.

A **chronology** decides how time is represented. `dateChrono` works with `Date`, `numericChrono` with numbers in days, and `temporalInstantChrono` with `Temporal.Instant`.

**Middleware** adds scheduling policy, such as `schedulerLearningStepsMiddleware`, `schedulerFuzzingMiddleware`, `schedulerMaximumIntervalMiddleware`, or `schedulerLeechMiddleware`. Add them with `.use(...)` before creating the scheduler.

`defineScheduler` combines these into a definition. Calling `.create()` validates the configuration and returns an independent scheduler, so one definition can back several of them.


For your Agent

Integrate ts-fsrs into a TypeScript application

Copy Prompt

Integrate ts-fsrs into my TypeScript application.

1. Read the documentation index https://open-spaced-repetition.github.io/ts-fsrs/llms.txt and quick start https://open-spaced-repetition.github.io/ts-fsrs/guide/quick-start.md. First check whether the project already uses ts-fsrs. For a v5 → v6 or FSRS-6 → FSRS-7 upgrade, read the migration guide https://open-spaced-repetition.github.io/ts-fsrs/guide/migration.md and follow its implementation and verification steps, keeping existing cards and logs without rescheduling their next review during migration. The installation and new-card example below apply only to a new integration.
2. Install the `ts-fsrs` package.
3. Create an FSRS-7 scheduler with `defineScheduler`, `FSRS7Model`, and `dateChrono`.
4. Create a new card and review it with `Rating.Good`.
5. Keep the implementation minimal and use the current ts-fsrs public API.

Head to [Quick start](https://open-spaced-repetition.github.io/ts-fsrs/guide/quick-start.md) to install the package and run a scheduler in the browser.
