Can you see the feedback thing we have in Megaplan? And see where we have the flag for the prep stage, so I think it's like with prep or something like that. Can you also add a figure out what we need to do to add a dash with feedback step or flag that also adds a feedback step after the review process that like basically we just run this command and then fill out this thing. Can you just think and look through that for these next book?
Assistant
Yep, I have a full picture. Here's the lay of the land and what --with-feedback would take.
Existing pieces
Feedback module — megaplan/feedback.py
Defines feedback.md template with one section per stage (prep, plan, critique, revise, gate, tiebreaker, finalize, execute, review) plus Overall. Each section has rating: 0-10 and comment:.
Pure parser/scaffolder — user owns the file; megaplan never overwrites edits.
Read: _core/workflow.py:191 (_with_prep_from_state) and threaded through _workflow_for_robustness(..., with_prep=...) at workflow.py:221. When set, it re-installs the default STATE_INITIALIZED → prep transition that light/standard/tiny otherwise override away (workflow.py:235).
So: a one-liner state-config flag that surgically patches the workflow transition map.
What --with-feedback would need
Conceptually: add a feedback step between review and STATE_DONE, gated by the flag (forced on at any robustness, just like --with-prep forces prep onto light/standard/tiny).
CLI flag — add --with-feedback next to --with-prep at cli.py:1496 on the init subparser. Same shape.
Persistence — handlers/init.py:165 add a parallel if getattr(args, "with_feedback", False): state["config"]["with_feedback"] = True.
New terminal-ish state — types.py: add STATE_REVIEWED (current flow has STATE_EXECUTED -- review --> STATE_DONE at _core/workflow.py:75). With feedback we want:
STATE_EXECUTED -- review --> STATE_REVIEWED
STATE_REVIEWED -- feedback --> STATE_DONE
Workflow patch — _core/workflow.py:
Add _with_feedback_from_state (clone of _with_prep_from_state).
Thread with_feedback through _workflow_for_robustness (alongside with_prep).
When with_feedback is set, override STATE_EXECUTED → [Transition("review", STATE_REVIEWED)] and add STATE_REVIEWED: [Transition("feedback", STATE_DONE)].
Mirror for workflow_transition / workflow_next callers — they already pass state in, so no change there.
Light/tiny short-circuit — handlers/execute.py:150 currently force-jumps EXECUTED → DONE when review isn't in the workflow. Add an or workflow_includes_step(robustness, "feedback", with_feedback=...) check so light + --with-feedback doesn't skip feedback. Same for the review handler's STATE_DONE returns at handlers/review.py:223,250 — they should return STATE_REVIEWED when feedback is in the workflow.
Feedback handler — make it workflow-aware — handle_feedback (cli.py:1321) currently doesn't touch state. Two design choices for what happens when the auto driver dispatches megaplan feedback --plan <name>:
Block-on-editor (simple): scaffold, open $EDITOR, on exit parse + transition STATE_REVIEWED → STATE_DONE. Works fine for interactive megaplan auto, painful for non-interactive megaplan cloud.
Pause-for-human (cleaner): scaffold feedback.md, mark state as awaiting human, and have the auto driver halt with a feedback_pending outcome (mirror the STATE_TIEBREAKER_READY handling at auto.py:861). User runs megaplan feedback --plan <name> whenever, and the next invocation parses the filled file and transitions to DONE.
The pause-for-human path is the better fit given megaplan's other human-in-the-loop states, but it's more code. Worth deciding before implementing.
Auto driver — auto.py:_phase_command (line 312) already shlex-splits next_step, so "feedback" falls through naturally as ["feedback"]. The only addition is a halt branch for STATE_REVIEWED if we pick pause-for-human.
handlers/__init__.py + COMMAND_HANDLERS — already exports handle_feedback at cli.py:1967, so no new wiring needed beyond teaching the handler to accept the workflow path.
Recommendation
Pause-for-human variant: it matches the existing STATE_TIEBREAKER_READY precedent, doesn't fight non-interactive runners, and the workflow change stays surgical. Roughly: ~30 lines in workflow.py/types.py, ~10 lines in init.py + cli.py for the flag, ~30 lines in handle_feedback to branch on workflow mode + transition state, and ~10 lines in auto.py to add the feedback_pending outcome. Smallest open question is whether feedback should still run when execute fails/blocks — almost certainly no, only on a clean review→done path.
Want me to go implement that, or do you want to refine the design first?
User
um... Yeah, I think that makes sense but we shouldn't have a pause for human thing. It should just be part of the process that it works through automatically. Like there's no need for a human. can you look through the megaplan rubric to understand what we should actually do here to implement this end to end
User
Base directory for this skill: /Users/user_c042661f/.claude/skills/megaplan-rubric
Megaplan rubric — three questions, three dials
Every piece of work answered with three questions. Each question points at one dial. The dials are independent — work through each one ignoring the others — then weigh the three together holistically to land on a coherent judgment.
Question
Dial
What it scales
Flag
1
What level of raw capability does this need?
Intelligence tier
$/call
--profile
2
What level of process rigor does this need?
Planning complexity
# of calls
--robustness
3
How deeply does each model need to think?
Depth
tokens/call
--depth (with --phase-model as the surgical escape hatch)
The dials aren't a mechanical lookup; they're three lenses you apply to the same task, and the answers should fit each other. A high tier with low robustness is usually a mismatch; so is a low tier with max depth. When the three feel like they're pulling in opposite directions, the work probably needs to be split.
The dials measure residual complexity, not nominal scope. Two factors shape residual complexity, pointing in opposite directions:
Decisions already made decrease it. A brief where the major design decisions are resolved — architecture chosen, interfaces specified, edge cases enumerated, trade-offs decided — is less complex than the same scope arriving open-ended. The pre-resolved decisions don't disappear; they're paid for upstream by whoever wrote the brief.
Unknowns remaining increase it. Even when many decisions are locked, unresolved external API behavior, unmeasured performance characteristics, ambiguous integration targets, or libraries the team hasn't surveyed yet all add complexity the run has to budget for. (That's what --with-prep is built for — see below.)
When picking a tier, discount for decisions made and add for unknowns remaining. A spec-shaped brief with everything known lands a tier lower than the same nominal scope arriving as a sketch; a tightly-defined brief carrying significant unknowns may need either or a higher tier. — and is often the cheapest way to bring the rubric down a notch.
Assistant
OK, here's my call against the rubric.
Profile choice: thoughtful at default robustness/depth
Dial 1 — tier 3 thoughtful. This is cross-cutting code touching the workflow state machine (the kernel data structure — WORKFLOW, _ROBUSTNESS_OVERRIDES, the merge logic in _workflow_for_robustness), plus changes in cli.py + init handler + a workflow-aware rewrite of handle_feedback + auto-driver dispatch. Multiple files, real judgment calls — not pattern-stable enough for tier 1/2.
I considered led (tier 2) since the design is essentially "mirror --with-prep," and the plan is the hard part while the code follows. But two non-obvious bits make me want a premium critic + premium reviewer too:
The light/tiny robustness short-circuit in handlers/execute.py:150 (force-jumps EXECUTED → DONE when review isn't in the workflow) needs the same treatment for feedback, and that's easy to forget.
Reworking handle_feedback to be workflow-aware (currently it's purely interactive — scaffolds feedback.md + opens $EDITOR) is more nuanced than a straight with_prep port. The non-interactive auto-mode path needs to scaffold + parse + transition STATE_REVIEWED → STATE_DONE without blocking on a human, which is a new shape this handler doesn't have today.
Dial 2 — standard. State-machine surgery deserves the full loop (prep → plan → critique → gate → revise → finalize → execute → review). light would drop review, which I want here because review catches transition-table bugs and missed override branches.
Dial 3 — low (default). No novel design, no unfamiliar libraries, brief is tight (I just laid the whole plan out in the prior message). Don't pay for depth you don't need.
No --with-prep. Codebase is in-hand; no external APIs.
Shorthand:thoughtful
Command
bash
megaplan init <brief-file> --profile thoughtful
What the brief should say
Drop the analysis from my last message into the brief verbatim, with these tightenings now that you've nixed the pause-for-human variant:
CLI flag — --with-feedback on init parser, mirror of at .
User
do it
Assistant
Kicked off megaplan auto for with-feedback-flag at thoughtful/standard in the background. It'll run plan → critique → gate → revise → finalize → execute → review (8 phases, typically 30-60 min wall-clock at this profile). I'll get notified when it's done.
User
Assistant
Pre-existing failure (reproduces on clean main). Skipping past it.
Assistant
All three failures are pre-existing on clean main — not from this work.
Assistant
Done. Summary:
megaplan auto ran 8 phases (plan → critique → gate → finalize → execute → review) and reached terminal done in one pass — no rework cycles, review verdict was "Approved."
tests/test_with_feedback.py — 44 new tests, all pass
Sanity checks (live, post-run):
--with-feedback persists into state.json config block ✓
workflow_includes_step("feedback", with_feedback=True) is True at every robustness level (tiny → superrobust) and False when the flag is off ✓
Test suite: new tests pass (44/44). Three failures in the broader suite (test_checks, test_init_plan, test_schemas) reproduce on clean main — pre-existing, unrelated.
Nothing's been committed — the diff is sitting in the worktree for you to review.
User
push
Assistant
Pushed e7555135 to origin/main. Left the unrelated megaplan/profiles/all-deepseek-pro-direct.toml untracked since it predates this session.
User
And do we set which model does feedabck on the profiles?
Assistant
No — the feedback step doesn't call any model. It's pure mechanical scaffolding: read the template, atomic-write feedback.md, transition STATE_REVIEWED → STATE_DONE. No LLM call, no phase_model, no profile slot.
So nothing to set on profiles. Profiles assign models to reasoning/working phases (plan, prep, critique, revise, gate, finalize, execute, review) — those are the ones that invoke an agent. Feedback is in the same category as init or status: a local CLI op that just shuffles files and state.
If we ever wanted a model to summarize the run into the feedback.md template (e.g. pre-fill Overall with an auto-generated rationale the user can edit), then yes, feedback would become a phase with a profile slot. But the current design is "scaffold the empty template, let the user fill it in," which is correctly model-free.
User
But it should be like the critique phase, have we structured it differently?
Assistant
You're right — I built the wrong thing. Re-reading your "it should just be part of the process that it works through automatically" — I interpreted that as "don't block on human input" and made it pure scaffolding. But the natural read is "the model should do the feedback itself," same way critique fills out the critique JSON without a human.
What we should have built: a real phase that loads execution artifacts (plan, critique, gate, review, history), calls a model to rate each stage 0-10 with comments, writes the populated feedback.md, then transitions to DONE. User reads/edits/overrides afterward. That's a phase in the same family as critique and review — sense-check duty, plateaus at :low per the asymmetry principle.
If we go that route, the changes from what's already shipped:
Profile slots — every profile (basic, led, thoughtful, premium, super-premium, plus legacy detective profiles) gets a feedback = "..." entry. By the critique==review invariant logic, feedback is probably a third sister phase that should ride with the same critic mind (same model that critiqued + reviewed should be the one rating the run). So slot it as: kimi at basic/led, claude at thoughtful/premium, codex at super-premium — exactly mirroring review's column in the rubric table.
Prompt — new megaplan/prompts/feedback.py that builds a feedback prompt from the artifacts (plan_vN.md, critique_output.json, gate.json, review.json, history). Asks for structured JSON: per-stage rating + comment + overall.
Auto-driver dispatch — _phase_command becomes ["feedback", "workflow"] (already does this), but now the underlying worker call routes through the profile's feedback slot.
Tests — the existing 44 stay relevant for the workflow shape; need new tests for the prompt + worker dispatch path.
--critic flag — needs to extend to also rewrite the feedback slot (it currently overrides critique+review; should be critique+review+feedback to preserve the invariant).
Want me to do this as a follow-up PR? Profile is the same — thoughtful/standard//low. The work is largely additive over what already shipped: keep the state machine plumbing, swap the no-op handler for a real worker call, add the profile slots and prompt.
User
Think through what it shoold be like
Assistant
Walking through the design decisions, in order of how much they ripple.
What feedback is actually rating
Critique evaluates the plan (forward). Review evaluates the executed work against the plan (correctness). Feedback is the third axis: process quality in hindsight. Not "did the work come out OK" but "did this pipeline do a good job, or did it spin / waste tokens / miss things / over-engineer."
The audience is you tuning megaplan. Every feedback row is a data point flowing into rubric/profile tuning — the --min-rating / --max-rating search filters that already exist make this explicit. So the prompt has to push the model toward honest, calibrated ratings rather than the "looks good!" default. Errors of leniency cost more than errors of severity here.
Whose mind does feedback — the interesting decision
Three viable options, and the right answer isn't obvious:
A. Same mind as critique+review (extend the invariant). Clean per the existing phase table — feedback joins critique+review as a critic-family phase, scales the same way (Kimi → claude → codex across tiers). Problem: the critic is rating its own homework on the critique/review stages. Built-in conflict of interest.
B. Cross-vendor judge (intentionally different from critic). At tier 3, if critic is Claude, feedback is Codex. Bias-free but breaks the rubric's clean premium/cheap split and requires per-tier swap logic.
C. Fixed Kimi at every tier, regardless of profile. This is the one I'd actually argue for, even though it deviates from the existing column pattern. Reasoning:
Cross-tier comparability. If Kimi rates basic runs and Claude rates thoughtful runs, the ratings aren't comparable across profiles — which destroys the value of the corpus you're building. Same evaluator across every run = ratings are calibrated against the same yardstick.
Independence. Kimi never authored, critiqued, reviewed, or executed in any tier-2+ profile — so it has no stake in any phase's quality.
Cost discipline. Feedback runs on every --with-feedback plan. Scaling its cost with tier (premium feedback at tier 4) triples the spend on a phase whose job is "rate the retro."
Bias profile. Kimi is willing to call things mediocre — exactly what you want for honest scoring.
The override is --phase-model feedback=claude:low for power users who want premium retros. --critic kimi/cross does not apply to feedback (it's a different role).
User
let's do claude default please. The score should not e cost sensitive. Nah re: 3, do we not alraedy have a sfructure for the feedback command/ Like when we run it?
Assistant
Right — feedback.py already defines the schema: STAGES (the canonical stage list), _STAGE_BLURBS (per-stage description), StageFeedback(rating, comment), PlanFeedback(overall, stages). The AI just fills in exactly that. No new fields, no free-form paragraph — the comment: per stage IS where "what could be improved" lives. Question 3 dies cleanly.
So the locked design:
Model: Claude :low across every profile, fixed. Override via --phase-model feedback=.... Yes, this means tier-1 basic runs pay for one premium phase — accepting that for cross-tier rating comparability.
Schema: existing feedback.py schema, untouched. Model output is {"overall": {rating, comment}, "stages": {<stage>: {rating, comment}, ...}} matching PlanFeedback.to_dict().
Provenance: parallel ai_rating / ai_comment fields on StageFeedback. AI fills ai_*; user edits rating:/comment:; user fields win where present, fall back to AI fields. DB sync writes both.
Scoring: pure quality, not cost-aware. The prompt's scale anchors (10 = textbook, 6 = workable but real issues, 2 = actively harmful) describe output quality, not value-for-money. Total cost is in the digest as context for the model to see, but isn't weighted into the rating.
Stages rated: whatever's present in the workflow. Tiny + --with-feedback rates plan, finalize, execute, feedback (overall too). Light adds critique, revise. Standard adds prep (if --with-prep), gate, review. Stages that didn't run get no section.
Re-running: idempotent by default. --force overwrites only ai_*, never touches user fields.
That's the whole shape. Want me to implement it as a follow-up? Same profile — thoughtful/standard//low.
User
yes please
Assistant
Kicked off feedback-as-phase at thoughtful/standard in the background. Brief locks in: Claude :low for feedback fixed at every profile (no --vendor/--critic/--depth overrides), ai_* parallel fields for provenance, pure-quality scoring (no cost weighing), idempotent with --force for re-rate, never-sinks-the-plan on worker failure. I'll get notified when it finishes.
User
how's it going?
Assistant
Mid-execute, 7 of 9 tasks done, no blockers. State finalized with next: execute — auto is on a rework-loop cycle (execute → review → executed → execute again is normal here since the last review.json mtime was 22:39 and execute just dispatched a new batch). Spent $6.54 so far; expect another few dollars before review wraps. Will ping back when done.
User
now?
Assistant
Still chugging — execute worker (PID 90658) running, state still finalized/next=execute, 7/9 done since 22:39 (~30 min ago). That means review came back needs_rework once and bounced the plan back to execute. Normal at standard robustness; the rework cap is 3. Cost still $6.54 (last snapshot before the rework cycle started). I'll ping when it actually terminates.
User
Assistant
Done. Status: success on the feedback work, but the executor went off-script and added a chunk of unrelated tickets code that the reviewer rationalized away rather than rejecting.
The reviewer noted "Precheck diff-size flag is explained by unrelated pre-staged tickets work present in working tree" — but nothing was pre-staged; we pushed a clean tree. The audit caught it (Git status shows changed files not claimed by any task: megaplan/data/tickets_skill.md, megaplan/...) and the executor's deviation log on batch 6 shows it knew: "throwaway standalone e2e script was attempted but abandoned..." then somehow ended up adding tickets keyword-search instead.
Recommendation: revert the tickets-related files before committing the feedback work. The tickets changes might be useful as their own follow-up — but they need their own brief + review. Want me to:
Stash the tickets files (move them aside), commit + push the feedback work, then we look at the tickets changes separately?
Or just git checkout HEAD -- the tickets files (discard) and re-do them deliberately later?
Either way, this is also a real signal worth filing as a megaplan ticket — the gate/review didn't catch fabricated rationale for unclaimed file changes. That's the kind of thing that should fail the gate, not get rubber-stamped.
User
keep them!!!
Assistant
There's a bigger problem than scope drift. The handler was never actually rewritten. The prompt module exists but is never called.
Assistant
Peter — I have to flag this before committing. The reviewer claimed "handler with --force merge and failure resilience" but the actual handle_feedback workflow branch (cli.py:1404-1430) is still the old no-op scaffolder from the previous PR. The prompt module exists, the schema extensions exist, the profile slots exist — but the worker never gets called. 8 of the new tests assert behavior the handler doesn't implement.
I already fixed 4 (filter + display fallbacks to ai_rating/ai_comment — small one-liners the brief called out that were also missed). 8 remain, all rooted in the missing handler implementation.
Three paths:
Commit/push what's here + write the handler myself next (call it a one-step follow-up; ~100 lines mirroring how handle_critique dispatches _run_worker, parses JSON, merges into PlanFeedback, renders prefilled template). Probably 20-30 min of careful work, no megaplan.
Commit/push what's here + re-run megaplan with a tight surgical brief ("write the handler, here's the exact shape, here are the failing tests"). More expensive but uses the harness for what it's good at.
Revert this run entirely and re-do with a stricter brief / higher tier / explicit "the handler IS the deliverable" framing.
I'd lean 1 — the infrastructure is real and useful, the handler is mechanical once you've seen how critique/review do it, and we don't need megaplan for a 100-line patch with failing tests already telling you the shape. Want me to do that?
User
so what is 1?
Assistant
Option 1 = me, right now, in this session, hand-writing the missing handler. Concretely:
Commit + push what's currently in the working tree as-is — the scope-drifted megaplan output, plus the two small fixes I already made (_filter_feedback_rows and _render_feedback_table falling back to ai_rating/ai_comment). That ships the schema, prompt module, profile slots, and tickets work.
Then I write the handler myself — replace cli.py:1404-1430 (the no-op scaffolder) with a real implementation:
Build prompt via build_feedback_prompt(plan_dir, state) (already exists in megaplan/prompts/feedback.py)
Dispatch worker via _run_worker (same pattern as handle_critique at megaplan/handlers/critique.py:76)
Parse JSON response into a PlanFeedback (extending parse_feedback or just walking the dict)
Read existing feedback.md if present, merge: AI fields overwrite, user fields preserved
Render via render_template(name, idea=..., prefilled=merged_fb), atomic write
Add --force flag to the feedback subparser
Add "(AI)" suffix in _render_feedback_table when only ai_rating is set
Transition to STATE_DONE, return {"ai_filled": bool, ...}
On worker exception / parse failure: fall through to empty-template scaffold + warning log, still transition to DONE (the "feedback never sinks a done plan" invariant)
Run the failing tests until they pass, then commit + push that as a follow-up.
Estimate: ~100 lines of handler code + maybe 5 lines of subparser. The 8 failing tests already describe the exact response shape, so they're the spec. No new design decisions.
Two commits, not one — partial-from-megaplan first, then the surgical fix. Want me to go?
User
do it and then push
Assistant
The tickets work was already shipped on origin in d283c603 — Peter's other session got there in parallel. After fetch/rebase, our diff is just the feedback-as-phase work. Even cleaner.
Assistant
Pushed b899e50a. Now the handler.
Assistant
Now I'll wire build_feedback_prompt into the prompt builders and write the handler.
Assistant
Now check what feedback model resolves to and what worker mode it lands in.
Assistant
Now I'll write the handler. First check what's imported at the top of cli.py:
Assistant
Now replace the workflow branch:
Assistant
Now add the helper functions and the --force flag. Find where to put helpers:
Assistant
Now add --force to the subparser and update the table renderer for "(AI)":
Assistant
Now update the table renderer for the "(AI)" suffix:
Assistant
Now run the failing tests:
Assistant
All 111 pass. Run the broader suite:
Assistant
Full suite passes (1575). Now sanity-check the live wire — does the worker prompt builder resolve?
Assistant
Two commits pushed:
b899e50a — infrastructure: schema (ai_rating/ai_comment), prompt module, profile slots on all 18 profiles, filter/display fallbacks, 67 new tests. (From the megaplan run, plus my two small fixes.)
1d687321 — the missing handler: real _run_worker("feedback", ...) dispatch, JSON parse, user-vs-AI merge, --force flag, never-sinks-the-plan exception handling, prompt builder wired into the three builder dicts, "(AI)" suffix on the table renderer.
All 12 previously-failing tests pass. Full suite: 1575/1575 (minus the 3 pre-existing failures on main).
megaplan init --with-feedback --profile thoughtful <idea> followed by megaplan auto should now produce a feedback.md with Claude-rated ai_rating / ai_comment per stage at end-of-run. User edits to rating:/comment: win; AI ratings are preserved as provenance.
--with-prep
Tightening the brief beats picking a higher tier
Defaults to keep in mind:--robustness standard, --depth unset (which means the profile's existing depths win — usually :low on premium phases), vendor from your config (claude if unset). Reach past those only when you can name the specific reason.
Dial 1 — Intelligence tier (5 rungs)
"What level of raw capability does this need?"
Five tiers, named so the name itself is the proxy. Each rung swaps one block of phases from cheap (DeepSeek / Kimi) to premium (Claude / Codex). The progression is monotonic — once a phase upgrades, it stays upgraded.
When to pick each tier
Tier
Profile
Picks for
Rough cost (light)
1
basic
Discovery, docs, and most routine programming: small features in well-known patterns, schema migrations, ports of self-contained code, utility scripts, config changes, mechanical refactors, CRUD over an existing schema, glue code between known surfaces, test fixtures, anything where the patterns are stable and the number of overlapping concerns is small. The instinct to reach for tier 3 the moment "code" appears is usually wrong.
~.50-2
2
led
Same shape as basic, but a premium model writes the plan. Use when the planning is the hard part — the implementation is mechanical once mapped out, but you need real thinking to get the map right: complex schema migrations where step ordering matters, multi-step refactors where the sequence needs care, features whose architecture demands deliberation but whose code follows patterns, greenfield implementations with non-trivial design but well-shaped pieces. The cheap models execute confidently once the premium plan exists. Use when you'd say "I just need a smart plan; the rest is following instructions."
~-3
3
thoughtful
Novel implementation, cross-cutting code, judgment calls, multi-system features: a new CLI command with cross-cutting concerns, an inbox or routing rewrite, adapters with non-trivial edge cases, plan-mutation verbs touching shared state, export/import surfaces with format edge cases, novel features in a known architecture, refactors with real cross-system implications. Premium handles every reasoning phase (plan, critique, revise, review); DeepSeek handles mechanical phases (prep, gate, finalize, execute). This is the default for real engineering work — but only when the work is genuinely novel or cross-cutting. If the patterns are stable and the variables are few, drop back to basic or led.
~-15
4
premium
Single-vendor premium end-to-end. Use for production-critical work where you want one model's judgment on every phase (including execution) and a clean single-vendor audit trail: schema definitions, wire formats, security-critical code paths, public API contracts, migration logic running against production data, kernel-invariant changes (data structures everything else depends on). Pair with --robustness robust for the most complex of these. Pick --vendor claude or --vendor codex by preference, credits, or prior fit — they're treated as interchangeable.
~-70
5
super-premium
Apex — both Claude and Codex contributing to the same job. This is the one tier where the two premium models stop being interchangeable — Claude and Codex have different strengths (Opus on author/repo-reading side, Codex on critique/structural-analysis side), and the value of this tier comes from combining them. Reach for it when one premium model's depth isn't enough and you want two minds working together: concurrency primitives that cascade (locks, locked event-append, writer epochs, session schemas), schemas all later sprints will build on, wire formats / claim semantics / parent-child propagation rules, multi-system migration decisions, big architectural choices where downstream sprints all depend on what you decide here. Trigger conditions: (1) high-stakes — regression = production incident or worse — or(2) the sprint is making a big architectural decision, not just implementing one already made. If neither applies, drop to tier 4.
~-50
Which model handles each phase
Phase
basic
led
thoughtful
premium
super-premium
plan
DeepSeek
claude
claude
claude
claude
prep
DeepSeek
DeepSeek
DeepSeek
claude
claude
critique
Kimi
Kimi
claude
claude
codex
revise
DeepSeek
DeepSeek
claude
claude
claude
gate
DeepSeek
DeepSeek
DeepSeek
claude
claude
finalize
DeepSeek
DeepSeek
DeepSeek
claude
claude
execute
DeepSeek
DeepSeek
DeepSeek
claude
codex
review
Kimi
Kimi
claude
claude
codex
Legend:
DeepSeek = DeepSeek V4 Pro (open-source workhorse; competent, structured, cheap).
Kimi = Kimi K2 (Fireworks-hosted kimi-k2p6; open-source critic; creative, good at spotting issues).
claude = Claude Opus 4.7. codex = Codex GPT-5.5.
Two things to notice in the phase table:
Each tier adds exactly one block of phases to premium, and once upgraded, a phase stays upgraded:
Tier 2 adds plan (one phase).
Tier 3 adds critique + revise + review (the rest of the reasoning loop).
Tier 5 doesn't add new premium coverage; it splits the existing premium roles across two vendors.
The two open-source models exit in order as you climb. Kimi exits at tier 3 (sense-check phases get premium). DeepSeek exits at tier 4 (everything else gets premium). At tier 5 the question stops being "premium vs cheap" and becomes "which premium for which role."
Vendor: Claude and Codex are interchangeable at tiers 2-4
Claude and Codex are treated as systematically interchangeable at tiers 2-4 — by policy, not just by observation. The marginal quality difference between them on a given task is small relative to picking the wrong tier or robustness; encoding per-task vendor preferences would add a dial that doesn't earn its keep. Pick a preferred vendor once (--vendor, or [defaults].vendor in config) and the preference flows through every tier-2-through-4 profile.
Tier 5 is the exception — its whole rationale is using both vendors' different strengths together. --vendor is silently ignored there. The phase table above shows the claude variant for tiers 2-4; for the codex variant, swap claude↔codex throughout.
Dial 2 — Planning complexity
"What level of process rigor does this need?"
The --robustness flag. Picks how many phases run and how many critique passes happen.
Setting
Workflow
When to use
(skip megaplan)
—
Single-file fix, anything you can hold in your head. Just do the work directly — or delegate to a subagent if the work is too big to hold in context but doesn't need any harness rigor.
tiny
plan → finalize → execute (no prep, no critique, no gate, no review)
Crisp, well-scoped task where you mostly just want the planner to lay out the steps before the executor runs. No second opinion, no post-mortem. 3 phases. Strictly cheaper than light. Reach for it when the brief is unambiguous and the work is mechanical enough that critique would be a no-op.
light
plan → critique → revise → finalize → execute (no prep, no gate, no review)
Small/scoped, well-known feature, low blast radius — but you want one sense-check pass on the plan before committing. ~5 phases instead of 8.
Cross-cutting, unfamiliar code, ambiguous brief. Fine for almost everything.
robust
Same shape as standard, 8 critique checks + parallel critique
Security, data migration, public API contract — anything where a regression = production incident. Extremely rare. You should be able to name the specific stakes that warrant it.
superrobust
robust + parallel review
Both deep critique and concurrent review matter. Vanishingly rare. Only when the user specifically asks for it.
standard is home base. light is a cost optimization for cleanly-scoped work that still wants a sense-check. tiny is for when even one critique pass is overkill — you're paying for the planner-then-executor split and nothing else. robust should feel exceptional — you're saying "this regression would page someone." superrobust is a user-requested override, never a default.
Where tiny slots in: between "skip megaplan" and light. Skip megaplan when you can do it inline or hand it to a subagent. Pick tiny when the work is multi-step enough to deserve a written plan + an executor pass, but the plan doesn't need a critic. Pick light when you want one critique pass on the plan before execution. The hops are real — don't reach past tiny reflexively.
Cost bands in the tier table above are at light. Roughly 1.5-2× the per-phase cost going from light → standard, and another ~1.3× going to robust.
Dial 3 — Depth
"How deeply does each model need to think within the tier I picked?"
Picks the thinking strength of the premium model(s) the tier brought in. Independent of tier and robustness — orthogonal lever. Spelled out in the agent spec after a colon (claude:low, codex:medium, etc.).
Pattern
When to use
low planner / low critic
The default. The pattern is mechanical, intuition is enough, the codebase is well-known. A lot of work lands here even at tier 3 — premium models at low thinking are still substantially smarter than the cheap tier, so the upgrade isn't free but doesn't need to be expensive either.
medium planner / low critic
Brief is clear but the work has real judgment calls. The plan needs deliberation beyond intuition; the critic still doesn't.
high planner / low critic
Brief is long OR codebase is unfamiliar. The planner needs substantial repo-reading and structural reasoning.
xhigh / max planner only
Genuinely novel architectural decision. Use sparingly — most "hard" plans don't actually need this.
Available strengths: Claude is low / medium / high / xhigh / max; Codex is minimal / low / medium / high.
The asymmetry principle: author phases (plan, revise) can scale all the way up to max when the work demands deliberation; sense-check phases (critique, gate, review) plateau at low regardless of stakes. A claude:high planner + claude:low critic is the right shape when the plan needs real thinking — not claude:medium everywhere.
Default to low; only spend on depth when you can name the specific reason the planner needs to deliberate. "Just in case" doesn't earn the cost.
When to add a prep phase
"Does the planner need to do explicit research before it can commit to a plan?"
A fourth, narrower lever orthogonal to the three dials. prep is a visible research phase that runs beforeplan — the planner explicitly reads external docs, surveys an unfamiliar library, maps an API surface, or disambiguates a vague brief. Off by default (most work doesn't need a discovery step; adding one without need just costs tokens and wall-clock). Enable with --with-prep.
Reach for it when at least one of these is true:
External APIs whose semantics aren't already known — the planner has to read API docs before deciding what calls to make.
Unfamiliar libraries or frameworks — codebase patterns aren't enough; the planner needs to survey the library's API surface first.
Research-heavy briefs — the work is research-bounded ("figure out how X behaves, then implement").
Ambiguous or under-specified requirements — the planner needs a budget to disambiguate explicitly instead of interleaving with planning.
Integration work where target-system behavior must be discovered — wire formats, error semantics, performance characteristics undocumented in the codebase.
"Prep just in case" doesn't earn its cost. Redundant at robust and superrobust (those already include prep); the flag's value is at light and standard, where prep is normally skipped.
Notation for recording profile choices
For sprint notes, brief headers, commit messages, or anywhere you need to write down a profile choice compactly, use the slash form: profile/robustness/depth — defaults can be omitted.
Order is fixed left-to-right: tier → robustness → depth, matching dial numbers 1 → 2 → 3. The // reads as "skip the middle slot — defaults there."
Spine examples (just the three dials)
What you decided
Shorthand
Tier-1 work at default robustness and depth
basic
Tier-1 work at light robustness
basic/light
Tier-2 work at defaults
led
Tier-3 work at defaults
thoughtful
Tier-3 work with depth bumped to high (default robustness)
thoughtful//high
Tier-3 work with medium depth (default robustness)
thoughtful//medium
Tier-4 work at robust + high depth
premium/robust/high
Apex sprint, robust + high depth
super-premium/robust/high
With modifiers (secondary flags)
For --vendor, --critic, --with-prep, append modifiers without disturbing the spine. The conventions:
Brief headers ([premium/robust/high] as the first line of a brief)
Commit messages ("ran as thoughtful, defaults")
Slack / chat references when describing a sprint setup at a glance
The actual invocation is still megaplan init --profile … --robustness … --depth … — see "Running it" below for the mapping.
Running it — profile plus the knobs
The invocation has three layers: three flags for the dials, three modifiers for orthogonal toggles, one escape hatch for surgical needs.
The three dial flags
--profile — the tier name (basic, led, thoughtful, premium, super-premium).
--robustness light|standard|robust|superrobust — standard is home base.
--depth low|medium|high|xhigh|max — rewrites the effort suffix on author-side claude/codex slots (plan, revise, loop_plan, tiebreaker_*) at the resolved vendor. Critic + mechanical phases plateau at their existing depth (the asymmetry principle). Defaults to whatever the profile sets (usually :low). Honored on vendor-locked profiles. Codex caps at high; Claude adds xhigh and max.
The three modifier flags
--vendor claude|codex — vendor override at tiers 2-4. Defaults to [defaults].vendor in ~/.config/megaplan/config.toml (or claude if unset). Tier 1 ignores it (no premium phases); tier 5 silently ignores it (vendor-locked).
--critic kimi|cross — overrides the critique+review pair (preserving the invariant — see below). kimi swaps in Kimi for both phases; cross swaps to the other premium vendor relative to --vendor. Silently ignored at tier 5.
--with-prep — force the prep research phase into the workflow regardless of --robustness. Off by default; no-op at robust/superrobust. See "When to add a prep phase" above.
The escape hatch
--phase-model phase=spec, repeatable. For when --depth is too coarse — e.g. bump just critique without touching the rest. Most runs don't need it.
Where the flags live
--vendor, --depth, and --critic are wired on every subcommand that accepts --profile:
megaplan tiebreaker run and the bare megaplan tiebreaker default-run action
Mid-flight overrides
For when the work turns out different than expected:
megaplan override set-profile --profile NAME --plan ID — swap tier mid-run. Started on thoughtful, hit something gnarlier, escalate to premium for the remainder.
megaplan override set-robustness --robustness LEVEL --plan ID — same for the planning-complexity dial.
megaplan override replan --plan ID — back up to planning and redo with whatever models / robustness are now active.
If a run is struggling, escalate mid-flight rather than letting it grind. Common signals: the plan keeps missing concerns the critique surfaces; revise doesn't actually resolve the critique's flags; the executor produces work the review can't accept; iteration cycles through the same defects without converging. Don't sit through a degenerate run — override set-profile to the next tier up (or bump --robustness), and let the remainder benefit from the better setup. One wasted phase costs much less than restarting the sprint. The same applies to depth: if the planner is clearly under-deliberating, override with a higher --depth rather than accepting a thin plan.
Lean on these instead of inventing new profile names. If you find yourself thinking "I want a profile that's likethoughtful but with X" — the answer is almost always thoughtful plus an override, not a new profile.
The critique == review invariant
The model that critiques the plan also reviews the executed work — same mind pre-execution and post-execution. Wiring them to the same non-author model gives you one coherent second mind across both checkpoints and keeps the author's blindspots out of the sense-check loop.
--critic bundles the two phases in one flag and preserves the invariant. Bare --phase-model does not — if you override critique with --phase-model, override review the same way, or use --critic instead.
Worked invocations
"Schema migration where step ordering is intricate but each step is mechanical. Prefer codex; brief is clear so default depth is fine."megaplan init <brief> --profile led --vendor codex
"Novel feature, cross-cutting, brief is long, codebase is unfamiliar."megaplan init <brief> --profile thoughtful --depth high(vendor defaults from config; depth lifts plan + revise + loop_plan + tiebreaker_ to claude:high; critic + mechanical stay at their defaults)*
"Novel feature involving an external API we haven't used before. Planner needs to read the API docs before committing."megaplan init <brief> --profile thoughtful --with-prep --depth medium(adds the visible prep phase even at standard robustness, so the planner can survey the API surface before producing a plan)
"Cross-cutting feature, tier 3, but I want Kimi catching what the premium author missed (legacy spade-claude behaviour)."megaplan init <brief> --profile thoughtful --critic kimi
"Migration logic against production data. I want kimi critiquing this even though it's tier 4."megaplan init <brief> --profile premium --robustness robust --depth high --critic kimi
"Schema everyone downstream will build on. Apex tier."megaplan init <brief> --profile super-premium --robustness robust --depth high
"Tier-3 work, brief is clear, but I want the critic to deliberate a little more — the planner can stay at the profile default."megaplan init <brief> --profile thoughtful --phase-model critique=claude:medium --phase-model review=claude:medium(surgical: bump just one pair, leave plan + revise at the profile's :low. The kind of override --depth can't express because it's by-phase-name, not by-author-vs-critic.)
"Verification sprint, mostly text, lowest-stakes thing in the queue."megaplan init <brief> --profile basic --robustness light
Three pieces of intent → three flags (--profile, --robustness, --depth), plus --vendor / --critic / --with-prep when you need them.
The canonical catalog
Five tier names + two flags cover the whole rubric. A handful of legacy aliases are preserved for back-compat.
Canonical (use these)
Profile
Tier
Where it sits
basic
1
All cheap; Kimi critiques+reviews.
led
2
Premium plan only; everything else cheap.
thoughtful
3
Premium reasoning loop; DeepSeek mechanical. The default for real engineering.
premium
4
Single-vendor premium end-to-end at :low depth. Pick the vendor with --vendor.
super-premium
5
Vendor-locked Claude/Codex split. The apex; --vendor and --critic are silently ignored.
Vendor, depth, and critic flavor are flags on these, not separate profiles: --vendor claude|codex at tiers 2-4, --depth low|medium|high|xhigh|max to set author-phase thinking depth, --critic kimi|cross to override the critique+review pair.
Legacy aliases (still loaded; modern equivalent listed)
Profile
What it is
Modern equivalent
nancy
Nancy Drew — DeepSeek lead + executor, codex:medium prep/critique/gate/review. Cheapest profile with a premium critic.
Closest is led --critic cross (Codex critic over a Claude/Codex-planned base), but the recipe doesn't have a 1:1 mapping. Keep using nancy if scripts rely on it.
marlowe
Legacy claude:low author with Kimi critic + Claude-on-review. Predates the critique == review invariant.
thoughtful --critic kimi is the spiritual successor, but it routes review through Kimi (honoring the invariant) instead of Claude. Use marlowe if you specifically want Claude doing the post-execute review.
holmes
Legacy medium-effort with a cross-model gate (codex:medium gate/review alongside claude:medium plan/revise).
No exact match — the rubric doesn't carve out cross-model gate behaviour. Closest is thoughtful --critic cross --phase-model plan=claude:medium --phase-model revise=claude:medium. Keep using holmes if cross-model gate is the point.
marlowe-claude / marlowe-codex
Low-effort cluster: claude (or codex) author, other premium critic.
thoughtful --critic cross (--vendor claude or codex picks the author).
spade-claude / spade-codex
Low-effort cluster: claude (or codex) author, Kimi critic.
thoughtful --critic kimi --vendor claude|codex.
holmes-claude / holmes-codex
Medium-effort cluster: claude (or codex) author at :medium, other premium critic.
Use directly when you specifically want DeepSeek-only — they're below tier 1 on the rubric ladder.
all-open
Kimi author + GLM-5.1 critic/executor. Fully-open analogue of super-premium.
Use directly when you want open-source apex; no rubric-tier equivalent.
Project- and user-level overrides
Built-in profiles live in megaplan/profiles/ and ship with the package. To customize:
Per-user: ~/.config/megaplan/profiles.toml.
Per-project: <project>/.megaplan/profiles.toml.
Project overrides win over user overrides win over built-ins. The TOML schema is [profiles.<name>] with one key per phase (plus optional vendor_locked = true).
Config defaults
The --vendor flag honors a per-user config default. Write ~/.config/megaplan/config.toml:
toml
[defaults]
vendor = "claude" # "claude" or "codex"
Set this once on a new machine and tiers 2-4 default to your preferred premium without per-invocation flags. The CLI flag still wins when passed.
A malformed or missing config falls back to claude silently.
Migration notes
The rubric's canonical catalog supersedes the old detective grid. Existing scripts keep working (every legacy name still resolves), but a few sharp edges are worth flagging.
super-premium and poirot are vendor-locked
Both profiles set vendor_locked = true. --vendor and --critic are silently ignored on vendor-locked profiles — the locked profile's existing model assignments win, with no error or warning. The loader treats those flags as no-ops rather than failures.
--depthis honored on vendor-locked profiles (depth is about how hard each model thinks, not which vendor is filling the slot). --phase-model also still works as the surgical escape hatch when you need finer control than --depth can give.
premium ≠ all-claude
This is the trap. all-claude uses bare claude for every phase, which means default effort in the agent spec parser. premium --vendor claude uses claude:low for every phase. The two are not interchangeable on cost or output — :low is meaningfully cheaper and shallower than default effort.
Scripts pinned to all-claude / all-codex keep their existing behaviour. No change required.
Users picking the rubric default at tier 4 should reach for --profile premium and (if needed) bump depth explicitly via --depth high (or --phase-model plan=claude:high for surgical control). That matches the rubric's "premium at :low is the right floor" principle.
--critic cross at tier 1 is a footgun
The flag accepts the combination, but it doesn't make rubric sense — there's no premium author for the cross-vendor critic to be cross-vendor to. The tier-1 profile has no premium model at all; "cross of nothing" is undefined.
If you want a premium critic at tier 1, step up to led --critic cross (which actually has a premium author to be cross-vendor relative to) or thoughtful --critic kimi (the closest cheap-pipeline-with-premium-critique shape).
Legacy detective-cluster scripts
Scripts using marlowe-*, spade-*, holmes-*, watson-* keep working — the profiles ship unchanged. There's no rush to migrate. New work should prefer thoughtful plus --vendor / --critic / --phase-model; the legacy names are kept because they have known cost/quality data from prior runs.
Kimi spec migrated to Fireworks kimi-k2p6
The canonical Kimi spec changed from hermes:moonshotai/kimi-k2.6 (OpenRouter-routed) to hermes:fireworks:accounts/fireworks/models/kimi-k2p6 (Fireworks-direct). Every built-in profile that used Kimi (basic, led, marlowe, holmes, the spade-* / watson-* clusters, all-open) has been updated; --critic kimi now writes the new spec via KIMI_SPEC.
Scripts that don't pin the spec keep working without changes — the rewrite is internal.
Scripts that pin the old spec via --phase-model critique=hermes:moonshotai/kimi-k2.6 still parse and run as strings, but they'll be calling a model that may no longer be available on OpenRouter. Replace the pinned spec with hermes:fireworks:accounts/fireworks/models/kimi-k2p6, or — usually cleaner — drop the --phase-model pin in favor of --critic kimi, which always tracks the canonical Kimi spec.
DeepSeek spec migrated to Fireworks deepseek-v4-pro
The canonical DeepSeek spec changed from hermes:deepseek/deepseek-v4-pro (DeepSeek's direct API via OpenRouter) and hermes:deepseek:deepseek-v4-pro (direct-provider form) to hermes:fireworks:accounts/fireworks/models/deepseek-v4-pro (Fireworks-direct). Every built-in profile that used DeepSeek (basic, led, thoughtful, marlowe, holmes, nancy, the detective cluster, all-deepseek-pro) has been updated.
Scripts that don't pin the spec keep working without changes — the rewrite is internal.
Scripts that pin the old spec via --phase-model still parse and run as strings; they'll route via the previous provider as long as those routes remain configured. Migrate the pinned spec to hermes:fireworks:accounts/fireworks/models/deepseek-v4-pro to match the new canonical routing.
Skill installation
This doc doubles as the SKILL.md body for the megaplan-rubric skill. Wire it up so Claude Code and Codex consult it automatically:
bash
DOC="$(pwd)/docs/megaplan-rubric.md" # run from the megaplan repo root
# Claude Code skill
mkdir -p ~/.claude/skills/megaplan-rubric
ln -sf "$DOC" ~/.claude/skills/megaplan-rubric/SKILL.md
# Codex skill
mkdir -p ~/.codex/skills/megaplan-rubric
ln -sf "$DOC" ~/.codex/skills/megaplan-rubric/SKILL.md
Restart Claude Code / Codex after symlinking. Edits to this file propagate to both skills. Multiple people on a team each run the same commands against their own checkout — never share a symlink to someone else's path.
Operating principles
The brief is the dominant variable. Brief-interpretation defects (duplicate paths, fabricated decisions, brief-violating renames) show up across every profile. Tightening the brief beats picking a better profile. If you only invest in one thing, invest in the brief.
Where the premium model goes matters more than how many premium models you use. Concentrating the premium model in author-side phases (plan, revise) gives the biggest cost-quality win. DeepSeek as the executor is fine — premium there is overkill.
Size each megaplan to ~2 weeks max. A megaplan should fit a sprint — roughly two weeks of human work, give or take (i.e. how long the same scope would take a human engineer to plan, build, and review, not wall-clock time for the run itself). Larger scopes don't survive the brief-to-execution distance; the plan drifts, the critique loses focus, the review can't hold the whole shape in one pass. If you're scoping work that genuinely needs a month, split it into 2–3 sprints with explicit handoffs (each its own brief, its own profile, its own retro).
One profile per sprint. Within that ~2-week window, pick the profile that matches the highest-stakes deliverable in the sprint; lower-stakes items inherit the tier. Operational simplicity beats the savings from splitting. Only split when the lower-stakes work is substantial (multiple days) and independent. Structure the plan so cheap work lives in cheap sprints, not interleaved inside expensive ones.
Bake-off is opt-in. Default to a single profile. Only run a multi-arm bake-off when (a) the user asks, (b) three or more mixes are genuinely plausible, (c) the deliverable is a diff worth comparing, and (d) per-arm cost is well below the cost of guessing wrong. Don't bake off discovery / scoping / contract-freeze sprints — no diff to compare.
Anti-patterns:
"Always use Claude." Wrong. Codex on prep/critique/gate steers DeepSeek planners well and is the cheapest viable premium-critic profile.
"Higher thinking strength always helps." Wrong. Strength plateaus on sense-check duty; spend it on author-side phases only.
"Profile choice dominates outcome." Mostly wrong. Brief quality dominates. If three profiles all produce brief-interpretation defects, fix the brief.
Calibration caveats
Tier 2 (led) is a design point, not a measured one. "Premium plan only, everything else cheap" is theoretically clean (concentrate spend where it pays off most) but hasn't been bake-off validated against tier 1 or tier 3 on intermediate-complexity work. Reach for it when the shape fits, but treat it as a hypothesis until we have runs to compare. If led consistently underperforms thoughtful on real work, the right answer may be to drop it and accept that there's no intermediate tier.
Cost bands for tiers 1-2 are projections, not runs. Tiers 3-5 have prior-run data behind their numbers; tiers 1-2 are estimates based on the model mix.
--with-prep
cli.py:1496
Persistence — handlers/init.py:165 — add the parallel state["config"]["with_feedback"] = True.
New state STATE_REVIEWED in types.py. Workflow becomes STATE_EXECUTED -- review --> STATE_REVIEWED -- feedback --> STATE_DONE when with_feedback is set.
Workflow patch in _core/workflow.py — add _with_feedback_from_state, thread with_feedback through _workflow_for_robustness, override the EXECUTED transition + add the REVIEWED transition when set. Mirror the --with-prep trick that re-installs the default transition over the light/standard/tiny overrides.
Light/tiny short-circuit — handlers/execute.py:150 — extend the workflow_includes_step(..., "review", ...) check to also account for feedback. Same for handlers/review.py:223,250 — return STATE_REVIEWED instead of STATE_DONE when feedback is in the workflow.
handle_feedback workflow mode — when invoked by the auto driver (state == STATE_REVIEWED):
Scaffold feedback.md if missing (existing behavior).
Do not open $EDITOR, do not block. Just write the template, transition STATE_REVIEWED → STATE_DONE, and return. The user fills in feedback.md whenever they want; if they leave it blank, the plan is still done.
Existing feedback edit/show/search operations stay interactive — only the workflow-mode dispatch (no operation arg, called from auto) goes non-interactive.
Auto driver — auto.py:_phase_command already falls through for unknown steps via shlex.split, so feedback runs as megaplan feedback --plan <name> automatically. Just need to confirm the handler's default operation is workflow-safe in that path.
Tests — add a workflow test that asserts --with-feedback adds the REVIEWED state at every robustness level (including tiny/light), and an end-to-end test that auto reaches DONE through the feedback step without prompting.
Want me to write the brief file and kick off megaplan init --profile thoughtful?
I think we should go C. Worth pushing back on if you see a different angle.
Output shape — preserve provenance
The template needs to distinguish AI ratings from your overrides, because "Peter calibrated this at 6" and "the model thinks it's 6" are different signals for tuning:
markdown
## execute <!-- Implementation by the executor -->
ai_rating: 7
ai_comment: Followed the plan closely; added one helper class not in the
plan (T4 batch). Light over-engineering.
rating:
comment:
When rating: is filled, it wins. When blank, ai_rating is canonical. The feedback.py parser needs a second pair of fields; PlanFeedback grows ai_overall + ai_stages parallel to the existing ones. DB sync writes both.
render_template extends to accept pre-filled values from a PlanFeedback dict so the worker output can be dropped straight in.
What the feedback worker actually sees
The model gets per-stage digests, not raw artifacts (raw plan_v3.md + execution_batch_5.json would blow the context budget). The handler builds the digest from:
state.json → robustness, profile, total cost, history (per-phase durations)
plan_v*.md → plan summary + iteration count
critique_output.json → flag count, types of issues raised
Each digest is a paragraph or two. Total prompt budget probably ~10-20K tokens — well within Kimi's window.
Prompt orientation
The rating scale needs to be explicit and anchored, or you get noise:
10: textbook; no notes.
8: solid; minor polish.
6: workable but with real issues — wasted iterations, missed flags, over/under-engineering.
4: degraded; the phase didn't do its job, downstream compensated.
2: actively harmful.
And the framing has to be "be honest, lean toward severity, this feeds back into rubric tuning" — not "rate this run."
Edge cases to nail down
Failed/aborted runs. Feedback should still run after a needs_rework-then-force-proceeded run (rate the failure honestly). Shouldn't run on aborted/blocked — those didn't get a fair shot. Maybe also skip on escalated to human? Inclined to say feedback runs on any done outcome regardless of how we got there.
Light/tiny with --with-feedback. Stages that didn't run (critique at tiny, review at light) just don't get rated. Template already handles this — only present-in-workflow stages get sections.
Re-running feedback. Idempotent by default (skip if feedback.md exists). megaplan feedback workflow --force overwrites the ai_* fields only, never touches user-edited rating:/comment: fields. This matters when you tweak a profile and want to re-rate old runs from the same artifacts.
feedback.md already filled out by user before workflow ran. Pathological but possible. Just don't overwrite — if user touched rating: for any stage, leave that stage alone; fill in ai_* for the rest.
Open questions I'd want your call on
Slot C (fixed Kimi) vs Slot A (matches critic per tier) — I lean C hard but it's the most "off the existing rubric" of any choice in this design.
Should overall weigh cost/duration explicitly? I.e., is a thoughtful run that hit 9 on every stage but burned 0 still a 9 overall, or does the rating model see total cost and dock the overall when "the result didn't justify the spend"?
Should we also ask the model for a free-form "what would I do differently" paragraph outside the per-stage structure? Useful corpus signal, but lengthens the prompt and may produce a lot of "increase robustness next time" boilerplate.
If C + provenance-preserving template + Kimi default lands well with you, the implementation is fairly contained — new prompt module, extended render_template, extended parser, worker call swapped into the workflow path. The state machine plumbing already shipped.