5.0 KiB
Quantum Tutor Implementation Plan (rev 2 — split index)
For agentic workers: this plan is split into 18 atomic sub-tasks. Each task has its own file under
2026-04-29-quantum-tutor/. When executing, load only the matching sub-task file plus the design spec — never load this index nor sibling tasks. Usesuperpowers:executing-plansorsuperpowers:subagent-driven-development.
Goal: Add 4 MCP tools (get_lesson, check_exercise, explain_result, get_progress) to quantum-bridge-mcp, backed by a JSON curriculum (7 modules / 18 exercises) and a persistent progress file.
Spec: docs/superpowers/specs/2026-04-29-quantum-tutor-design.md.
Sub-tasks (in order)
| # | File | Goal | Depends on |
|---|---|---|---|
| 0 | 00-prerequisites.md |
QuantumBridgeServer holds Arc<dyn Backend> + tempfile dev-dep |
— |
| 1 | 01-curriculum-types.md |
Curriculum types + module 1 JSON | 0 |
| 2 | 02-curriculum-loader.md |
OnceLock-cached CurriculumLoader, no expect() |
1 |
| 3 | 03-progress-store.md |
Sandboxable ProgressStore (QB_PROGRESS_PATH) |
0 |
| 4 | 04-circuit-analyzer.md |
AST-based gate listing | 0 |
| 5 | 05-exercise-checker.md |
ExerciseChecker with &dyn Backend, 2σ, statevector |
2, 4 |
| 6 | 06-get-lesson.md |
get_lesson response (first uncompleted lesson) |
2, 3 |
| 7 | 07-check-exercise.md |
check_exercise response (structured diagnostics) |
5, 6 |
| 8 | 08-explain-result.md |
explain_result response (AST-based) |
4, 7 |
| 9 | 09-get-progress.md |
get_progress response (current_lesson + unlock) |
8 |
| 10 | 10-wire-tools.md |
Register the 4 MCP tools on the server | 9 |
| 11 | 11-curriculum-module-2.md |
Module 2 — Superposition | 10 |
| 12 | 12-curriculum-module-3.md |
Module 3 — Interférence | 11 |
| 13 | 13-curriculum-module-4.md |
Module 4 — Intrication | 12 |
| 14 | 14-curriculum-module-5.md |
Module 5 — Multi-qubits | 13 |
| 15 | 15-curriculum-module-6.md |
Module 6 — Premiers algorithmes (phase kickback) | 14 |
| 16 | 16-curriculum-module-7.md |
Module 7 — Grover + 18-exercise assertion | 15 |
| 17 | 17-integration-tests.md |
MCP integration tests + golden files | 16 |
Architecture invariants enforced by this plan
(These are the only invariants you need to remember when walking sub-tasks; each task file repeats the relevant ones.)
QuantumBridgeServerownsArc<dyn Backend>; tutor tools route throughself.backend.ExerciseChecker::check_circuit(backend: &dyn Backend, …)— never instantiatesLocalSimulatordirectly (CLAUDE.md §3 / spec §3).CurriculumLoaderlazily parses an embedded JSON viaOnceLock; returnsResult, noexpect()(CLAUDE.md §10).ProgressStoreis sandboxed viaQB_PROGRESS_PATH; missingHOMEreturnsErr, never falls back to..CircuitAnalyzerexposes AST-based gate listing —explain_resultdoes not string-match the QASM source (spec §2.3).- Statistical tolerance for exercise checks is 2σ below
min_ratio(spec §3). check_exercisedistinguishes protocol errors (unknown exercise →McpError) from validation errors (circuit invalid → structureddiagnosticspayload, spec §2.2).- Module 6 uses phase kickback rather than teleportation (the v1 executor walks past
Stmt::If).
Changelog vs. rev 1 (legacy single-file plan)
The previous monolithic plan was 1767 lines and contained:
- DIP violations (
LocalSimulator::new()insideExerciseChecker). - String-matching in
explain_result. expect()in production (CurriculumLoader::load).get_lessonalways returning lesson 1.- 3σ tolerance instead of spec's 2σ.
statevector_checkdefined but unused.- Validation errors collapsed to
McpError. - Test bugs (process-id collision in
ProgressStoretests; integration tests writing to real~/.config/). - Module 6 teleportation that the v1 executor cannot run.
- Task 5 (4 tools) and Task 7 (6 modules) bundled into single commits.
Rev 2 fixes all of the above and splits the work into 18 atomic, single-responsibility tasks.