AI Study Planner
A study planner that reshuffles itself when you miss a session — with an AI coach that can actually see your schedule.

The problem
Every study planner I’d used broke the moment real life happened. Miss one session and the whole plan is just wrong, sitting there. I wanted one that expected you to fall behind.
What I built
A Next.js app with two layers of rescheduling: a plain, tested function that instantly redistributes missed time, and an optional “redo it with AI” pass on top. The coach is a real tool-calling agent — it can read your exams and weak topics, but it structurally can’t touch your plan or see anyone else’s data.
What I learned
That you can’t trust model output for a database write, ever — even valid-looking JSON. And that a real production build finds bugs the dev server never will; this one caught a sign-in failure that only happened off Vercel.
Overview
A student enters their subjects, exams and real weekly hours; an AI layer builds a day-by-day schedule, and a deterministic engine keeps it realistic as things get completed or missed. An AI coach answers “why am I behind?” by calling read-only tools scoped to that student’s own data.
Features
AI-generated plans
Schema-validated structured output from the student’s subjects, topics and available hours, with a retry-once-then-typed-error contract.
Deterministic rescheduling
A pure, unit-tested function pools missed minutes and redistributes them across upcoming days — never silently dropping time or overloading a day.
A coach that can’t misbehave
Four read-only tools, each binding the user id through a closure. No write tools at all. It can’t read another user’s data because there’s no parameter for it.
Grounded analytics
Study time, completion rate, subject progress and consistency — each answering one question.
How it's put together
- 01Server Components for reads, Server Actions for owned CRUD, Route Handlers for anything that streams or generates.
- 02All logic in a service layer scoped by a server-derived user id — unit-tested with a two-user fixture so a dropped filter fails the test.
- 03AI output filtered against the user’s real record ids before any write; one provider module behind every agent.
- 04Vitest for units (rebalance edge cases, cross-tenant access, the agent retry contract) and a small Playwright critical-path suite, run in CI.
Challenges
A production-only auth bug
Sign-in threw “UntrustedHost” on every attempt off Vercel — invisible on the dev server, obvious the moment I ran a real build.
Keeping AI honest about writes
A hallucinated record id passes schema validation just fine. Every persist step re-checks the model’s response against the user’s actual data first.
Where it landed
A deployed, tested MVP covering the whole loop: onboarding, generation, adaptive rescheduling, analytics and the coach.
Screens

Want something like this?
Get in touch →