Skip to content

feat(courses): prerequisite knowledge graph + mastery gates (generalize sequential completion) #395

Description

@guillermoscript

Part of EPIC #388.

Part of the Learning Science epic. Structural bet inspired by Math Academy's shipped mechanics (mastery gates over an explicit prerequisite graph) — app-precedent evidence tier, see docs/LEARNING_SCIENCE_RESEARCH_2026.md.

Why

Mastery-based progression (don't advance until prerequisites are demonstrated) is the backbone of the strongest adaptive systems (Math Academy, MATHia). We already have a boolean require_sequential_completion — this generalizes it to mastery over an explicit prerequisite structure, and unlocks smarter review (practice on advanced topics implicitly credits prerequisites).

Plan (incremental — don't boil the ocean)

  1. Schema: lesson_prerequisites (lesson_id → prerequisite_lesson_id, tenant_id, RLS) — DAG per course, validated against cycles. Migration + teacher UI (simple "requires" multi-select in lesson editor).
  2. Mastery definition: reuse exam-readiness per-topic mastery (exam + practice + completion signals) with a per-course threshold (default 70) instead of inventing a new score.
  3. Gating: student lesson list shows locked lessons with the unmet prerequisite named ("Master X first — practice it now" → deep-link to practice). require_sequential_completion becomes the degenerate linear case.
  4. Implicit credit (v2, optional): correct attempts on a lesson's items grant partial review credit to its prerequisites (Math Academy FIRe-lite) — reduces flashcard/review load.
  5. MCP: expose prerequisites in lms_get_course_content / study-plan generation so the tutor sequences correctly.

Acceptance criteria

  • Teacher can define prerequisites; cycle creation rejected.
  • Student gating works with clear, actionable locked-state UI (never a dead end).
  • Sequential-completion courses migrate cleanly (no behavior change unless teacher opts in).
  • Tenant isolation + all three roles tested.

Out of scope: cross-course graphs; adaptive diagnostics ("knowledge frontier" placement test — separate future issue). Label: db-migration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions