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, and this page is available as Markdown at https://open-spaced-repetition.github.io/ts-fsrs/guide/middleware/built-in.md.

Built-in policies

The following policies are available from ts-fsrs/middlewares and the ts-fsrs root entry:

MiddlewareBehavior
schedulerDesiredRetentionMiddlewareApplies configured desiredRetention before interval calculation. Acceptable values: (0, 1).
schedulerLearningStepsMiddlewareApplies explicit learningSteps and relearningSteps when enableShortTerm is enabled; maintains learningStep. Independently of that flag, maps final intervals below graduatingInterval (default one day) to Learning/Relearning, including model intervals. When steps are configured, graduation and Hard, Good, or Easy on a Review card use at least graduatingInterval; allowModelOverride uses a longer model interval instead of the current step.
schedulerFuzzingMiddlewareSpreads intervals when enableFuzz is enabled, using cardId and the review count for reproducible results. createSchedulerFuzzingMiddleware() accepts custom ranges and RNG.
schedulerMaximumIntervalMiddlewareCaps the day interval at maximumInterval. Explicit learning steps can override this cap as the chain unwinds.
schedulerStatsMiddlewareMaintains reps and lapses; clearStatsOnForget controls whether forgetting clears them. A lapse is an Again rating on a Review card.
schedulerMonotonicIntervalMiddlewareOrders day intervals across ratings, subject to maximumInterval; intervals can coincide at the cap.
schedulerScheduledDaysMiddlewareStores the final interval as nonnegative scheduledDays on the card and saves its previous value in the revlog. With the default fractionalDays: false, intervals are floored to whole days, so sub-day steps become 0. With fractionalDays: true, fractional intervals such as 0.5 are preserved.
schedulerLeechMiddlewareSets scheduleStatus to suspended on each positive leechThreshold multiple of lapses. The default threshold 0 disables suspension. Your application must respect this status when selecting cards.
schedulerCostAdrMiddlewareAdapts retention to memory state and review cost using costAdrPolicy and goalCostWeight. When defining a custom scheduler, use it instead of schedulerDesiredRetentionMiddleware, not alongside it.

DefaultScheduler already includes the first seven policies. Its order is desired retention → fuzzing → stats → scheduled days → learning steps → maximum interval → monotonic interval. Leech is opt-in when creating your own definition. See Lifecycle for why the order matters and the Overview for how middleware runs.

Use Quick start for the ready-made scheduler or Architecture to choose only the policies your application needs.