docs/architecture/srs.mdDescribe the functioning of the Spaced Repetition System (SRS) and its usage rules within the learning engine.
This document specifies:
The SRS is responsible for:
The SRS:
%%{init: {"class": {"hideEmptyMembersBox": true}} }%%
classDiagram
namespace Runtime {
class Exercise
class WordExercise
class SentenceExercise
}
namespace Progression {
class SRSState
class SRSConfig
class SentenceState
}
namespace Answer {
class ExerciseAnswer
class RealExerciseAnswer
class PreviewExerciseAnswer
}
%% Inheritance
Exercise <|-- WordExercise
Exercise <|-- SentenceExercise
ExerciseAnswer <|-- RealExerciseAnswer
ExerciseAnswer <|-- PreviewExerciseAnswer
%% Core relations
Exercise "1" --> "1" SRSState : owns
SentenceExercise "1..*" --> "1..*" SentenceState : updates
%% SRS usage
SRSState ..> ExerciseAnswer : apply / preview
SRSState ..> SRSConfig : uses
SRSState represents the memorisation state of an exercise.
Exercise.Responsibilities:
ExerciseAnswer),SRSState never directly consumes a Grade.
It interprets an ExerciseAnswer, which encapsulates:
Grade),SRSConfig groups the parameters of the SRS model.
Session.SRSState.SentenceState represents the exposure/usage state of a sentence. It is updated by SentenceExercise objects (typically one state per sentence in the group), independently of the SRS: it does not compute a review interval but serves contextual progression tracking.
Its role is to hold the information that allows SentenceExercise to choose which sentence to display — typically: the least shown / least successfully answered sentence in the group.
The SRS does not process raw grades directly, but modelled user responses.
ExerciseAnswer is a sealed type representing an interaction with an exercise:
RealExerciseAnswer corresponds to an actual user response and triggers a persisted update to SRSState.
PreviewExerciseAnswer represents a hypothetical response, allows simulation of interval evolution, and has no side effects.
This distinction guarantees that:
Grade represents the quality of a user response (e.g. failure, partial success, success). It is provided by the application layer, but its interpretation (effect on progression) is entirely managed by the exercise and the SRS.
Not all grades are valid for every exercise type.
After a response, the SRS computes an interval independent of context:
The Session may use the interval to:
The session:
Outside of a session:
The session can expose an interval preview:
SRSState,PreviewExerciseAnswer,SRSState objects are persisted after each valid user response.
SRSState objects remain valid.