> For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/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-TW/guide/middleware/lifecycle.md)；中介軟體如何執行見[概覽](https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/middleware/index.md)。

直接使用現成排程器見[快速開始](https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/quick-start.md)；依應用程式需要組合策略見[整體架構](https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/architecture.md)。
