miyagi
It is an MCP learning/tutoring server for guided terminal practice: it configures roadmaps and skill level, runs or dry-runs shell commands with teaching cards, quizzes you, tracks XP/streaks/badges, and exports progress notes.
Configure skill level, roadmap category/name/topic, step counters, and reset progress.
Get the next roadmap command and optionally advance the step.
Run or dry-run a shell command to get a teaching card with explanations, pitfalls, docs, flowchart, and quiz; dangerous commands are forced to dry-run.
Submit quiz answers to update streaks/XP/badges and receive feedback.
View user stats: XP, level, title, streak, badges, roadmap progress.
Configure voice/audio settings and optionally speak stats/feedback (though README says voice was removed in 3.1, so the schema is inconsistent).
Export a ROADMAP_PROGRESS.md summary.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@miyagi Set my level to Junior and teach me `git rebase` with a quiz."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π₯ miyagi
Learn while you vibe code. Your AI writes the code. miyagi makes sure it ends up in your head too.
Overview and setup guide Β· How it was built Β· npm
You asked for a checkout page and got four hundred lines back. It works. Could you explain
it? miyagi is an MCP server that rides along while you build with Claude Code, Cursor or
any MCP client. It notices what your assistant wrote, picks the two or three ideas in it
actually worth owning, ties each one to a real line in your project, and then asks you
about it again next week, right before you would have forgotten.
π₯ Debrief
Since your last debrief, your assistant ran 7 commands and edited 3 files (+212 lines).
1. π A secret written into the code Β· π new technique
Your house key is now taped to the front door.
π app/api/pay/route.ts
π₯ How it bites. You delete the line, commit, and relax. Bots that scrape public
repos found the key in the history within minutesβ¦
π€ Ask your AI: "Is this a real credential? Move it to an environment variable
and tell me exactly what I need to rotate."
2. π SQL built by gluing strings together Β· π new technique
You just let strangers finish your sentences β and the database does whatever
the sentence says.
β An API key was committed to git, then deleted in the next commit. What now?
β¨ 2 new techniques discovered Β· XP is earned by answering its questionHow it works
It watches, quietly. One command installs an editor hook. After each command or edit your assistant makes, one line goes into a local log: the command, the file name, and which ideas the change used. Never file contents, never full output (a failed command keeps only its scrubbed error lines), never your prompts, nothing off your machine. No hook? It reads
git diffinstead, so it works with zero setup.It chooses. A change can touch a dozen ideas. You get the few that matter most: new to you first, security before syntax, and nothing you have already proved you know.
It teaches in three lines, not thirty. A hook, what the thing is, how it bites, and a question to put to your assistant. Your assistant then explains it using the code it just wrote, not a textbook example.
It comes back. Every idea has a recall question on a spaced-repetition schedule (10 minutes, then 1, 3, 7, 16, 35 days). This is the part that turns "I saw that once" into "I know that".
You earn belts, not points for showing up. Each of the 23 techniques has a belt, white to black, that rises only when you answer its question cold after a longer gap, and drops when you miss. Techniques unlock when your assistant writes code that uses them. You cannot grind the dojo. You have to build something.
It also still does what it started as: guided terminal, git and DevOps tracks where you run the command and a read-only probe checks the outcome really exists on your machine.
Related MCP server: MCP Walkthrough
Start in 60 seconds
claude mcp add miyagi -- npx -y miyagi-mcp # 1. add the server (Claude Code)
npx -y miyagi-mcp --setup # 2. turn on ride-along capture
npx -y miyagi-mcp --rules >> CLAUDE.md # 3. optional: teach without being askedRestart your editor, build something, then say: "miyagi, debrief me."
--setupwrites one hook into.claude/settings.local.json(and.cursor/hooks.jsonif the project uses Cursor). It merges with what is there, never overwrites, and refuses to touch a file it cannot parse. Add--globalfor every project,--dry-runto preview,--uninstallto remove it.--rulesprints a short paragraph forCLAUDE.md,AGENTS.mdor.cursorrulesthat tells the assistant to callexplain_changewhen it finishes a piece of work.Busy? Say "miyagi, focus mode". Ideas are still queued for later; nothing is shown.
Why it's safe to install
It runs shell commands on your machine, so it's built to be read before it's trusted.
Nothing catastrophic executes.
rm -rf /,mkfs,dd of=/dev/*, fork bombs,curl | shand history-wiping are pattern-matched and refused regardless of what the calling model claims. The screen defends against a confused AI, not just a careless user, which is why it re-derives the verdict instead of trusting theis_dangerousflag it was handed.A human confirms destructive commands, not a model.
confirm_dangerousused to be a flag the assistant filled in, which is not confirmation: a prompt-injected assistant sets it as easily as a careful one. Where your client supports elicitation, the server asks you, shows you the command, and requires you to typeRUN. The flag survives only as the fallback for clients that cannot prompt, and a failed or cancelled prompt means no.A denylist is a backstop, not a sandbox. The real boundary is your MCP client's own approval prompt, with you reading the command before it runs. The screen exists for the narrower case that prompt handles badly: something obviously destructive proposed to someone who is clicking through.
Failures teach instead of crashing. A non-zero exit returns a Hotfix Diagnostic with a troubleshooting ladder. The server never throws.
Bounded. 60-second timeout (raise it per call if you know better), 4 MB output cap, no network calls, no telemetry, no API keys, no accounts.
Interactive commands are refused, not timed out.
vim,npm run dev,tail -fand friends are recognised up front and handed back to you, rather than sitting in the queue until the timeout makes the tool look broken.Two tiers, not one. Catastrophic shapes (
rm -rf /,mkfs,curl | sh, fork bombs, wiping your shell history) never execute, with or without confirmation. Merely destructive ones (rm -rf build,git push --force,terraform destroy) are explained, dry-run, and executed only if you passconfirm_dangerous: true. One tier had a cost: a learner who genuinely needed to practiserm -rf buildhad to leave the tutor to do it, which teaches working around your own safety rail.It admits what it cannot see.
sh -c,evaland decoded payloads hide the real command from any pattern match, so they are flagged as opaque rather than waved through.Nothing is truncated silently. Output over the cap, a killed process, and a trimmed display all say so on the card. "That is all the output there was" is the one wrong conclusion a learner must never be led to.
Small enough to audit. Two runtime dependencies, the MCP SDK and zod. The MCP surface, the safety screen, the content pack, the quiz bank, scheduling, persistence, execution, rendering and session modes are separate modules.
Install
Point your MCP client at npx and it fetches on first run:
npx -y miyagi-mcpOr install it globally, which gives you a miyagi command:
npm install -g miyagi-mcpgit clone https://github.com/c00p75/miyagi.git
cd miyagi
npm install
npm run build # emits dist/miyagi.js
npm testThen use "command": "node", "args": ["<ABS_PATH>/dist/miyagi.js"] in the config below.
Configure your MCP client
Three lines, the same everywhere. No keys, no accounts, and it all runs locally.
{
"mcpServers": {
"miyagi": {
"command": "npx",
"args": ["-y", "miyagi-mcp"]
}
}
}Where that goes:
Client | File |
Claude Desktop (macOS) |
|
Claude Desktop (Windows) |
|
Cursor |
|
AntiGravity / Windsurf |
|
For Claude Code, one command does it:
claude mcp add miyagi -- npx -y miyagi-mcpRestart the client, build something, then try: "miyagi, debrief me." Or, for terminal
practice: "Set my roadmap to Backend Developer and teach me docker compose config."
What's in it
Engine | What it does |
Concept pack | 23 ideas an assistant commonly writes β hard-coded secrets, SQL built from strings, React state and effects, environment variables, tokens, migrations, CORS, async code and more β each at three depths, with a hook, a pitfall told as a story, a question to ask the AI, and its own recall questions. Detection is a few regular expressions over added lines, fast enough for a hook and deliberately conservative: a tutor that explains something you did not do stops being read. |
Ride-along capture |
|
Choosing what to teach | Ideas are ranked by how much a misunderstanding would cost, whether you have seen them, and how often you have missed them. Anything you have recalled cold three times is named, not re-explained. |
The dojo |
|
Teaching | A content pack with per-command lessons at three depths for 33 commands, so |
Checkpoints | Steps carry a read-only probe and a stated pass criterion, shown before you start. |
Spaced repetition | Every question you see and every command you run is scheduled on a Leitner ladder β 10 minutes, 1, 3, 7, 16, 35 days. A correct answer promotes it; a slow-but-correct answer holds its box, because hesitant recall is weaker recall; a miss drops it to the front, not to zero. |
Model assistance | Optional, and strictly additive. If your client offers sampling, a prose answer that means the right thing is graded on meaning rather than string comparison β and a model can only ever upgrade a verdict, never take away an answer that already matched. For a command the bank has never heard of, it writes a question, validates it as hard as a hand-written one, and caches it so the bank grows towards what you actually practise. |
Insights |
|
Streaks | Two of them. The quiz streak drives the XP multiplier; the practice-day streak counts consecutive calendar days, which is the habit hook a per-session number cannot be. The card tells you when today is the day you lose it. |
Mastery | Per-command attempt and success counts, so stats can say "you are 40% on |
Roadmap | Six built-in tracks with 26 checkpointed steps, plus your own: any JSON file in |
Windows | Tracks declare |
Gamification | Nothing for a technique merely appearing in code: XP is paid for recall and verified work, not exposure. Attempt XP follows the session mode (10 in drill, 3 in ride-along, 0 in focus), 30 for a verified outcome, 25 per correct quiz (30 for a review β cold recall is the harder skill) with streak multipliers, |
Progress |
|
Safety | Two tiers, screened independently of the caller: catastrophic shapes never run, destructive ones need a human's confirmation. Checkpoint probes are screened too β a "probe" that deletes something is not a probe, and a track file is where one would hide. |
Notes |
|
In a terminal
No MCP client and no editor needed. The same ideas, questions, review schedule and profile:
npx miyagi-mcp watch # teach from what changes in this repository, when the work pauses
npx miyagi-mcp review # answer what is due, from memory
npx miyagi-mcp dojo # what you have found, and the belt held in eachwatch treats whatever was uncommitted when it started as old, and prints a card once a change has been still for twenty seconds. review shows each question alone first and the choices only after Enter. This is the way to use Miyagi beside a terminal agent, or inside JetBrains, Neovim or Zed.
Tools
For learning from what your assistant built:
explain_change: the ideas behind code that was just written. No arguments reads the uncommitted git changes (or the last commit);difftakes a diff or a bare snippet;pathtakes one file. Returns up tolimitideas, each tied to a real line, plus one recall question. Read-only.debrief: what the assistant did since the last debrief β commands run, files touched, techniques used β and the few ideas in it worth understanding. Falls back to git when capture is not installed.replay: trueincludes everything captured.
For practice, progress and configuration:
quick_config: skill level (Junior/Mid/Senior), category, track, topic, and session mode (drill/ride-along/focus), in one call.reset_progress: truewipes XP, streaks, mastery and the review queue back to first-run state. Call it with no arguments to read the current configuration. The default mode is ride-along: a short card, no inline quiz. Intensity is opted into withmode: "drill".list_roadmaps: every track, built-in and yours, with step counts and the JSON schema for authoring your own. Worth calling before you set a track name.set_active_roadmap: category, track, topic and step counters. An unknown name is reported with suggestions rather than substituted.get_next_roadmap_command: the next copy-pasteable command, withadvance: trueto step forward.run_teaching_command: execute or dry-run a command and return the teaching card. If the command is the current step and that step has a checkpoint, the outcome is verified afterwards and credited.timeout_msraises the 60-second cap;confirm_dangerousis the fallback for clients that cannot prompt you directly.verify_step: run the current step's read-only probe. Passing credits the outcome once and advances; failing says what is missing and leaves the step where it is.verify_quiz_answer: grade an answer by letter or by text, update streaks, XP, mastery and the review schedule. Takes thequiz_idfrom the card, or defaults to the most recent question.review_due_items: the spaced-repetition session β everything whose interval has elapsed, most overdue first.get_user_stats: XP, level, title, both streaks, badges, per-command mastery, weak spots, review queue and lifetime totals.export_roadmap_notes: writeROADMAP_PROGRESS.md, session-scoped or lifetime.
All twelve tools carry MCP annotations (readOnlyHint, destructiveHint, idempotentHint),
so a client can tell get_user_stats apart from run_teaching_command when it decides
what to prompt about.
Voice was removed in 3.1.
voice_enabled,words_per_minuteandtest_phraseare no longer accepted byquick_config,get_user_statsno longer takesspeak, and the doctor no longer looks for a speech engine. Old profiles load as before; their voice settings are ignored.Upgrading from 2.x: XP moved to outcomes. Drill still pays 10 XP for running a command (was 15); ride-along pays 3; a verified checkpoint is 30. The default mode is ride-along. Old profiles are migrated, not discarded.
Resources and prompts
Progress is readable without spending a tool call, so a client can render it in a sidebar:
Resource | What |
| XP, level, badges, both streaks, mastery, review queue |
| Active track, position, next command, full step list |
| Every scheduled item with its box, due date and lapses |
| The durable practice log, most recent 200 events |
| One track as markdown; the name autocompletes |
| Every technique discovered, and the belt held in each |
| Cadence by week, review accuracy, checkpoint pass rate, verdict |
| How the tutor works, and the order to do things in |
Subscribed clients get notifications/resources/updated when saved state moves, so a
sidebar is never showing a level you passed twenty minutes ago.
And seven prompts, so nobody has to know tool names to start: debrief (what did the
assistant just do, and what should I understand?), teach-me-this-change (guess first,
then get corrected, on the change just made), ride-along (the quiet
default β a short card, no inline quiz), drill (pick a track and depth first β from
your XP, what you are building, and an optional placement quiz β then a guided session
with the quiz), review (spaced repetition over what is due), explain-last-error
(teach from a failure instead of fixing it), and progress (where am I, what is weak,
what next). Drill does not dump you onto Command Line Basics at Junior. It recommends
tracks and a depth; you choose. Examples on the card are supposed to be user stories
from the project in front of you.
Authoring your own track
Drop a JSON file in ~/.miyagi/roadmaps/. A step can be a bare command string or an
object with its own topic and note:
{
"name": "My Python Track",
"category": "Skill Based",
"description": "What this track teaches, in one line.",
"shell": "posix",
"steps": [
"python3 --version",
{
"command": "python3 -m venv .venv && . .venv/bin/activate",
"topic": "Isolated environments",
"note": "Never install into the system interpreter.",
"windows": "python -m venv .venv; .venv\\Scripts\\Activate.ps1",
"verify": {
"command": "test -x .venv/bin/python",
"describe": "a virtualenv exists at .venv"
}
}
]
}verifyis what makes a step earnable. It must be read-only: a probe that the danger screen objects to is dropped when the file is loaded, because a track file is exactly where somebody would hide one.containsadditionally requires a string in its output.windowsis the PowerShell equivalent, used automatically when aposixtrack is walked on Windows.shelldeclares what the commands are written for:posix,powershellorany.
list_roadmaps with reload: true picks up edits without a restart, and names any file
it had to skip β a track silently ignored is worse than one that fails loudly.
Where progress lives
~/.miyagi/profile.json holds XP, level, both streaks, badges, per-command mastery, the
review queue, your skill level, session mode and roadmap position. ~/.miyagi/history.jsonl
is the append-only practice log: one line per event, so a crash costs at most the line
being written and one corrupt line costs only itself. Override the directory with
MIYAGI_HOME, which is also how the tests keep away from a real profile.
The file is treated as untrusted on the way back in, because it's hand-editable and a crash can truncate it. Anything that fails to parse is discarded in favour of a fresh profile rather than raised as an error, values out of range are clamped instead of rejected, and level is recomputed from XP rather than read, so a file claiming level 99 at 40 XP gets corrected. A review item with an unreadable due date is treated as due now, which fails safe towards revision, and a streak nobody can date is not counted as a streak. Writes go to a temp file and are renamed, so an interrupted write leaves the previous profile intact. A 1.x profile is migrated rather than discarded: losing a learner's XP on upgrade would be the worse bug.
When something looks wrong
npx miyagi-mcp --doctorChecks the Node version, whether ride-along capture is installed and how much is waiting for a debrief, that commands can actually be executed, that the profile directory is writable, that a saved profile parses, which track files were skipped and why, and whether any track is written for the wrong shell for this host. Plain text on stdout β the one mode where that is safe, because there is no protocol to corrupt. A warning is a working install; only a real failure exits non-zero.
Development
npm install
npm run typecheck
npm test # node:test, no test framework to install
npm run buildnpm run eval # the content rubric, the learner journey, and coverage parity
npm run doctor # after a buildnpm test runs 300 node:test cases. Three layers, and the top two are the ones that
find real bugs:
Unit β persistence, scheduling, safety tiers, quiz selection, platform resolution.
End-to-end β a test client that speaks real MCP over stdio, including answering elicitation prompts and serving sampling requests, so the human-confirmation and model-grading paths are exercised the way a client exercises them. It also throws on any non-JSON byte on stdout, which is how a stray
console.loggets caught.Eval β a rubric over everything a learner can see: every lesson at every depth (boilerplate, specificity, does depth change anything), every question (does the answer leak, can it be won by picking the longest choice, does grading round-trip), every card every track can render, every diagram, plus a fuzz pass over malformed command lines.
That last layer earns its keep. It found a signed-integer bug in the choice shuffler that
rendered B. undefined for some seeds and not others β intermittent by construction,
invisible to a single example, and caught immediately by sweeping the whole bank. It also
found that 29 of 35 questions could be answered by picking the longest choice.
CI runs typecheck, tests, a stdio handshake, --doctor, and an install-from-tarball check
against Node 18, 20 and 22.
Limits worth knowing
Concept detection is pattern matching, not understanding. It recognises 23 common ideas by their shape in added lines; it will miss an idea written an unusual way and it says nothing about plain business logic. When nothing matches, the card says so rather than inventing a lesson.
Capture needs an editor with hooks (Claude Code, Cursor). Everywhere else,
explain_changeanddebriefreadgit diff, which sees the result but not the commands that produced it.The server suggests when to teach (its MCP instructions and
--rules), but the assistant decides whether to call it. If yours stays quiet, ask: "miyagi, debrief me".The observation log is plain text in
~/.miyagi/. It holds commands (scrubbed), file names and one scrubbed line per idea. SetMIYAGI_OBSERVE=offto pause capture.Commands run with your own privileges in your own directory. No container, no restricted user, no syscall filter. That's right for a local teaching tool driven by its owner, and it's the first thing to change if it ever accepts untrusted input.
Long-running or interactive commands belong in your own terminal. The common ones are recognised and refused; anything else meets the 60-second cap.
The pattern-based safety screen is a speed bump, not a sandbox.
sh -c "$(...)"defeats any denylist, which is why those shapes are flagged as opaque rather than trusted. The real boundary is your client's approval prompt with you reading the command.The content pack covers the commands the built-in tracks teach, enforced by a test. Everything else leans on the tutor brief and the model reading the card, which is honest but not offline.
A checkpoint proves the outcome exists, not that you produced it. Someone determined to cheat can create the directory by hand β but at that point they have run a command, which was the entire objective.
Model-assisted grading and question generation need a client that offers sampling. Without one, grading is a string comparison and questions come from the bank.
Whether XP, streaks and spaced repetition actually keep someone on a roadmap is still an open question β but it is now a measured one. Read
miyagi://insights: review accuracy against first-sight accuracy is the number that matters, and the report says so, including when there is not yet enough evidence to say anything at all.
Learn more
Overview and setup guide walks through what a teaching card contains, the config for each client, and where the safety model stops.
How it was built is the engineering write-up: why the danger screen ignores its caller, why it uses a transport that cannot be hosted, and what the design gives up.
Issues and pull requests are welcome. If you use it and it teaches you nothing, that is a bug worth reporting.
License
MIT
Available Tools
8 toolsconfigure_voiceConfigure VoiceA
Toggle tutor audio on/off and adjust the speech rate in words per minute.
Inputs: enabled, test_phrase, words_per_minute.
export_roadmap_notesExport Roadmap NotesA
Write a clean ROADMAP_PROGRESS.md summary of the session: roadmap position, player stats, and every concept and command covered.
Inputs: append, output_path.
get_next_roadmap_commandGet Next Roadmap CommandB
Suggest the next copy-pasteable terminal command for the active roadmap milestone. Optionally advance the step counter.
Inputs: advance.
get_user_statsGet User StatsA
Return the current player profile: XP, level, title, quiz streak, unlocked badges, and roadmap progress.
Inputs: speak.
quick_configQuick ConfigC
Instantly switch the target skill level (Junior/Mid/Senior), roadmap category, roadmap track, or topic via simple key-value parameters.
Inputs: category, skill_level, roadmap_name, current_topic, +3 more.
run_teaching_commandRun Teaching CommandA
Execute (or dry-run) a shell command and return a full teaching card: roadmap alignment, level-appropriate What/How/Trade-offs, a Mermaid flowchart, pitfalls, curated docs, and an active-recall quiz. Errors return a Tutor Hotfix Diagnostic instead of throwing.
Inputs: command (required), cwd, concept, dry_run, +1 more.
set_active_roadmapSet Active RoadmapC
Configure the active roadmap: category, roadmap name, current topic node, and progress step counters.
Inputs: category (required), roadmap_name (required), current_topic (required), step_index, +1 more.
verify_quiz_answerVerify Quiz AnswerA
Evaluate the learner's answer to the most recent active-recall quiz. Updates streak, XP and badges, and speaks feedback.
Inputs: answer (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 8 tools
Tools are mostly distinct, but quick_config and set_active_roadmap both handle roadmap configuration, which could cause confusion about which to use for what. Other tools like verify_quiz_answer and run_teaching_command have clear, separate purposes.
Most tools follow a verb_noun snake_case pattern (verify_quiz_answer, set_active_roadmap, get_user_stats), but 'quick_config' deviates with an adjective prefix and lacks a clear noun, breaking the pattern slightly.
Eight tools is well within the ideal range for a focused tutoring server. Each tool covers a distinct aspect of the tutor workflowβconfig, teaching, quiz, stats, exportβwith no redundancy or excessive bloat.
The tool set covers core tutor functions: configuration, teaching, assessment, progress tracking, and export. Minor gaps exist, such as no explicit tool to list available topics or manage user preferences beyond voice, but agents can work around these.
Maintenance
Related MCP Connectors
Open-source AI courses taught by your AI tutor in conversation, with progress saved by MCP tools.
Let your coding agent read your GameSalad projects, and edit them live in Creator on Pro and Edu.
Language coaching in Codex with durable per-account memory on en-ai.ru.
Remote MCP learning coach for coding agents.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables interactive LeetCode practice with AI-guided authentication, problem solving, solution submission, and learning mode.24112 npm12MIT
- AlicenseAqualityCmaintenanceEnables AI agents to present interactive code walkthroughs with voice narration, opening files, highlighting code, and showing inline explanations with synchronized text-to-speech.519 npmMIT
- AlicenseAqualityCmaintenanceEnables querying structured study plans, code challenges, and ASCII certificates for JavaScript, Python, and TypeScript tracks at beginner or advanced levels via natural language.3MIT
- FlicenseNot gradedqualityCmaintenanceEnables an active learning tutor that runs in MCP clients like Codex or Claude Code, letting the AI create and manage lessons, read student attempts, and give feedback while the student practices in a local browser panel.-