Learning Algorithms & Personalization Engine



1. Overview & Cognitive Foundations



Joy-Quest's personalization engine relies on three mathematical and algorithmic pillars: 1. Knowledge Graph DAG (Directed Acyclic Graph): Structures conceptual dependencies and prerequisites across any domain. 2. FSRS-v4 Spaced Repetition Engine: Calculates human memory stability ($S$), difficulty ($D$), and retrievability ($R$) to schedule active recall drills at the optimal forgetting threshold. 3. Diagnostic Misconception Radar: Identifies specific faulty mental models using diagnostic distractor analysis and dynamically routes remediation paths.

---

2. Knowledge Graph DAG Architecture



All knowledge units (Mental Models, Invariants, Algorithms, Protocols) are modeled as nodes in a directed acyclic graph $G = (V, E)$, where:
  • $V$: Set of concept nodes, each with domain, complexity rating $[1, 10]$, and mastery threshold $\tau \in [0.0, 1.0]$.
  • $E$: Directed edges $(u, v)$ denoting that concept $u$ is a strict prerequisite for concept $v$.


  • graph TD
        subgraph L1["First-Principles Invariants"]
            Entropy["Information Entropy"]
            StateSpace["Discrete State Space"]
        end

    subgraph L2["Mental Models"] Inversion["Inversion Thinking"] Consensus["Consensus & Quorum Model"] end

    subgraph L3["Core Algorithms"] BinarySearch["Binary Search & Bisect"] Paxos["Paxos / Raft Algorithm"] end

    subgraph L4["Applied Domain Mastery"] DistributedLog["Distributed Commit Log"] SearchIndex["Inverted Search Index"] end

    Entropy --> BinarySearch StateSpace --> Consensus Inversion --> Consensus Consensus --> Paxos BinarySearch --> SearchIndex Paxos --> DistributedLog


    2.1 Dynamic Knowledge Frontier Algorithm

    A learner's frontier is computed per enrolled curated course. Concept $c$ is demonstrated when any one trusted topic's score for $c$ has at least 2 items and at least 70% correct. Scores are per topic and are never summed.

    $$\text{Frontier}(u) = \bigcup_{k \in \text{Enrolled}(u)} \{ c \in \text{Concepts}(k) \setminus D \mid \forall p \in \text{Requires}(c), p \in D \cup \text{Assumes}(k) \cup \text{Unreachable} \}$$

    where $D$ is the set of demonstrated concepts and Unreachable holds prerequisites that are not active or that no live course teaches. The frontier is advisory: it locks no lesson or quiz. $\text{IsMastered}$ (FSRS retention) never gates it.

    Passing a curator quiz schedules a review card for the concept. A due card is reviewed by answering a question the server picks from the live topics (preferring the learner's enrolled ones) with a pick that is stable until the card is graded; POST /v1/reviews/answer grades it on the server (right is Good, wrong is Again) and returns the answer key only after grading, and review answers never touch the demonstrated score. Self-rating (POST /v1/reviews/rate) is limited to a due card with no live question: with one it returns 409 item_required, and a card that is not due is reported back unchanged with applied: false.

    ---

    3. FSRS-v4 Spaced Repetition Mathematical Model



    Joy-Quest uses an enhanced implementation of the Free Spaced Repetition Scheduler (FSRS-v4).

    3.1 Core State Variables

    For each concept $c$ and learner $u$, the system tracks:
  • Stability ($S$): The time (in days) required for retrievability to drop from 100% to 90%.
  • Difficulty ($D$): The inherent cognitive friction of the concept, bounded in $[1.0, 10.0]$.
  • Retrievability ($R$): The current probability of successful recall after elapsed interval $t$:
  • $$R(t, S) = \left( 1 + 19 \cdot \frac{t}{S} \right)^{-0.5}$$

    3.2 Rating Scale

    Learners respond with active recall ratings $g \in \{1, 2, 3, 4\}$:
  • 1 (Again): Complete failure to recall or fundamental misconception.
  • 2 (Hard): Recalled with significant cognitive strain or hesitation.
  • 3 (Good): Recalled cleanly with normal latency.
  • 4 (Easy): Instant recall with zero cognitive effort.


  • 3.3 State Update Equations



    #### Difficulty Adjustment: $$D' = D - w_6 \cdot (g - 3)$$ $$D_{\text{new}} = w_7 \cdot D_0(3) + (1 - w_7) \cdot D'$$ clamped to $[1.0, 10.0]$.

    #### Stability on First Review: $$S_0(g) = w_{g-1} \quad (g \in \{1, 2, 3, 4\})$$

    #### Stability on Successful Review ($g \ge 2$): $$S_{\text{new}} = S \cdot \left( 1 + e^{w_8} \cdot (11 - D) \cdot S^{-w_9} \cdot (e^{(1 - R) \cdot w_{10}} - 1) \right)$$

    #### Stability on Lapse ($g = 1$): $$S_{\text{new}} = w_{11} \cdot D^{-w_{12}} \cdot \left( (S + 1)^{w_{13}} - 1 \right) \cdot e^{(1 - R) \cdot w_{14}}$$

    #### Optimal Review Interval: For target retention rate $R_{\text{target}} = 0.90$: $$I = \frac{S}{19} \cdot \left( R_{\text{target}}^{-2} - 1 \right)$$

    ---

    4. Misconception Radar & Diagnostic Distractors



    Traditional quizzes treat multiple choice questions as binary (Right / Wrong). Joy-Quest treats every wrong option as an explicit diagnostic distractor:

    Question: "In a Raft cluster of 5 nodes, 2 nodes partition away. Can the remaining 3 nodes make progress?"
    A) Yes, because 3 nodes form a strict majority (Quorum = 3) [CORRECT: Mental Model = Quorum]
    B) No, because all nodes must acknowledge writes [MISCONCEPTION: Confuses 2PC with Quorum Consensus]
    C) No, because leader cannot talk to partitioned nodes [MISCONCEPTION: Assumes partition isolates leader]
    D) Yes, but only for read queries [MISCONCEPTION: Assumes stale reads bypass quorum]
    


    Diagnostic Routing:

    When a learner selects option B, the system tags the misconception: FALLACY_2PC_CONFUSED_WITH_QUORUM. Rather than repeating the full module, the engine dynamically injects a 2-minute targeted micro-drill contrasting Two-Phase Commit with Raft/Paxos quorums.