🌐 US-Proxy
id="body-softwares" class="foundation-grid action-show controller-softwares engine-home">

Here is the complete write-up, ready to paste into the form (Markdown, ## headings as in the outline).


Inspiration

A JEE or NEET student loses marks in Application of Derivatives three weeks after being shaky on the Chain Rule, and the score report only says "Application of Derivatives: weak". Most study tools tell you what you got wrong. They rarely tell you why.

We wanted a study app that behaves like a good tutor's memory: it remembers every concept you learned, finds the real cause of a mistake, and brings weak concepts back at the right time, while you keep moving forward. Hence the line we built around: learn forward, fix backward.

What it does

Study Twin keeps one record per concept for each student: how well they understand it, the evidence for that, and which wrong beliefs they may hold. That model decides what they see next.

  • Root-cause diagnosis: a wrong answer is traced up to 3 prerequisite levels deep, and wrong beliefs are shown as hypotheses with evidence and a "challenge this" button.
  • Predictive revision: a "Due today" list from a forgetting estimate, with a plain "Why this?" reason built from the student's real attempts.
  • Select to explain: tap any word, formula or line in a lesson and get an explanation drawn only from approved lesson text, with the source shown.
  • Interactive notes books: five chapters (Electrostatics, Magnetism, Newton's Laws, Solid State, 3D Geometry) as page-turning 3D books with live sliders. A Lens explains a selected word using that chapter's own text, and a + button saves the selection straight to notes.
  • Behaviour-based tailoring: the app notes which pages you read and how long each quiz answer took, then tailors the chapter quiz to match. These are signals, never verdicts, and they never change a score.
  • Session short note: at the end of each session, one note with what you studied, saved explanations, open doubts, the questions you struggled with and what is due next. It exports as Markdown or PDF.
  • Hybrid search: keyword and meaning search across notes, concepts, lessons and your own past mistakes.

A hard rule: the AI never grades, never changes a score and never decides mastery. Code does that, with property tests. The AI only explains approved text. If it is slow or out of quota, the app shows the written lesson explanation instead.

Try it: https://study-twin-web-x7zm.onrender.com/ (open it on a phone; the free tier can take up to a minute to wake). Code: https://github.com/DevloperHS/Study-Twin

How we built it

We built it spec first with Kiro, across the whole project: the API, the database layer, the content pipeline and the phone-first web app. Each component has a spec in .kiro/specs/ with the same sections every time: objective, commands, structure, routes, design decisions, boundaries, a task list and final review notes. The tasks are written test first ("RED test first, one commit each"), so each commit adds one failing test and the code that makes it pass.

  • Shared contracts first. A single overview spec, 00-overview.md, fixed the folder layout, the tooling and the contracts between components before any code existed. That let components be built in parallel and still fit together. It also holds the rule that the pure core package imports nothing else, which keeps grading and mastery out of the AI's reach.
  • Boundaries written into the specs. The same rules appear in the specs and in .kiro/steering/: the AI never grades, a person approves all content, and answer keys never leave their own table.
  • Kiro agent in the history. Roughly 250 of the repository's 405 commits are marked as made by the Kiro agent. That includes work on a kiro/… branch, such as the Render deployment guide and the fix that starts the API correctly on Render.
  • Specs kept current. Every spec ends with review notes, and the specs were updated as behaviour changed, such as the Session Short Note and the behaviour signals.

Stack:

  • API: Python, FastAPI, Pydantic v2, SQLAlchemy 2, Alembic.
  • Database: Supabase Postgres with pgvector and full-text search, plus row-level security so every student record has two locks (scoping in code and in Postgres).
  • Learner model: pure Python, Bayesian Knowledge Tracing and a forgetting rule in a core package that does no I/O.
  • AI: Google Gemini behind one provider-independent LLMClient.
  • Content checks: sympy for equations and numbers, pint for units, and a second model that solves each question blind. A person must still approve every lesson and question.
  • Web: Next.js PWA with TypeScript, Tailwind, TanStack Query and KaTeX, deployed on Render with the API.

We held ourselves to real tests: 1,000+ backend tests on a real Postgres with real signed tokens and no mocks of our own code, and 200+ browser tests at phone and desktop sizes.

Challenges we ran into

  • Selecting text on a phone. The Lens needed several selects before it opened, and selecting near the page edge flipped the page. We rebuilt the touch handling and made a dragged line or formula savable as one note.
  • Search that worked in tests but failed live. On Supabase the pgvector operators live in a separate schema, which our app's database role could not use, so search answered HTTP 500 in production while saving notes still worked. It took two migrations, a search-path setting and a schema permission, to fix.
  • Keeping the AI honest. Making the AI explain well without ever deciding grades or mastery meant strict boundaries, a privacy guard (no names, emails or phone numbers go to the model) and a fallback when the free-tier quota runs out.
  • Behaviour tracking without surveillance. We store only signals such as pages opened and answer times. No typed text, selected text or device fingerprint is saved.
  • Free-tier limits. Gemini's free tier allows about 20 requests a day per model, so content generation had to resume cleanly where it stopped.

Accomplishments that we're proud of

  • A working, deployed app, not a demo: real sign-in, a real database and a live URL.
  • A learner model that is rebuildable from saved answers and fully tested without any AI in the loop.
  • Notes that write themselves from behaviour (a selected word, a Lens question, a quiz struggle), shown in a short note at the end of each session.
  • 1,000+ backend and 200+ browser tests, run against real infrastructure.

What we learned

  • Specs first saved us time: when each component's contract was written down before the code, components built in parallel fit together.
  • Put the boundary in code, not in a prompt. "The AI never grades" is only believable when grading lives in a package that cannot call the AI.
  • Bugs that only appear in production (permissions, cold starts, phone touch events) need tests on the real stack, not only mocks.
  • Be honest about what is finished. We would rather ship fewer approved lessons than unreviewed ones.

What's next for Study Twin

  • Generate and review the rest of the Maths chain, then Physics, Chemistry and Biology lessons.
  • Move off the Gemini free tier, which the LLMClient interface already allows, and complete the legal review of India's data-protection rules before any public launch.
  • Measure learning gain with real students. We make no such claim yet.

Built With

Share this project:

Updates

Submission history