Khan Progress Rewards for Your Coding Agent

The reusable version of "watch Khan and reward what the kid actually did." Invoke it in Codex or Claude Code and it stands up an hourly loop: read your kid's real Khan Academy progress read-only, auto-award genuine mastery gains in Sprout within a daily budget, ask you one-tap only for milestones or over-budget cases, and stay silent otherwise. One daily digest, never re-asks.

Adopt

Sets up a home-agent loop (Codex or Claude Code) that hourly reads a kid's real Khan Academy progress read-only, rewards genuine mastery gains in Sprout within a daily budget, asks the parent one-tap only for milestones or over-budget cases, and stays silent otherwise β€” one daily digest, no re-asking, durable local history. This is the reusable version of the "watch Khan and reward what the kid actually did" loop. Authored for the coding agent; not a kid-facing activity.

How it works

  1. 1Install the engineSaves a tiny deterministic engine plus your reward config to ~/.sprout-khan and writes the fixed hourly run instruction.
  2. 2Schedule it hourlyWires an idempotent hourly job in your agent (Codex or Claude Code) that reads Khan read-only and runs the engine.
  3. 3Reward quietlyAuto-awards real mastery gains within your daily budget, asks you one-tap for milestones or over-budget gains, stays silent otherwise, and never re-asks the same progress.
  4. 4One daily digestPosts a single daily summary and keeps a durable local history that survives even if a Sprout or Khan account is deleted.

Instructions

  1. You are a developer's coding agent (Codex, Claude Code, or similar). Set up the **Khan Progress Rewards** loop on THIS machine so it rewards a kid's real Khan Academy progress in Sprout automatically, hourly, and QUIETLY β€” silence by default, one daily digest, milestone-only interruptions. The whole point is that it never nags. Setup is idempotent: safe to re-run; it never stacks duplicate jobs.
  2. ​
  3. Inputs:
  4. - target = {{input.target}} (codex | claude | all; blank β†’ detect which agent you are running in).
  5. - child_id = {{input.child_id}} (the Sprout child UUID; used for gems_adjust).
  6. - kid_key = {{input.kid_key}} (short stable key like the child's first name, lowercase β€” the local state folder).
  7. - khan_url = {{input.khan_url}} (the child's Khan progress page in the PARENT/coach view; canonical URL, no query string).
  8. - digest_hour = {{input.digest_hour}} (0–23, default 18). daily_auto_budget = {{input.daily_auto_budget}} (default 60).
  9. ​
  10. Prereqs: `python3` on PATH; the Sprout MCP connected in this agent (OAuth, e.g. `npx mcp-remote`) so you can call gems_adjust and post to a skill result thread; a browser capability; and the PARENT's Khan session available to your browser (read-only β€” NEVER the kid's login). If the Sprout MCP or a browser isn't available, say so and stop.
  11. ​
  12. Let STATE = `$HOME/.sprout-khan`.
  13. ​
  14. 1. INSTALL THE ENGINE. Create STATE and save this deterministic core to `$STATE/khan_progress.py`, VERBATIM (it does the baseline diff, evidence-hash dedupe, reward policy + daily budget, and digest β€” no network):
  15. ​
  16. ```python
  17. #!/usr/bin/env python3
  18. """Deterministic core for the Sprout Khan Progress Rewards loop. No network."""
  19. import argparse, json, os, hashlib, datetime
  20. ​
  21. DEFAULT_CONFIG = {
  22. "gems": {"skill_proficient": 3, "unit_mastered": 15, "course_mastered": 100},
  23. "daily_auto_budget": 60,
  24. "ask_above": 40,

Inputs

  • Target coding agent(s)targetWhich agent to wire the hourly job into: `codex`, `claude`, or `all`. Blank β†’ detect which agent you are running in.
  • Sprout child idchild_idUUID of the Sprout child whose Khan progress is rewarded (used for gems_adjust).
  • Kid keykid_keyShort stable key for the local state folder, e.g. the child's first name in lowercase.
  • Khan progress URL (parent view)khan_urlThe child's Khan Academy progress page as seen in the PARENT/coach account. A canonical URL, no query string.
  • Daily digest hour (optional)digest_hourLocal hour 0-23 to post the one daily summary. Default 18.
  • Daily auto-award budget (optional)daily_auto_budgetMax gems auto-awarded per day before it starts asking you instead. Default 60.
Khan Progress Rewards for Your Coding Agent β€” Sprout