← Back to work

KidMath.ai

AI-powered education platform with 30+ games and a mastery engine, plus the harder problem underneath it: knowing whether a child actually learned anything.

ReactTypeScriptSupabaseGeminiStripeMCPCOPPA

The Challenge

Build a comprehensive, child-safe education platform that uses AI to generate engaging math and language content, with subscription billing, COPPA compliance, and parent dashboards.

What I Built

A full-stack SaaS platform with 30+ interactive games spanning math, language arts, geography, and typing. The platform includes:

  • AI content generation via Gemini 2.5 Flash for dynamic, age-appropriate problems
  • Structured courses with progressive difficulty and mastery tracking
  • Parent dashboard with real-time progress visualization
  • Subscription billing via Stripe with free trial flow
  • COPPA compliance: no PII collected from children under 13
  • 34 Supabase Edge Functions powering the backend
  • A mature, heavily evolved schema, migrated in place rather than rebuilt

The Part That Turned Out To Be Hard

A mastery engine only works if its inputs are honest. Spaced repetition over individual arithmetic facts assumes that a correct answer means the learner knew the answer. The moment a child can hand the problem to an AI agent and submit whatever it returns, the engine stops measuring learning and starts measuring access to a chatbot. The parent progress report becomes fiction.

That’s not hypothetical any more. An agent with tool access can drive a practice session directly.

Ruling Out the Obvious Answers

The instinct is to detect it. I worked through the detection approaches systematically, and each one has a failure mode worth knowing before you build it.

Self-reporting via the tool schema. Ask the agent to flag when it assisted. It works, and it should not be shipped: instructions smuggled into a tool description to make a model act against the interests of the person in the conversation is a known attack class, and building it means aiming that technique at your own users. Recognizing that before shipping is the difference between a clever detector and a liability.

Behavioral statistics. A detector keyed on how response time tracks problem difficulty holds until an adversary knows its threshold. Told the floor was 0.35, a model returned 0.969, sailing a mile past anything a human produces. Goodhart’s law arrives on schedule for any published threshold. An accuracy-gradient version fared worse, falling to an adversary given no information at all.

Error-structure analysis. The most promising signal turned out to rest on data the platform never captured: it records whether an answer was right, never what the learner actually typed. The lesson generalizes well past this product. Decide what you will need to measure before you need to measure it, because provenance is the one thing you cannot reconstruct after the fact.

What Did Work

Writing down, in the tool description itself, exactly what breaks when the tool is misused.

Not a rule and not a plea. A plain statement that submitting an answer the learner did not produce corrupts a mastery model and misleads a parent about their child’s progress. Across a panel of models from ten vendors, naming the concrete harm moved refusal sharply, in the clearest case from zero out of fifteen trials to fifteen out of fifteen. Thirteen of the fourteen models moved. One recited the guardrail back and submitted anyway. A politely worded version of the same instruction left GPT-4.1 at zero out of fifteen, though it worked on the two other models it was tried against.

The lesson generalizes past this platform: if you build tools for agents, the tool description is a safety surface, and one naming concrete harm outperforms a bare or polite one.

Which sentence does the work is not obvious, and it is worth testing rather than assuming. Split the text and the mechanical explanation alone scores no better than no guardrail at all; the moral appeal alone gets partway; the two together reach fifteen out of fifteen. Worth knowing before anyone goes trimming the paragraph that is holding a tool safe.

Detection Has Victims

The conclusion I did not expect is the one I’d defend hardest.

Every cheating detector has a false positive rate, and the people it misfires on are not randomly distributed. A learner using assistive technology looks statistically like a learner being helped. My own detector flagged one of my children, whose crime was being consistently accurate.

So the design labels provenance rather than accusing anyone. Record how an answer arrived, keep it as a first-class column, and let a parent interpret it. An accusation you cannot support is worse than an uncertainty you can describe, and that principle is now baked into how the platform treats assisted work.

Technical Highlights

  • Agent gateway API for autonomous platform management
  • Cron-driven content refresh and analytics aggregation
  • Comprehensive error tracking via Sentry
  • Learner identities are auto-generated codenames with no free-text name field in the interface, so a real name is never asked for