DEV Community

Cover image for How 8 Claude Code Agents Run My Son's AI Maths Tutor, and What Broke
Vivek Pathania
Vivek Pathania

Posted on AI-assisted

How 8 Claude Code Agents Run My Son's AI Maths Tutor, and What Broke

Ollie is an AI maths tutor I built for my 10-year-old son. She's a cartoon owl who talks him through a 30-minute session on a web page each day. Behind her, eight Claude Code agents write the next session overnight while he sleeps.

When I moved Ollie from my laptop to a real server, she started skipping her own sentences. On my laptop, every line of her voice played perfectly. On the server, lines got cut off halfway or never played at all.

That wasn't even the worst of it. In the early versions, some answer keys were simply wrong, so a child who had worked a question out correctly could be told he hadn't.

Claude Code built the first working version remarkably fast. Testing it with my son is what showed me everything it had missed. (Why I built it in the first place is a separate story.)

This is the builder's side of that story. First, how Ollie decides what to teach next, and where I overrule it. Then, how the repo and the eight agents are set up. Last, what broke once real use met all of it, and what I'd do differently. Everything quoted comes from the public repo, so you can open any file and check.


How Ollie decides what comes next

There is no lesson plan. Nothing in the repo says "three practice sessions, then a test." What happens tomorrow is worked out each night from what happened today, and from every session before it.

It all rests on two scores: completion, which counts every question he got to in the end, help included, and clean, which only counts right-first-try with no clue. The grader agent's file is blunt about which one wins:

a 10/10-completed session that was only 6/10 clean is a *hold*,
not an *advance*.
Enter fullscreen mode Exit fullscreen mode

The guided questions inside a lesson count toward neither. They get their own record instead, with one of four outcomes: landed, landed after a hint, needed the second explanation, or didn't land. That record turned out more useful than I expected. It builds up by concept across topics, so an idea he keeps needing a second explanation for shows up as a pattern, not as "cycle 2 failed again." The next time the teacher agent meets that idea, it has to come at it from a different representation: a picture instead of a rephrasing.

What moves him, and what holds him

The grader starts from these defaults:

  • Advance a difficulty level after a session at 80% clean or better, with no answers revealed.
  • Move to a check after two of those in a row, or one at 90% clean with no clues opened at all.
  • A slow or slipping trend holds the level, or drops one. Nothing advances on schedule just because a session happened.
  • As levels rise, the clues available step down, from two to one to none.

Fail a check and he goes back to practice, with a different angle on the same idea, never the same questions. Fail a second check in a row and the system stops guessing: it goes back to the lowest prerequisite he hasn't mastered. That one isn't left to the agent. save-grading.js refuses to save a second failed check unless a topic to go back to has been named.

Flow of how a topic moves: placement, lesson, three practice levels with fewer clues each time, check, mastered. Arrows show the 80% and 90% clean-score thresholds, hold or drop a level, and a backtrack after two failed checks
How a topic moves. The thresholds are the grader's defaults. The backtrack is enforced by a script.

The defaults are only defaults. The grader can override any of them, as long as it says why in one line. The example in its own file is a placement where he scored 3 out of 10, but the three were real attempts, all correct, and the other seven were keyboard mash. That's not a weak result. It's a smaller sample.

Pace, not just difficulty

Session length is a budget, not a target. I set a daily ceiling in minutes, and the grader spends against it without having to fill it. Growth is deliberately slow, two to four more questions at a time, and the stated goal is stamina: a child who can sit a longer stretch over months, the way an exam will one day ask him to.

The rule I like most resists the obvious conclusion:

Fast and correct is a mastery signal, not spare capacity.
Enter fullscreen mode Exit fullscreen mode

A child who finishes well inside the budget with a strong clean score is telling you the topic is nearly done. That argues for moving him on, not padding the session with more of the same.

The opposite case has a rule too. If blank answers cluster on the later, harder questions, that's treated as a confidence problem before a knowledge gap: more early wins, a shorter session, and feedback that points at a question he got right. Never more difficulty. And if it keeps happening, the grader tells me, because tiredness and motivation aren't things an agent can diagnose from a database.

The card he reads

The feedback card is gated on what comes next, not on how badly it went. If a lesson is coming, there's no card at all, because he'd be reading a diagnosis of a method he's about to be taught properly.

The format is mostly a list of things not to do. The right path goes in short literal lines: what he wrote, the one fix, the right answer. About forty words, hard cap. No second paragraph, because a child won't read one. It ends with a rule he can carry, and when the same mistake comes back, the card must reuse the same wording for that rule. The repetition is the point.

One line in the style guide binds harder than the rest:

never shame a wrong answer, a skip or a reveal
Enter fullscreen mode Exit fullscreen mode

The card only exists because something went wrong. That's the worst possible moment to make him feel bad about it.


Where I overrule it, and the one thing I can't

Everything above happens whether I look or not. The parent dashboard is where I check whether it's working, and where I take over.

Its headline chart is the clean score, labelled as exactly that: questions he got right first try, without a clue. Completion is there too, as the softer number. If I'd led with completion, the graph would be a flat line near the top and tell me nothing. Below it, a "keep an eye on" box holds whatever the grader thinks a parent should know and a child shouldn't read.

The running order is mine. I can reorder, pause or skip topics, and putting one ahead of something it depends on gets a warning, not a block, because I might know something the dependency graph doesn't.

One thing is blocked, and I think it's the most important rule in the whole API. If a session is finished but not yet graded, the queue freezes. Nothing can be moved or paused, and nothing can go ahead of it. The server says so in words meant for a person:

"2D shapes and triangles" is waiting to be graded, so it cannot be moved
and nothing can go ahead of it. Run /grade first.
Enter fullscreen mode Exit fullscreen mode

His work is evidence. Reshuffling the plan before reading what he actually did means choosing his next topic from an out-of-date picture.

So the division of labour is this. The agents decide how to teach and when he's ready, from a record he creates himself. I decide what gets taught and in what order. And neither of us gets to skip looking at what he did.


How the repo is set up

Claude Code forgets everything between sessions, so the repo has to remember for it. I used Claude chat to design the page and do the research, and Claude Code to build everything: about three weeks around a full-time job, two of them to the version he first used.

One small manual every agent gets, and specialist notes only the right agent reads.
One small manual every agent gets, and specialist notes only the right agent reads.

CLAUDE.md: say what's at stake first

The first lines of CLAUDE.md don't describe the code. They describe the job:

You are running a real child's daily maths programme: grading what they did,
deciding what their topic needs next, and building that next session. The
child never sees Claude directly — only a plain web page — so all of your
teaching reaches them through the feedback and sessions you produce.
Enter fullscreen mode Exit fullscreen mode

That last sentence changed the output more than any rule below it. Once Claude knows the child only ever sees what it writes, it stops treating the words on the page as an afterthought.

CLAUDE.md is also loaded into every agent automatically, so everything in it costs every agent on every run. Only what several agents need stays there: the database shape, the scoring rules and the guardrails. The rest lives in docs/, with a table telling each agent which file to read.


Eight agents, and the scripts that overrule them

What one /grade does. Agents write, scripts check, and it only stops for me when something fails.
What one /grade does. Agents write, scripts check, and it only stops for me when something fails.

Every night, after my son is asleep, I type /grade. Agents do the judging and the writing. Scripts sit between them as gates. The run only stops for me if a check fails, or if he has failed a topic check twice and needs to go back a step. What I see at the end is three small tables: his score, what he got wrong, and what's being built for tomorrow.

Three choices did most of the work.

One job per agent. The grader decides what happens next, and a separate feedback agent writes the card my son reads. The grader's file says why:

You do not write the child-facing feedback card. That is the separate
feedback agent's job, run after you, from the diagnosis you produce here —
keeping it separate means that agent can focus entirely on making the card
read well, instead of copywriting being squeezed in alongside grading.
Enter fullscreen mode Exit fullscreen mode

Read-only is one line of frontmatter. The verifier and the curriculum reviewer can report a problem but never fix it. That takes no clever prompting. An agent can only use the tools its file lists, so theirs just leave out Write:

---
name: verifier
tools: Read, Bash
model: sonnet
---
Enter fullscreen mode Exit fullscreen mode

Scripts make the calls that change what he learns. verify-session.js works out every arithmetic answer itself, without eval, because the input was written by a model. save-grading.js writes both scores from the raw attempt record, so the grader can't. And answer.js, the one file that decides whether an answer counts, is loaded by both the browser and the tests, so there's no second copy that could drift.

The expensive model runs once. Only the curriculum agent uses Opus, because it runs once a school year and everything else depends on its topic map. The nightly agents all run on Sonnet.


What my son found

Claude Code built every one of these, and every one got past my own testing. Each cost some of his attention, which is the one thing a tutor can't afford to waste.

Ollie went quiet on the server

The audio clips were streamed, so each one started playing before it had finished downloading. On a slower connection, playback ran out before the file arrived. On my laptop the files were local, so it never happened.

Now a line holds its speech bubble until the clip has fully downloaded, waits four seconds at most, and keeps clips cached. The whole voice bank, about 3.5 MB, downloads in the background once the first screen is up. Safari on the iPad needed its own fix: it only lets audio start from a tap, so the first tap starts one shared player that every later line reuses.

The iPad couldn't type "equilateral"

Every question showed a number keypad, including the ones whose answer is a word. On an iPad, "equilateral" was literally impossible to type. The page already knew what kind of answer each question expected, so the keyboard now follows it.

The hint button hid under the keyboard

The layout sized itself to the screen height. But iOS lays the keyboard over the page instead of shrinking it, so the clue button sat underneath, exactly when he needed it. The page now measures the space that's actually visible, and the clue button moved to the top.

He was marked wrong for being right

It happened two ways. First, every question with no letters in it got "= ?" added to the end, even when it already had a blank. So "1/3 = ?/6" became "1/3 = ?/6 = ?". He saw two things to answer, typed 2/6 and then 2, and was marked wrong.

Second, the early versions had no verifier agent, and some answer keys were simply wrong. Now verify-session.js checks every arithmetic answer, and the verifier agent re-solves everything from scratch before he sees it.

Three bugs that only existed on an iPad. All three passed my testing on a laptop.
Three bugs that only existed on an iPad. All three passed my testing on a laptop.

Lessons were lectures

The early lessons were a full walkthrough, one question, then practice. By step six he had forgotten step one. The teacher agent's file now opens by saying so:

You teach in cycles: a bit of teaching, then the child works on that bit,
then the next bit. That is what a human tutor does, and it is the whole
shape of your output.
Enter fullscreen mode Exit fullscreen mode

One lesson was wrong in a quieter way. The equivalent-fractions lesson started with a worked example and never said what "equivalent" means. He was left to guess the idea from watching numbers move. The teacher agent must now define the idea in plain words first, explain why the rule works, and report whether it did both, so a missing definition shows up without me reading the session file.

Text and sound weren't enough

This was the biggest miss. The sessions were words and a voice, and he was losing interest, most of all in geometry.

One triangle-naming session went out with no pictures at all. The author agent had reasoned, correctly, that a drawn triangle would let him answer by eye, and decided the fix was to ship it without one. The real fix was timing: the picture now arrives after he has committed to an answer.

Another session had fraction bars under "1/2 = 2/4" that didn't show equal shaded amounts. The picture contradicted the lesson it sat under. verify-session.js now checks diagrams against their words and blocks a save exactly as it would a wrong answer. It caught one on its first real run.

The illustrator agent draws all of this. The odd part of building it is that the agent has no eyes, and its file has to say so:

You cannot see the picture you make, so the checker is your eyes —
use it after every change.
Enter fullscreen mode Exit fullscreen mode

Once the geometry sessions had real triangles in them, he loved them.


What nobody would have noticed

The second list is worse, because none of it showed on screen. My son couldn't have found any of these. I found them by going back through what Claude Code had built.

Every part of the system knew about the goal. One threw it away, and a fallback hid the loss.
Every part of the system knew about the goal. One threw it away, and a fallback hid the loss.

  • A field deleted on every save. Each session has a goal. save-session.js built what it saved from an allowlist of fields, and the goal was never on it. Four parts of the system agreed the field existed and one quietly threw it away. A fallback on the page always showed something plausible, so nobody noticed.
  • My own testing became his history. When I clicked through sessions in my browser to check them, my answers were graded as his. They went into his topic progress and the profile of how he learns.
  • An open database about a named child. Every route was unauthenticated, on a URL about to go public. Reading his records was the obvious risk. The worse one was that the endpoint saving his attempts feeds the grader, so a stranger could have changed what he gets taught. There are now two levels of key.
  • The demo could have shown his real data. Demo mode fell back to a default database name, which was his. It now refuses to start unless a separate demo database is set explicitly. Separately, a preview server I started served his real data because it was reading settings from the wrong folder.
  • 59 server calls per demo visitor. 58 of them were Ollie's voice clips, each going through a serverless function. On the free quota that was about 2,100 visitors a month, and running out would have taken the whole demo down, not just the voice. The clips now come from static hosting, and a visit costs one call.
  • Small things that look like "it doesn't work". A Netlify rewrite stripped the /api prefix, so every API route returned 404. The database helper cached the finished connection instead of the one in progress, which caused a race when several requests arrived at once. And npm test failed on a fresh clone with "MONGODB_URI is not set". I only found that by downloading the repo and running it the way a stranger would.
  • 99 hard-coded "he"s. Both dashboards called every child "he", with no setting to change it. Anyone using it for a daughter would have seen it on every line. Pronouns are now optional, defaulting to they/them.

One more, from the repo itself. A git add with an out-of-date file path produced a commit of 59 file renames and no code. Pushed, it would have broken every audio reference. I caught it only because I checked what the commit contained before pushing.


What I'd do differently

If I started again tomorrow, I'd change six things.

  • Put the checker in on day one. The verifier came after wrong answer keys had already reached him. Anything a model writes that a child will be marked against should be checked by something that didn't write it.
  • Test where it will actually run. The audio bug, the keyboard and the keypad were all invisible on my laptop. Put it on the real server and the real iPad in the first week.
  • Get it in front of the user sooner. Claude Code can build a lot in an evening. It can't tell you the lessons feel like lectures or that a page of text is boring. A 10-year-old tells you in one session.
  • Make it fail closed. The open API and the demo falling back to his data had the same cause: when a setting was missing, the code carried on with a default. Now a missing setting stops everything.
  • Run it as a stranger would. Download it fresh, follow the README, and see what breaks. Then read what each commit actually contains before you push it.
  • Write down the why, not just the rule. The comments in answer.js and the agent files explain why each rule exists. That's what stops a later Claude session, or me, from undoing a fix nobody remembers making.

The gap I haven't closed yet is the one a reader pointed out after my first article: he still has no way to tell Ollie "I think you're wrong" other than quitting. That's next.


Try a session (get one wrong on purpose).
Code on GitHub: MIT licence.
Full architecture: the whole system on one page.
The original story: why I built Ollie.

If you're building something similar, or you think a script shouldn't get the final word, I'd like to hear it. Connect with me on LinkedIn.

Top comments (12)

Collapse
 
userxnom profile image
Abdullah Naseer •

This is the rare multi-agent post where the architecture is the lesson, not the agent count. The split you made is the part that generalizes: agents do the judging and the writing, scripts make the calls that change what he learns. verify-session.js recomputing every arithmetic answer itself — because the input was written by a model — is the line I would steal for anything where a model grades a real person. Scoring should be computed, not generated.

The clean-score system is elegant, especially "fast and correct is a mastery signal, not spare capacity." One thing I kept wondering about: do a blank and a wrong answer cost the same in the clean score? A blank on a late, hard question reads like triage — he is spending his budget where it counts — while a wrong first try reads like a misconception, and the fix for each is different. Does the grader see that distinction, or is it something the two scores together are supposed to reveal?

And the three iPad bugs all passing laptop testing is the best argument in the post for "test where it will actually run." The gap you mention at the end — the one a reader pointed out that you still have not closed — what is it, and is it the next thing you will build?

Collapse
 
vivek_pathania_bf7f401f6a profile image
Vivek Pathania •

Thanks Abdullah, love "computed, not generated." Stealing that.

Same cost in the clean score, different tag underneath. Wrong answers get re-taught. Late blanks get treated as confidence or tiredness, so he gets easier wins and a shorter session. Fair point on triage though, it never assumes he's being strategic.

The gap: he can't push back when Ollie's wrong, except by quitting. That's how I found the isosceles bug. Building that next.

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The clean-versus-completion split is the metric most agent evals skip — a 10/10 completed session that was only 6/10 clean being a hold, not an advance, is exactly the kind of judgement a benchmark can't fake. And wrong answer keys telling a child he was wrong when he was right is the failure mode that matters most here, since it punishes the thing you're trying to teach. Do the agents ever push back on your overrides, or is the human the only source of corrections in the loop?

Collapse
 
vivek_pathania_bf7f401f6a profile image
Vivek Pathania •

Thanks! And yes, the wrong answer key one still bothers me. It punishes the exact thing you're trying to build.

The agents don't argue with me directly, but I'm not the only one correcting things. The verifier re-solves every question without seeing how it was written, and if it disagrees, the session stops and waits for me. The curriculum gets a blind second check the same way. And the scripts refuse things outright.

The system does push back on me in two places. If I move a topic ahead of something it depends on, I get a warning. And if he's finished a session I haven't graded yet, it won't let me touch the topic order at all. It literally tells me to run /grade first. Honestly, that's the pushback I need most.

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The /grade gate is the one that sticks with me — the system telling the parent to grade first is pushback on the human, not just the agents, and that's the rarer direction. One thing I'd want to know: when the verifier's blind re-solve disagrees, can it tell whether the agent was wrong or the answer key was? That's the case where stopping the session is exactly right, but the fix points in opposite directions.

Collapse
 
alexshev profile image
Alex Shev •

The separation between an adaptive teaching heuristic and a hard progression safeguard is thoughtful. For a child-facing system, I would also retain a compact decision trace for each session—evidence, threshold, override, and next lesson—so a parent can challenge or correct the tutor’s reasoning.

Collapse
 
vivek_pathania_bf7f401f6a profile image
Vivek Pathania •

Agreed. Will add that to my list

Collapse
 
_komachi-jp profile image
Komachi | AI on a Budget •

Your verifier re-solving every answer from scratch is the part I'll steal first — in my setup, Claude Code builds and ChatGPT acts as the second eye, but I don't have a separate checker that re-solves the work itself. The clean-score idea also landed for me: a 10/10 completed session that was only 6/10 clean being a hold, not an advance, feels like the right kind of strict for a family tool. And the three iPad bugs passing all your laptop testing is a good warning — my small family system only gets used on the devices my family actually has, so testing anywhere else would be guessing. Do you have a rule for when a lesson is allowed to advance if the verifier and the grader disagree, or does the verifier always win?

Collapse
 
vivek_pathania_bf7f401f6a profile image
Vivek Pathania •

Thanks! Good question, and the answer is that they never get to disagree, because they judge different things.

The grader judges him: how today went and whether he moves on. Its marks are saved before anything else runs. The verifier judges the next session: are the questions, answers and pictures actually right? So it can stop a session from reaching him, but it can't touch whether he advances.

If the verifier fails something, it doesn't win and it doesn't lose. The run stops and waits for me. It can't fix anything itself, it can only point at the problem.

On ChatGPT as your second eye, one tip: give it only the finished work, not how it was made. A checker that sees the reasoning tends to agree with it.

Collapse
 
gautamtalksdev profile image
Gautam K •

This is such a lovely project. Eight agents writing the next session overnight while he sleeps is a great setup. How do you review a session before he sees it, or do you trust the agents with that?

Collapse
 
the_daily_flare profile image
The daily flare •

59 server calls per demo visitor, with 58 of them just voice clips, made me check how many calls my own pages waste on audio.

Collapse
 
vivek_pathania_bf7f401f6a profile image
Vivek Pathania •

Good catch!! I am working on optimising that it’s on my list.
The idea was to get a working version out ASAP for my Son