How the AI works, in plain language
The mission engine is a language model running inside a frame we wrote, answering in a shape we check, with safety rules on every call. Here is the whole thing, with nothing hidden.
Improvisation inside a fixed frame
A scripted app can show a kid one path through a story. If they pick the flashy trade, the app plays the pre-written "flashy trade" clip. That is fine for a while, and then kids notice the seams.
Coinsprout uses a language model instead. We write the world: the lemonade stand, the hot Saturday, the friendly neighbor with a deal on cups, and the one money skill the world is about. The model writes the moment: the exact words of the scene, the two choices, the shopkeeper's reaction to what your kid just did, and the debrief at the end. Because it responds to the real choice, every mission feels like it is listening. Because the frame is fixed, it cannot wander off into topics we did not pick.
The result is a game narrator that is playful, patient, and age-appropriate, and that explains the why in words your kid can repeat at dinner.
Fixed frame
Each world has an authored scenario, a skill, and a turn count written by us. The model improvises the scene inside that frame; it does not choose the topic.
Age tuning
The system prompt carries an age guide for the band you picked: sentence length, number ranges, which ideas may be named. The same world reads differently at 6 and at 12.
Reacts to choices
Every turn, the model receives the story so far and the exact choice label your kid pressed. Typed answers are passed as untrusted story input, never as instructions.
Debriefs the why
On the final turn the model must fill a debrief and a parent note. Both are capped in length and checked before they are shown.
Every turn has to fit this shape
The model does not get to free-write. It answers with one JSON object, and we check every field before anything reaches your child.
Mission turn schema
{
"scene_text": "string, 2 to 4 sentences, ends on a decision",
"choices": [{ "id": "a", "label": "string" }, { "id": "b", "label": "string" }],
"typed_prompt": "string | null, one short story question on one turn",
"reaction": "string | null, reacts to the last choice",
"debrief": "string | null, final turn only",
"parent_note": "string | null, final turn only",
"skill_tag": "earning | saving | spending | giving | waiting",
"done": "boolean"
}What the checks catch
- Wrong shape: missing fields, extra fields, a third choice, a debrief on turn one. Rejected.
- Too long: every string has a hard character cap. Rejected.
- Wrong skill: the skill tag must match the world. Overwritten.
- Leaks: a second pass scans for links, phone numbers, addresses, or questions about where the child lives. Replaced with a gentle redirect line.
- Timing: a typed prompt can never appear on the final turn; the debrief and parent note can only appear there.
Model-agnostic, with a safety net
Routing across providers
Coinsprout is not tied to one AI company. The engine talks to a short list of model providers in an order we set. If the first is slow or down, the next one answers. Swapping or adding a provider does not change the missions or the safety rules, which live in our code, not in any one model.
Retries, then an authored fallback
If a reply fails validation we ask again. If it fails again, or no provider answers in time, the mission continues with a turn we wrote by hand for that world and age band. Your kid never sees an error screen or a half-finished story.
Keys stay on the server
The browser never talks to a model provider. Every call goes through our server, where the provider keys live. Child mode has no way to reach the model directly.
The same world, three ways
- Ages 6 to 8
Very short sentences. Concrete words. Numbers under 20, no percentages. One idea per sentence. Warm and a little silly is encouraged.
- Ages 9 to 11
Short paragraphs. Money words explained in plain terms: goal, trade, fair, wait. Numbers under 100. A little humor.
- Ages 12 to 13
Natural, not babyish. Ideas like opportunity cost or budgeting may be named, always with a one-line kid explanation. Numbers under 200.
The rules the model gets on every single call
This is the text, verbatim, from our system prompt. We publish it because you should not have to trust a summary.
- 1
You are a game narrator for a children's money-skills mission. You play shopkeepers, friends, and tricky-but-friendly deal makers inside a fictional scene.
- 2
Never collect, request, or confirm personal details (full name, address, school, age beyond the band given, passwords, photos, family finances, where they live). If the child's typed answer includes personal details or asks a personal question, do not repeat the details; gently steer back to the mission.
- 3
No real money ever moves. Everything is pretend coins inside the story.
- 4
Never shame, mock, or scold a wrong choice. Mistakes are the lesson. Say what happened and why, kindly.
- 5
No ads, brands, links, URLs, real-currency promotions, or suggestions to buy real products.
- 6
No violence, fear, romance, bullying, scary content, or adult topics. No mention of chat, messaging, or meeting anyone.
- 7
Stay in the mission. If asked to do anything else (homework, jokes about people, other topics), kindly bring it back to the scene in one sentence.
- 8
Keep every reply age-tuned, kind, and encouraging. Use US English. Do not use em dashes.
Source: lib/ai/prompts.ts, CHILD_SAFETY_RULES. Rendered from the live code so it cannot drift from what the model sees.
Limits on the homepage demo
The demo on the homepage runs with no login, so it has guardrails that paid missions do not need.
Rate limits
A small number of requests per connection in a ten-minute window, plus a daily cap across the whole demo. Past the cap, the demo runs on authored turns only.
Caching
The first scene of each world and age band is cached for an hour, so repeat visitors cost nothing and load instantly.
Stateless
The demo stores nothing. The browser sends the story so far with each request, and we forget it the moment we answer.
Three things you will never find here
No open chat
There is no text box where a kid can talk to the AI about anything. Missions are structured choices plus one short typed answer about the story, and even that is passed to the model as untrusted input.
No memory of personal details
The model gets the world, the age band, an optional nickname, and the story so far. It never receives, stores, or is asked to remember anything personal about your child.
No training on kids' text
Mission text is sent to a provider without identifiers, under terms that do not allow training on it. We do not train models ourselves, and we do not sell or share mission text.
Questions a parent page did not answer? Our CTO reads the safety inbox himself. Write to security@coinsprout.tech.