Redesign the orchestrator subagent prompt (currently in megaplan/data/claude_subagent_appendix.md) to be clear, well-structured, and reliable. The current prompt is ~140 lines and tries to encode the full state machine, all phase rules, safeguards, breakpoints, and resume protocol in one block. The goal is NOT to make it programmatic — LLM judgment is intentionally part of orchestration. The goal is to make the prompt so clear that the LLM reliably follows it. Key areas to improve: (1) The LLM must know exactly what all the steps are for each robustness level and how to traverse them. (2) It must know how and when to escalate to the outer conversation (breakpoint types, what triggers each). (3) The prompt shouldn't be so dense that important instructions get lost — use clear sections, priorities, and formatting. (4) It should know how to handle edge cases (stuck phases, repeated failures, notes injection) without the prompt being overloaded. Think about prompt engineering best practices: clear role, explicit decision trees, examples of breakpoint format, separation of 'always do' vs 'conditionally do' rules. Produce a redesigned prompt that is well-organized and tested against the actual workflow in megaplan/_core/workflow.py.
The orchestrator subagent prompt (megaplan/data/claude_subagent_appendix.md) is the instructions given to a Claude Code subagent that autonomously runs the megaplan workflow. It's ~157 lines encoding the full state machine, phase rules, safeguards, breakpoints, and resume protocol in one dense block.
Problem: The prompt duplicates content from instructions.md (which is prepended via bundled_global_file), mixes concerns (routing logic, error handling, breakpoint format, session rules), and buries critical instructions in walls of text — making it unreliable for LLM execution.
Approach: Redesign the appendix as a well-structured prompt with clear sections, explicit decision trees per robustness level, and separation of "always do" vs "conditionally do" rules. The appendix should complement instructions.md (not duplicate it) since both are concatenated into the final skill file.
Constraints:
The prompt is a markdown file loaded verbatim via _claude_subagent_appendix() and appended to the skill
Assistant
Template variables {IDEA}, {PROJECT_DIR}, {AUTO_APPROVE}, {AUTO_APPROVE_FLAG}, {ROBUSTNESS} are filled by the outer skill at launch time
The prompt must work with the actual CLI commands and state machine in workflow.py
LLM judgment is intentional — the goal is clarity, not programmatic rigidity
Main Phase
Step 1: Audit current prompt against workflow.py for accuracy (megaplan/data/claude_subagent_appendix.md, megaplan/_core/workflow.py)
Scope: Small
Map every transition in workflow.py (lines 31-92) against what the current prompt says about routing. Document any discrepancies or missing cases.
Identify content in the appendix that duplicates instructions.md — these sections can be removed or reduced to brief cross-references since both files are concatenated.
List the distinct concerns currently mixed together: (a) activation/launch protocol, (b) per-robustness routing, (c) phase-by-phase rules, (d) safeguards/retries, (e) breakpoint protocol, (f) resume protocol, (g) note injection, (h) completion format, (i) command reference, (j) outer skill handling.
Step 2: Redesign the prompt structure (megaplan/data/claude_subagent_appendix.md)
Scope: Large — this is the core deliverable
Write the redesigned prompt with these clearly separated sections:
Section 1: Role & Mission (~5 lines)
One-paragraph role definition: you are the autonomous megaplan runner
How the outer skill launches, relays breakpoints, handles kill-and-inject
Remove content that duplicates instructions.md — especially the full command reference (already in instructions.md lines 97-117), detailed phase rules (lines 29-34), and override descriptions (lines 65-76).
Apply prompt engineering best practices:
Use numbered lists for sequential procedures, bullet lists for options
Bold key terms and command names
Use > IMPORTANT: callouts for the 2-3 most critical rules
Keep each section self-contained so the LLM can reference it without reading the whole prompt
Put the most important operational rule (check status after every phase) early and repeated
Step 3: Validate against workflow.py transitions (megaplan/_core/workflow.py)
Scope: Small
Cross-check every routing claim in the new prompt against WORKFLOW (line 31), _ROBUSTNESS_OVERRIDES (line 73), and _ROBUSTNESS_WORKFLOW_LEVELS (line 88).
Verify the light robustness path: STATE_CRITIQUED → revise → STATE_GATED (line 81-82), and STATE_EXECUTED has no transitions (line 84) — confirming no review phase.
Verify the standard path: STATE_INITIALIZED → plan (line 77), normal gate logic applies.
Verify heavy path: uses base WORKFLOW where STATE_INITIALIZED → prep.
Step 4: Update tests if needed (tests/test_megaplan.py)
Scope: Small
Checktest_global_setup_codex_no_subagent_appendix (line 1655) — this tests that non-Claude agents don't get the appendix. It should still pass since we're only changing content, not loading logic.
Run the full test suite to confirm no breakage.
Execution Order
Step 1 (audit) informs the rewrite.
Step 2 (rewrite) is the main deliverable.
Step 3 (cross-check) validates accuracy before committing.
Step 4 (tests) confirms nothing broke.
Validation Order
Manual cross-check of routing claims against workflow.py (Step 3).
Run pytest tests/test_megaplan.py to confirm no regressions (Step 4).
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-04-06T17:46:04Z",
"hash": "sha256:c111555eff2b9e52dd05ebda868576d1f1444220d06679bc3b0bd748e866d456",
"questions": [
"The appendix includes an 'Outer skill handling' section (lines 149-156) that tells the outer Claude Code skill how to manage the subagent. Should this stay in the appendix (which gets concatenated into the skill file) or be separated? Currently it's inside the agent prompt template fenced block, which means it's sent TO the subagent \u2014 but it describes outer skill behavior. Is this intentional (so the subagent knows what to expect) or a structural error?",
"The current prompt duplicates the full command reference from instructions.md. Since both files are concatenated, should the redesigned appendix omit the command reference entirely and rely on instructions.md, or keep a minimal subset (just the commands the subagent actually uses)?",
"Should the redesigned prompt include a concrete example of a breakpoint output (with placeholder values filled in), or just the format template? An example would add ~5 lines but significantly improve reliability."
],
"success_criteria": [
{
"criterion": "The redesigned prompt accurately describes all three robustness-level paths (light, standard, heavy) matching the transitions in workflow.py",
"priority": "must"
},
{
"criterion": "All four breakpoint types (GATE_ESCALATE, EXECUTE_APPROVAL, PHASE_ESCALATE, EXECUTE_ESCALATE) are documented with exact trigger conditions",
"priority": "must"
},
{
"criterion": "The prompt includes the 'check status after every phase' rule prominently and early",
"priority": "must"
},
{
"criterion": "No content contradicts the actual state machine in workflow.py or the orchestrator_guidance values in evaluation.py",
"priority": "must"
},
{
"criterion": "All existing tests pass (pytest tests/test_megaplan.py)",
"priority": "must"
},
{
"criterion": "The template variables {IDEA}, {PROJECT_DIR}, {AUTO_APPROVE}, {AUTO_APPROVE_FLAG}, {ROBUSTNESS} are preserved in the agent prompt template",
"priority": "must"
},
{
"criterion": "The prompt is organized into clearly separated sections with distinct concerns (routing, breakpoints, safeguards, resume, etc.)",
"priority": "must"
},
{
"criterion": "Content duplicated from instructions.md is removed or reduced to brief references",
"priority": "should"
},
{
"criterion": "The prompt is under ~160 lines (no longer than current) despite being better organized",
"priority": "should"
},
{
"criterion": "Critical rules use visual emphasis (bold, callouts, or caps) to avoid being lost in surrounding text",
"priority": "should"
},
{
"criterion": "Each section is self-contained enough that the LLM can reference it without reading the whole prompt",
"priority": "should"
},
{
"criterion": "The prompt includes at least one concrete breakpoint output example with placeholder values filled in",
"priority": "should"
},
{
"criterion": "A real megaplan run (light or standard) with the redesigned prompt completes successfully",
"priority": "info"
}
],
"assumptions": [
"The appendix should complement instructions.md, not duplicate it \u2014 removing redundant content is in scope since both files are concatenated into the final skill.",
"The agent prompt template (lines 18-157) is the primary target for redesign. The activation/launch sections (lines 1-16) above the template are secondary and can be lightly restructured.",
"Template variables ({IDEA}, {PROJECT_DIR}, etc.) and their substitution mechanism are unchanged \u2014 this is a content-only rewrite.",
"The outer skill handling section should remain in the appendix (inside the template) so the subagent understands what the outer skill expects from it, even though it describes outer behavior.",
"Including one concrete breakpoint example is worth the extra lines for reliability.",
"The command reference can be trimmed to a compact list since the full reference exists in instructions.md."
],
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[]
Known accepted debt grouped by subsystem:
{
"are-the-proposed-changes-technically-correct": [
{
"id": "DEBT-009",
"concern": "are the proposed changes technically correct?: the mobile action-surface plan is technically incorrect for the current component structure. submissioncarouselcard hides footercontent below the md breakpoint (src/components/submissioncarouselcard.tsx:219), while submissionscarouselpage also hides the score panel on mobile via asidecontent={<div classname=\"hidden md:block\">... and passes hideactions to scorepanel at src/pages/submissionscarouselpage.tsx:250-263,347. reusing that pattern for entrypage would leave mobile users with no navigation controls and no scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-010",
"concern": "are the proposed changes technically correct?: i checked the sign-in callback path again. submissionslayout already wires usescoring(..., { onrequiresignin: () => pagemachine.dispatch({ type: 'open_sign_in_modal' }) }) at src/pages/submissionslayout.tsx:38-40, and scorepanel still has its own onrequiresignin prop. the revised step 4.2 is acceptable only if it explicitly rewires that prop to pagemachine.dispatch; otherwise removing local modal state would orphan the direct ui callback. the plan hints at this, but it remains easy to misread because the scoring-context callback and the scorepanel prop are separate mechanisms.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"are-the-success-criteria-well-prioritized-and-verifiable": [
{
"id": "DEBT-019",
"concern": "are the success criteria well-prioritized and verifiable?: mobile behavior is still under-prioritized relative to the actual risk in this repo. the user constraint specifically mentions the mobile bottom nav, but the only mobile-specific success criterion left is 'mobile scoring ux is coherent' at info level. given that the plan currently removes the working mobile nav, there should be at least a should or must criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [
{
"id": "DEBT-011",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: a new critical issue is introduced on mobile. step 4.9 says to remove entrypage's mobile sticky bottom nav and 'use the same footercontent slot in submissioncarouselcard', but src/components/submissioncarouselcard.tsx:217-221 renders footercontent inside classname=\"hidden md:block\". in the current repo, the mobile sticky nav at src/pages/entrypage.tsx:283-340 is the only mobile surface for back/next and the score toggle, so the revised plan would remove working mobile controls and replace them with a slot that is explicitly hidden on phones.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-012",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: the plan still contradicts itself on mobile behavior. assumption #3 says the browse-mode mobile score toggle will be preserved, but step 4.9 removes the entire mobile sticky nav that contains that toggle in src/pages/entrypage.tsx:314-330. the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"does-the-change-touch-all-locations-and-supporting-infrastructure": [
{
"id": "DEBT-018",
"concern": "does the change touch all locations and supporting infrastructure?: if the implementation really wants footercontent to carry mobile actions, the plan must also include a supporting change in src/components/submissioncarouselcard.tsx or render a separate mobile control surface outside the card. right now step 4.9 removes the mobile nav but does not list submissioncarouselcard.tsx:217-221 as a place that must change, so the required glue for mobile controls is missing.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"execute-phase-contract": [
{
"id": "DEBT-003",
"concern": "early-killed baselines pass truncated output to the execute worker, which may produce lower-quality diagnosis than full output.",
"occurrence_count": 1,
"plan_ids": [
"design-and-implement-a-20260327-0512"
]
}
],
"find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them": [
{
"id": "DEBT-014",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i checked the skip caller path against the real hook behavior and removefromqueue(entryid) looks redundant. scoring.skipentry(entryid) optimistically adds the id to skippedentryids in src/hooks/usescoring.ts:245-249, and usecarouselqueue already reactively filters skipped entries from submissions[] in src/hooks/usecarouselqueue.ts:154-165. calling removefromqueue() immediately afterward is safe, but it duplicates an existing state transition and should be justified as an explicit ux optimization rather than required logic.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-015",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the direct ui sign-in caller is still important here. scorepanel invokes its own onrequiresignin prop when an unauthenticated user interacts with the score ui (src/components/scorepanel.tsx:499-515), which is independent of the scoring hook's internal requireauth() path. the plan should be read as requiring that caller to dispatch open_sign_in_modal; otherwise one caller remains broken even if submitscore() is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"handler-boilerplate": [
{
"id": "DEBT-004",
"concern": "_run_worker() pseudocode hardcodes iteration=state['iteration'] but handle_plan and handle_revise use different failure iteration values.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-005",
"concern": "same issue as correctness-1: failure iteration would be wrong for plan/revise handlers.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
],
"install-paths": [
{
"id": "DEBT-023",
"concern": "local setup path doesn't expose subagent mode",
"occurrence_count": 1,
"plan_ids": [
"refactor-megaplan-skill-so-20260406-1818"
]
},
{
"id": "DEBT-024",
"concern": "no automated guard to keep the mirror file synchronized with source files",
"occurrence_count": 1,
"plan_ids": [
"update-all-documentation-20260406-1902"
]
},
{
"id": "DEBT-025",
"concern": "local setup test only checks agents.md existence, not content",
"occurrence_count": 1,
"plan_ids": [
"update-all-documentation-20260406-1902"
]
}
],
"is-there-convincing-verification-for-the-change": [
{
"id": "DEBT-016",
"concern": "is there convincing verification for the change?: the test-plan details still miss a small but real infrastructure update: the current locationdisplay helper in src/pages/submissionscarouselpage.test.tsx:289-291 only renders location.pathname, so the step 7 requirement to assert { state: { carousel: true, navdirection: 'forward' } } cannot be implemented unless that helper is extended to expose location.state. the same pattern exists in the related page tests.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-017",
"concern": "is there convincing verification for the change?: there is still no explicit mobile regression test in the plan, even though the revised implementation proposal removes the only current mobile nav/score surface. given the repository's actual component structure, a mobile-focused test or visual verification step is needed to prove controls remain accessible below md.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"mobile-ui": [
{
"id": "DEBT-020",
"concern": "mobile ui: removing entrypage's mobile sticky nav and relying on submissioncarouselcard.footercontent would break mobile navigation and scoring because that footer slot is hidden below the md breakpoint.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader": [
{
"id": "DEBT-013",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the mobile problem is broader than entrypage. submissionscarouselpage already has a pre-existing mobile gap because its score panel is desktop-only and its footer actions are also hidden on mobile (src/pages/submissionscarouselpage.tsx:250-263,347-354 plus src/components/submissioncarouselcard.tsx:219). the revised plan says entrypage should 'match the carouselpage pattern', which would spread that existing gap into the one page that currently has working mobile controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"subagent-safeguards": [
{
"id": "DEBT-021",
"concern": "hermes reference safeguard numbers not validated against actual implementation",
"occurrence_count": 1,
"plan_ids": [
"refactor-megaplan-skill-so-20260406-1818"
]
},
{
"id": "DEBT-022",
"concern": "plan's retry caps (1 phase, 3 execute) may differ from hermes-agent's actual policy",
"occurrence_count": 1,
"plan_ids": [
"refactor-megaplan-skill-so-20260406-1818"
]
}
],
"worker-permissions": [
{
"id": "DEBT-001",
"concern": "codex --full-auto flag only triggers for step == 'execute', not 'loop_execute'",
"occurrence_count": 1,
"plan_ids": [
"build-megaloop-a-minimal-20260327-0250"
]
},
{
"id": "DEBT-002",
"concern": "claude --permission-mode bypasspermissions only triggers for step == 'execute', not 'loop_execute'",
"occurrence_count": 1,
"plan_ids": [
"build-megaloop-a-minimal-20260327-0250"
]
}
],
"workflow-state-machine": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
code
Escalated debt subsystems:
[
{
"subsystem": "install-paths",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"id": "DEBT-023",
"concern": "local setup path doesn't expose subagent mode",
"occurrence_count": 1,
"plan_ids": [
"refactor-megaplan-skill-so-20260406-1818"
]
},
{
"id": "DEBT-024",
"concern": "no automated guard to keep the mirror file synchronized with source files",
"occurrence_count": 1,
"plan_ids": [
"update-all-documentation-20260406-1902"
]
},
{
"id": "DEBT-025",
"concern": "local setup test only checks agents.md existence, not content",
"occurrence_count": 1,
"plan_ids": [
"update-all-documentation-20260406-1902"
]
}
]
},
{
"subsystem": "workflow-state-machine",
"total_occurrences": 3,
"plan_count": 1,
"entries": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
]
code
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Your output template is at: /Users/user_c042661f/Documents/megaplan/.megaplan/plans/redesign-the-orchestrator-20260406-1943/critique_output.json
Review the plan with a broad scope. Consider whether the approach is correct, whether it covers
all the places it needs to, whether it would break callers or violate codebase conventions,
and whether its verification strategy is adequate.
Place any concrete concerns in the flags array in the template file using the standard format
(id, concern, category, severity_hint, evidence). Leave checks as an empty array.
Workflow: read the file → investigate → read file again → add findings → write file back.
code
Additional guidelines:
- Robustness level: light. Be pragmatic. Only flag issues that would cause real failures. Ignore style, minor edge cases, and issues the executor will naturally resolve.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess.
- Verify that the plan follows the expected structure when validator warnings or the outline suggest drift.
- Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other.
- Focus on concrete issues, not structural formatting.
{"checks":[],"flags":[{"id":"FLAG-001","concern":"Subagent prompt composition: the plan treats the appendix as something that should mainly complement instructions.md, but the launch contract says the outer skill starts the Claude subagent with the appendix's template as the agent prompt. Trimming core workflow, phase, override, or command guidance down to cross-references would leave the real subagent prompt missing operating instructions it currently receives inline.","category":"correctness","severity_hint":"likely-significant","evidence":"The plan explicitly says the appendix should complement instructions.md rather than duplicate it and calls for removing detailed phase rules, override descriptions, and the command reference at /.megaplan/plans/redesign-the-orchestrator-20260406-1943/plan_v1.md:7-10 and /.megaplan/plans/redesign-the-orchestrator-20260406-1943/plan_v1.md:87-87. But the current launch contract says to start the subagent with prompt: use the template below in [claude_subagent_appendix.md](/Users/user_c042661f/Documents/megaplan/megaplan/data/claude_subagent_appendix.md#L11) and [claude_subagent_appendix.md](/Users/user_c042661f/Documents/megaplan/megaplan/data/claude_subagent_appendix.md#L14), while the template itself currently contains the workflow and command guidance in [claude_subagent_appendix.md](/Users/user_c042661f/Documents/megaplan/megaplan/data/claude_subagent_appendix.md#L17) through [claude_subagent_appendix.md](/Users/user_c042661f/Documents/megaplan/megaplan/data/claude_subagent_appendix.md#L156). bundled_global_file(\"claude_skill.md\") only concatenates files for the outer skill install in [cli.py](/Users/user_c042661f/Documents/megaplan/megaplan/cli.py#L309) through [cli.py](/Users/user_c042661f/Documents/megaplan/megaplan/cli.py#L315); it does not change what the launched subagent prompt contains."},{"id":"FLAG-002","concern":"Gate routing: the proposed flowchart bakes in PROCEED -> finalize, ITERATE -> revise, ESCALATE -> breakpoint, but the real gate contract is not recommendation-only. A PROCEED recommendation can still be preflight-blocked and route to revise or override force-proceed, so teaching the subagent a simplified gate tree would contradict the actual CLI state machine.","category":"correctness","severity_hint":"likely-significant","evidence":"The planned decision tree is spelled out at /.megaplan/plans/redesign-the-orchestrator-20260406-1943/plan_v1.md:39-45. In the real workflow, STATE_CRITIQUED has separate transitions for gate_proceed_blocked that allow revise or override force-proceed, and only gate_proceed reaches gate/finalize in [workflow.py](/Users/user_c042661f/Documents/megaplan/megaplan/_core/workflow.py#L42) through [workflow.py](/Users/user_c042661f/Documents/megaplan/megaplan/_core/workflow.py#L50). The guidance generator also emits Gate says PROCEED but preflight blocked. Fix: ... in [evaluation.py](/Users/user_c042661f/Documents/megaplan/megaplan/evaluation.py#L643) through [evaluation.py](/Users/user_c042661f/Documents/megaplan/megaplan/evaluation.py#L650), and that case is covered by [test_evaluation.py](/Users/user_c042661f/Documents/megaplan/tests/test_evaluation.py#L866) through [test_evaluation.py](/Users/user_c042661f/Documents/megaplan/tests/test_evaluation.py#L879)."},{"id":"FLAG-003","concern":"Workflow-state-machine: the standard and heavy routing tables in the plan end at ... -> execute -> review, and the validation step only checks workflow.py, but review is not always terminal in this repo. handle_review() can kick the run back to STATE_FINALIZED with next_step=\"execute\" for another pass, so the redesigned prompt needs to cover that handler-driven loop or it can stop too early after a needs_rework review.","category":"correctness","severity_hint":"likely-significant","evidence":"The proposed routing tables and validation scope are at /.megaplan/plans/redesign-the-orchestrator-20260406-1943/plan_v1.md:39-45 and /.megaplan/plans/redesign-the-orchestrator-20260406-1943/plan_v1.md:96-101. The repo explicitly documents that handle_review() may return STATE_FINALIZED on needs_rework outside the static workflow table in [workflow.py](/Users/user_c042661f/Documents/megaplan/megaplan/_core/workflow.py#L60) through [workflow.py](/Users/user_c042661f/Documents/megaplan/megaplan/_core/workflow.py#L65), and the actual handler returns STATE_FINALIZED with next_stepexecute in [handlers.py](/Users/user_c042661f/Documents/megaplan/megaplan/handlers.py#L1089) through [handlers.py](/Users/user_c042661f/Documents/megaplan/megaplan/handlers.py#L1103). That behavior is exercised in [test_megaplan.py](/Users/user_c042661f/Documents/megaplan/tests/test_megaplan.py#L3641) through [test_megaplan.py](/Users/user_c042661f/Documents/megaplan/tests/test_megaplan.py#L3648)."}],"verified_flag_ids":[],"disputed_flag_ids":[]}