psitta

Documentation Index

docs/architecture/srs.md

Purpose

Describe the functioning of the Spaced Repetition System (SRS) and its usage rules within the learning engine.

This document specifies:


Role of the SRS

The SRS is responsible for:

The SRS:


SRS Diagram

%%{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

SRSState represents the memorisation state of an exercise.

Responsibilities:

SRSState never directly consumes a Grade. It interprets an ExerciseAnswer, which encapsulates:


SRSConfig

SRSConfig groups the parameters of the SRS model.


SentenceState

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.


ExerciseAnswer

The SRS does not process raw grades directly, but modelled user responses.

ExerciseAnswer is a sealed type representing an interaction with an exercise:

This distinction guarantees that:


Grade

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.


Intra-Session vs Inter-Session

Theoretical Interval

After a response, the SRS computes an interval independent of context:

Intra-Session Usage

The Session may use the interval to:

The session:

Inter-Session Usage

Outside of a session:


Practical Usage

Interval Preview

The session can expose an interval preview:

Persistence: Fundamental Rule

SRSState objects are persisted after each valid user response.

Mobile Considerations


Invariants