Skip to content

feat: The Mastery Loop — self-graded understanding + library coverage (Pillar 3, Spec 1)#37

Merged
New1Direction merged 8 commits into
mainfrom
feat/mastery-loop
Jun 17, 2026
Merged

feat: The Mastery Loop — self-graded understanding + library coverage (Pillar 3, Spec 1)#37
New1Direction merged 8 commits into
mainfrom
feat/mastery-loop

Conversation

@New1Direction

Copy link
Copy Markdown
Owner

Summary

First slice of Pillar 3 — the Knowledge Game. Adds a learn → prove → see it grow loop, research-backed by the "AI-Augmented Textbook"/Learn Your Way paper (embedded assessment), adapted to RepoLens's zero-backend, BYO-key model: self-graded, no new AI calls, fully local.

Built spec-first → plan → subagent-driven execution. Spec: docs/superpowers/specs/2026-06-16-mastery-loop-design.md; plan: docs/superpowers/plans/2026-06-16-mastery-loop.md (both with rendered HTML).

What's in it

  • mastery.js (new, pure, fully unit-tested) — deriveCheckResult, aggregateMastery, levels, UNDERSTOOD_THRESHOLD = 2/3 (2-of-3 passes — the exact fraction, not a rounded 0.67).
  • store.js + store/idb.js — a new local IDB mastery store (DB v5→6, additive) with CRUD (getMastery / getAllMastery / setMastery), mirroring the decisions store. Round-trip tested with fake-indexeddb.
  • Earn (deep-dive panel) — the old static "Test Yourself" block is now an interactive flip-card check: reveal → Got it / Shaky / Missed → auto-advance. On completion it computes the result, shows the level earned + Glows & Grows (never a raw %), and persists. Partial completion or a zero-question deep dive write nothing.
  • See (library) — per-card level indicator (○ new / ◐ explored / ● understood, label on hover), an honest aggregate line, and a single-select level filter.

Reuse / invariants

  • Earned from data already produced (the deep-dive Feynman questions) — no new AI calls, no background.js / message-contract changes (grep-confirmed in the final review). Mastery is local IDB only; BYO-key untouched.
  • mastery.js is pure → all scoring/leveling/aggregation is unit-tested; persistence tested with fake-indexeddb; the store stays CRUD-only (no compute).

Test plan

  • npx vitest run875 passed (93 files; +9 mastery.test.js, +3 store-mastery.test.js, +1 library-filters case)
  • npx eslint . → 0 errors
  • npm run check:html → 24 files clean
  • node --check on the 7 touched JS files
  • Final whole-branch review: readyToMerge, verified the loop end-to-end, the 2/3 boundary, partial/zero-question no-write, listener lifecycle, reduced-motion, and the onboarding-demo guard (the demo repo has no Feynman block, so it can't create a mastery record)
  • Manual smoke (no DOM test env): run a deep dive → take the check → confirm level + Glows/Grows + "Saved"; close mid-way → nothing saved; library card shows the glyph + the aggregate + filter work

One choice to confirm

The aggregate line's denominator (Understood X of Y) is currently Y = repos you've checked (so X understood + N explored = Y), which is self-consistent and only appears once you've taken a check. If you'd prefer the coverage framing (Y = total library size, "12 of your 40 repos"), it's a one-line change — say the word.

Out of scope (per spec → future Pillar 3 work)

AI-graded MCQ, spaced-repetition resurfacing, the corkboard knowledge-graph (Spec 2), and mastery in the backup envelope.

@New1Direction New1Direction merged commit e070b25 into main Jun 17, 2026
1 check passed
@New1Direction New1Direction deleted the feat/mastery-loop branch June 17, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant