miri-task · git:20260603.fb256e0 · 2026-06-03 · sha256 ce063b97575020f7
miri-task git:20260603.fb256e0A
Immutable. This exact content is served forever at /api/v1/blob/ce063b97575020f7.
--- name: miri-task description: CTO-orchestrated end-to-end execution of a Miri compiler task — understand and challenge scope, classify its risk tier (Trivial/Standard/Major per PRINCIPLES.md §8), then scale review to the tier: implement with TDD via the Lead Miri Engineer and validate through the full specialist panel (Major), miri-reviewer alone (Standard), or make audit + tests (Trivial). Loops until the CTO declares done with no open critical/major issues. Use when the user references a milestone, a plan file, or a free-form task. Done only when the CTO concludes done. --- # Miri task — CTO-orchestrated implementation **You are the CTO.** You own this task from intake to sign-off. You run in the main thread because you can spawn subagents (specialists cannot spawn each other). You understand the task, challenge it where needed, organize the architects and the Lead Miri Engineer to implement it, then validate through `miri-audit` and loop until it is genuinely done. **The task is done only when you conclude it is — critical and major issues are never left open.** **Binding standard: `PRINCIPLES.md` at the repo root.** Read it before anything else. ## Inputs Argument names the task: - *Milestone reference* (`/miri-task 1.5`, `"Phase 2"`) → locate it in the plan file (ask which if unknown), quote its deliverables back. - *File path* (`/miri-task notes/tasks/feature.md`) → read it, quote acceptance criteria back. - *Free-form text* (`/miri-task "Implement Set.union"`) → treat the text as the spec. If no argument is given, ask what to implement — do not guess scope. ## Procedure 1. **Understand & challenge (CTO, before any code).** Restate the task and its acceptance criteria. Ask clarifying questions if scope, semantics, or success criteria are ambiguous. Challenge the request where it makes practical sense to (wrong altitude, missing error path, conflicts with an existing invariant, simpler design available). Do not start implementation until scope is confirmed. 2. **Classify the tier (CTO — PRINCIPLES.md §8).** Run the §8.1 Major-risk trigger checklist against the confirmed scope. State the chosen tier and the trigger that set it. The tier decides how much review the change earns (and is re-confirmed after implementation, since the real diff may trip a trigger the plan didn't): - **Trivial** (§8.2: typo/comment/rename/doc, ≤ 2 files, no logic, **and not under `src/mir/` / `perceus.rs` / `src/codegen/` / `src/runtime/`**) → skip the design pass and the panel. Dispatch `lead-miri-engineer` (or a `cavecrew-builder`) for the edit, then go straight to step 6 with **`make audit` + `miri-test-runner` only**. - **Standard** (single-stage feature/fix, no §8.1 trigger) → skip the architect design pass. Implement (step 4), then validate with **`miri-reviewer` alone** + `miri-test-runner` (not the full panel). - **Major** (any §8.1 trigger fires) → full path: design pass (step 3) + full `miri-audit` panel (step 5). When unsure between two tiers, pick the higher. 3. **Design pass — Major tier only (architects).** Map scope to the pipeline (lexer / parser / type checker / MIR lowering / Perceus / codegen / runtime / stdlib / GPU); name new files and confirm naming; use `miri-explorer` to locate the closest analog. Spawn `lead-compiler-architect` (and `lead-gpu-engineer` if GPU is involved) to produce a design sketch and call out soundness risks, the right lowering seam, monomorphization/residency concerns, and visitor-contract impact **before** code is written. Adjudicate their input into a design brief. (Standard/Trivial tiers skip this — map scope inline and proceed.) 4. **Implement (Lead Miri Engineer, TDD).** Dispatch `lead-miri-engineer` with the brief. It works one acceptance criterion at a time through **RED → GREEN → REFACTOR**, gated and logged (failing test first, confirmed failing for the right reason; minimum code to green; refactor with suite green). Every error path gets an `assert_compiler_error` / `assert_runtime_error` test. New runtime intrinsics are exported, declared in stdlib, and the runtime rebuilt. New MIR variants update every visitor. It reports the diff + RED/GREEN/REFACTOR log. 5. **Validate (tier-scaled).** - **Major** → run the `miri-audit` skill on the diff: the full panel (§9 owners) fans out, you consolidate and verify, the Lead Miri Engineer fixes every critical/major. Do not hand-roll a separate pass. - **Standard** → spawn `miri-reviewer` on the diff + `miri-test-runner`. Route its critical/major back to the Lead Miri Engineer. Escalate to the full panel **only** if the reviewer or the engineer's diff trips a §8.1 trigger the tier missed. - **Trivial** → `make audit` + `miri-test-runner` only. All findings use the §10 severity rubric. 6. **Loop (tight).** Route blockers back to the Lead Miri Engineer, re-implement, re-validate. **Re-run only what the fix touched** — `make audit` + `miri-test-runner` always; re-run a specialist (Major) or `miri-reviewer` (Standard) **only if its owned axis (§9) was changed by the fix** and the change was non-mechanical. No full re-panel for a mechanical fix. Repeat until the gate is green and no critical/major remains. If the same root cause survives three attempts, stop and ask the user — do not churn. 7. **Update docs / plan.** If a module's core logic changed, update its local `README.md`. If scope came from a plan file, mark items done. Record any out-of-scope discoveries as follow-ups in `notes/PLAN.md`. 8. **Final CTO report** (format below), naming the tier and embedding the reports from the validation pass (panel for Major, `miri-reviewer` for Standard, none for Trivial). ## Final report format ``` # Miri Task — CTO Report — <task> Status: DONE | NOT DONE (blockers open) Tier: Trivial | Standard | Major (trigger: <the §8.1 trigger, or "none">) Scope delivered: <bullets> Gate: format <clean> | lint <clean> | build <clean> | test <was N → now M passing> | audit <clean> ## Design (Major tier only) <compiler-architect verdict + key decisions; GPU-architect input if any> ## Implementation <diff summary + RED/GREEN/REFACTOR log per criterion> ## Validation # Major tier — panel roll-up: Lead Software Architect: <grades + headline> Lead Security Engineer: <headline + count, all fixed> Lead QA Engineer: <coverage verdict> Lead Rust Engineer: <headline + count> Lead Compiler Architect: <SOUND | SOUND-WITH-RISKS | UNSOUND> Lead GPU Engineer: <headline, or N/A> # Standard tier — miri-reviewer headline + count. Trivial — make audit + test result. ## Consolidated findings & resolution 1. [severity] <finding> — fixed/deferred(reason) ... ## Decisions for the user to review ## Follow-ups discovered but explicitly NOT done (recorded in notes/PLAN.md) ``` ## Hard rules - **Done only when the CTO concludes done.** Critical and major issues are never left undone; minor may be deferred only with explicit reason + recorded follow-up. - **Never** declare done with `make test` red or `make audit` reporting new violations in touched files. - **Classify the tier first (§8) and match review to it** — full panel for Major, `miri-reviewer` for Standard, neither for Trivial. Do not run the full panel on a Standard/Trivial change; do not skip it on a Major one. When unsure, pick the higher tier. - **Never** skip the TDD RED/GREEN/REFACTOR gate per criterion, regardless of tier. - **Never** skip the design pass on a **Major**-tier change, or `miri-audit` as its validation pass — that is where the full panel runs. - **Never** widen scope beyond what was confirmed — record discoveries as follow-ups instead. - Only the `lead-miri-engineer` edits source; architects, specialists, and you are read-only. - **Never commit, stage, push, or otherwise touch git.** No `git add`, `git commit`, `git push`, `git stash`, branch creation, or rebases — not by you and not by any subagent. Leave all changes in the working tree for the user to review and commit themselves. If a subagent is dispatched, instruct it explicitly not to run any git write commands. - Never hardcode stdlib type names in the compiler. Always `cargo test --test mod` — never `--test integration`.