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

# 内置策略

以下导出同时位于 `ts-fsrs/middlewares` 和 `ts-fsrs` 根入口：

| 中间件                                    | 行为                                                                                                                                                                                                                                                                        |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `schedulerDesiredRetentionMiddleware`  | 在计算间隔前应用配置中的 `desiredRetention`，取值范围为 `(0, 1)`。                                                                                                                                                                                                                           |
| `schedulerLearningStepsMiddleware`     | 开启 `enableShortTerm` 时应用显式 `learningSteps` 和 `relearningSteps`，维护 `learningStep`。无论该开关是否开启，最终间隔小于 `graduatingInterval`（默认一天，包括模型间隔）时均映射为 `Learning`/`Relearning`。配置了步骤时，毕业以及 `Review` 卡片按 Hard、Good、Easy 都至少使用 `graduatingInterval`；`allowModelOverride` 会用更长的模型间隔代替当前步骤。 |
| `schedulerFuzzingMiddleware`           | 开启 `enableFuzz` 时分散间隔，使用 `cardId` 与复习次数得到可复现的结果。`createSchedulerFuzzingMiddleware()` 支持自定义范围和随机数生成器。                                                                                                                                                                      |
| `schedulerMaximumIntervalMiddleware`   | 将天级间隔限制在 `maximumInterval` 以内；调用链返回时，显式学习步骤可以覆盖这个上限。                                                                                                                                                                                                                      |
| `schedulerStatsMiddleware`             | 维护 `reps` 与 `lapses`，由 `clearStatsOnForget` 决定重置时是否清空。Review 状态的卡片评为 Again 才计为一次遗忘。                                                                                                                                                                                       |
| `schedulerMonotonicIntervalMiddleware` | 在 `maximumInterval` 限制内调整不同评分的天级间隔顺序；达到上限时，间隔可以相同。                                                                                                                                                                                                                        |
| `schedulerScheduledDaysMiddleware`     | 将最终间隔保存为卡片上非负的 `scheduledDays`，并把原值写入 revlog。默认 `fractionalDays: false` 时向下取整，不足一天的步骤记为 `0`；设为 `true` 时保留小数，例如 `0.5`。                                                                                                                                                     |
| `schedulerLeechMiddleware`             | 遗忘次数每达到正数 `leechThreshold` 的整数倍时，将 `scheduleStatus` 设为 `suspended`。默认阈值 `0` 关闭此行为；应用选卡时需要自行遵守该状态。                                                                                                                                                                         |
| `schedulerCostAdrMiddleware`           | 通过 `costAdrPolicy` 与 `goalCostWeight`，根据记忆状态和复习成本调整保留率。组合调度器时应替换 `schedulerDesiredRetentionMiddleware`，不要同时使用两者。                                                                                                                                                          |

`DefaultScheduler` 已包含前七项，顺序为目标保留率 → 模糊间隔 → 统计 → scheduled days → 学习步骤 → 最大间隔 → 单调间隔。Leech 需要在自行组合定义时按需添加。顺序为何重要见[生命周期](https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/guide/middleware/lifecycle.md)；中间件如何运行见[概览](https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/guide/middleware/index.md)。

直接使用现成调度器见[快速开始](https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/guide/quick-start.md)；按应用需要组合策略见[整体架构](https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/guide/architecture.md)。
