Overview
Vocab Vault tracks user progress through two systems:- Classic Mode: Simple three-state tracking (known/learning/unseen)
- SRS Mode: Spaced Repetition System using the SuperMemo 2 (SM-2) algorithm
Classic Mode Progress
Term Status
Each term can be in one of three states:known: User has mastered this termlearning: User is currently studying this termunseen: User has not encountered this term yet (default)
/src/hooks/useProgress.ts:19
Progress Storage
Progress is stored as a simple object mapping term IDs to status:/src/hooks/useProgress.ts:21-23
Marking Terms
Terms are marked via themarkTerm function:
- Updates React state immediately
- Persists to local storage
- Checks for newly unlocked achievements
/src/hooks/useProgress.ts:140-147
Category Progress
Category progress is calculated dynamically from term statuses:knownCount: Number of mastered termstotal: Total terms in categorypercentage: Completion percentage
/src/hooks/useProgress.ts:264-270
Spaced Repetition System (SRS)
SM-2 Algorithm
Vocab Vault implements the SuperMemo 2 algorithm for optimal review scheduling. The algorithm adjusts review intervals based on recall quality. Core Concepts:- Ease Factor: Difficulty multiplier (starts at 2.5)
- Interval: Days until next review
- Repetitions: Consecutive successful reviews
- Quality: User’s recall rating (0-5)
/src/lib/sm2.ts:1-231
SRS Card Structure
Each reviewed term becomes an SRS card:/src/lib/sm2.ts:14-22
Initializing Cards
New cards are created when first reviewed:/src/lib/sm2.ts:50-60
Quality Ratings
Users rate their recall on a 0-5 scale:/src/lib/sm2.ts:40-45
Review Algorithm
TheprocessReview function implements the SM-2 algorithm:
- First review (quality ≥ 3): 1 day
- Second review (quality ≥ 3): 6 days
- Subsequent reviews: previous interval × ease factor
- Failed review (quality < 3): Reset to 1 day
/src/lib/sm2.ts:66-109
Study Queue
The study queue combines due cards and new cards:- Prioritize due cards (cards scheduled for today or earlier)
- Introduce new cards at a controlled rate (default 10/day)
- Interleave 3 due cards for every 1 new card
/src/lib/sm2.ts:150-175
Due Cards
Cards are considered “due” when theirnextReviewDate is today or earlier:
- Most overdue cards first
- Among cards due the same day, harder cards (lower ease factor) first
/src/lib/sm2.ts:114-132
Mastery Levels
Cards progress through four mastery levels:- New: Never reviewed successfully (0 repetitions)
- Learning: Interval 1-6 days
- Reviewing: Interval 7-20 days
- Mastered: Interval 21+ days
/src/lib/sm2.ts:213-218
Retention Statistics
The app calculates retention metrics across all cards:learned: Total cards reviewed at least oncelearning: Cards with interval < 21 daysmature: Cards with interval ≥ 21 daysdueToday: Cards scheduled for review todayaverageEase: Mean ease factor across all cards
/src/lib/sm2.ts:180-208
Streak Tracking
Streaks track consecutive days of studying.Streak Data Structure
/src/hooks/useProgress.ts:25-28
Streak Logic
Streaks are updated when the user studies:- Studying today when last study was yesterday: Increment streak
- Studying today when last study was 2+ days ago: Reset streak to 1
- Studying multiple times in one day: No change
/src/hooks/useProgress.ts:301-332
Date Handling
Streaks use local date keys to avoid timezone issues:Achievement System
Achievements are unlocked when user statistics meet specific conditions.UserStats Calculation
Current stats are calculated from progress data:/src/hooks/useProgress.ts:86-108
Achievement Checking
Achievements are checked after any progress change:- Calculate current stats from progress data
- Loop through all achievements
- Check each achievement’s condition function
- Track newly unlocked achievements
- Update storage and show notification
/src/hooks/useProgress.ts:111-137