Introduction
The human brain is essentially a leaky bucket. We spend hours absorbing complex topics, yet within days, the details evaporate. How can software fix a biological hardware problem? Most educational tools just throw flashcards at you randomly. But what if a system could mathematically predict the exact millisecond a concept is about to slip from your memory, and intercept it?
When engineering Learnify, a personalized study orchestrator, I wanted to move beyond static, dumb checklists. The core research focus of this project was implementing a theoretical model of memory retention natively within a web application's database.
Ebbinghaus and the Forgetting Curve
In 1885, psychologist Hermann Ebbinghaus discovered the 'Forgetting Curve'—an exponential equation that models how memory retention declines over time. If you review a piece of information right as you are about to forget it, the curve flattens. The interval before you forget it again becomes longer. The problem in software engineering is: how do you translate human cognitive decay into a deterministic database function?
We don't need to guess when a user needs to review a topic. We can calculate it using the SuperMemo-2 (SM-2) algorithm.
Architecture
Learnify utilizes a custom implementation of the SM-2 algorithm. Every topic a user learns is initialized with three hidden variables in the database: `repetition_count` (N), `interval` (I), and `easiness_factor` (EF, starting at 2.5). When a user reviews a topic, they grade how difficult it was to recall on a scale of 0 to 5.
This grade is plugged into a mathematical formula: `EF' = EF + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02))`. If the grade is high, the EF increases, and the interval until the next review expands exponentially (e.g., from 1 day, to 6 days, to 14 days). If the grade is low, the repetition count resets, and the interval collapses back to 1 day. This mathematical orchestration ensures the user only studies the exact topics their brain is actively trying to forget today, optimizing learning efficiency perfectly.
What I prioritized
The theoretical breakthroughs of programmatic spaced repetition:
- The Forgetting Curve. Applying Ebbinghaus's exponential decay models to structured learning paths.
- SuperMemo-2 Implementation. Calculating precise Easiness Factors (EF) and inter-repetition intervals.
- Deterministic Study Queues. Using CRON jobs and interval math to dynamically generate daily review sessions.
- Active Recall Mechanics. Structuring UI/UX to force neural retrieval rather than passive recognition.


