You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are the gatekeeper for the megaplan workflow. Make the continuation decision directly.
Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.
code
Plan:
# Implementation Plan: Fix Planning Lifecycle — Real In-Progress State, Status Enrichment, Doc Parity
Overview
Megaplan's planning lifecycle has four honest gaps:
No in-progress indicator: When a worker (plan, prep, critique, etc.) is running, state.json still shows the previous completed state (e.g. initialized). Status reports the plan as idle when it's actively working. There is no active_step concept.
Status is anemic: handle_status (cli.py:82-95) returns state, iteration, next_step, valid_next, and artifact list. It doesn't expose session metadata, cost accumulation, last step duration, or whether a worker is currently running.
watch is documented but unimplemented: README:91, instructions.md:116 both reference megaplan watch --plan <name>. No parser entry, no handler, no implementation exists.
Standard/light planning collapses investigation into a black box: Heavy robustness runs init → prep → plan. Standard overrides initialized to skip directly to (). This means the planning agent silently does all codebase investigation inside the plan step with no visible prep artifact and no way to inspect what it found before the plan is generated.
Assistant
User
Assistant
User
Assistant
User
Assistant
plan
workflow.py:76-78
Subagent command reference is stale: claude_subagent_appendix.md:247-273 omits list, watch (which doesn't exist anyway), and the step-editing commands that instructions.md documents.
Design constraint
The idea explicitly says: "Do not force execute-style checkpointing or batch semantics onto planning." The fix should be lightweight metadata — not task tracking, batch numbering, or progress percentages applied to planning phases.
Phase 1: Active-Step Metadata and Status Enrichment
Step 1: Add active_step field to state types (megaplan/types.py)
Scope: Small
Add an ActiveStep TypedDict at megaplan/types.py:~52:
python
class ActiveStep(TypedDict, total=False):
step: str # "plan", "prep", "critique", etc.
started_at: str # ISO UTC timestamp
session_key: str # session key being used
agent: str # "claude", "hermes", "codex"
Addactive_step: NotRequired[ActiveStep] to PlanState at megaplan/types.py:111.
Step 2: Write active_step before worker, clear on completion/error (megaplan/handlers.py)
Scope: Medium
Add a helper _set_active_step(plan_dir, state, step, agent) that writes the active_step field and calls save_state.
Call_set_active_step at the start of each handler that invokes _run_worker — before the worker call. Key handlers: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review.
Clearactive_step in _finish_step (:174) after the worker completes — state.pop("active_step", None).
Clearactive_step in the except path of _run_worker (:145-149) via record_step_failure or directly, so a crashed worker doesn't leave stale metadata. Note: if the process is killed, the field will remain — status should handle staleness (see Step 3).
Determine the agent string before the worker call. Currently _run_worker returns the agent; we need it before. The agent selection logic is in workers.py:run_step_with_worker. Factor out resolve_agent(step, state, args) that returns the agent string without running the worker, or read it from the args/state config. The simplest approach: args.agent or state["config"].get("agents", {}).get(step, "claude") — check the exact logic in run_step_with_worker.
Step 3: Enrich handle_status to surface active_step and session metadata (megaplan/cli.py:82-95)
Scope: Small
Addactive_step to the status response when present in state — exposes what's currently running.
Add a staleness check: if active_step is present but started_at is older than a reasonable threshold (e.g. 2 hours), mark it as "possibly_stale": true so the consumer knows to investigate rather than trusting it blindly.
Addsessions summary to status: map of session keys to their last_used_at timestamps, so the consumer can see what sessions are active.
Addlast_step summary: the most recent history entry's step name, result, and duration_ms, giving a "what just happened" signal.
Addtotal_cost_usd from state["meta"].get("total_cost_usd", 0).
Step 4: Update tests for active_step and enriched status (tests/test_megaplan.py)
Scope: Medium
Add tests that verify active_step is set in state.json before the worker runs and cleared after. Use the mock worker (already used in test suite) — may need to inspect state during mock execution or verify the field is absent post-step.
Add tests that verify handle_status returns the new fields (active_step when present, sessions, last_step, total_cost_usd).
Update any existing tests that assert on exact status response shape if they break with the new fields.
Phase 2: Watch Command — Implement or Remove
Step 5: Implement megaplan watch as a polling status command (megaplan/cli.py)
Scope: Medium
Addwatch to the argparse subparsers at cli.py:~516 with --plan and --interval (default 5s) arguments.
Implementhandle_watch as a loop that calls handle_status, renders a human-readable summary, sleeps for the interval, and repeats. Use Ctrl+C to exit.
Addwatch to COMMAND_HANDLERS at cli.py:630.
Key rendering: show current state, active_step (if running), last completed step, cost so far, and during execution: task/batch progress from handle_progress. This is CLI-facing (human reads terminal), not JSON.
Alternative (simpler): If a full TUI loop is overweight, implement watch as a single-shot enhanced status that includes everything status + progress return, formatted for humans. The README says "shows current state, last completed phase, pending notes, and execution progress" — a single-shot command matches that. The polling can be done by the user or the subagent.
Decision: implement as single-shot enhanced status for simplicity — it matches the README description without requiring a terminal loop. If polling is desired later, watch --follow can be added.
Step 6: Add watch to COMMAND_HANDLERS and parser (megaplan/cli.py)
Scope: Small (included in Step 5)
Phase 3: Standard/Light Prep Visibility
Step 7: Enable prep for standard robustness (megaplan/_core/workflow.py:73-79)
Scope: Small
Remove the standard override that replaces initialized → plan with a direct transition. Currently at workflow.py:76-78:
Remove this override so standard inherits the base WORKFLOW which routes initialized → prep → plan.
Verify light and tiny inherit correctly: _ROBUSTNESS_WORKFLOW_LEVELS has "light": ("standard", "light") and "tiny": ("standard", "light", "tiny"). With the standard override removed, light/tiny will also gain prep. This is the desired behavior — all levels get a visible investigation step.
Note: The prep prompt (planning.py:138-191) already has a skip: true fast-path for trivial tasks. This means adding prep to standard/light doesn't force unnecessary investigation — the agent can still skip if the task is clear.
Step 8: Update subagent instructions for new routing (megaplan/data/claude_subagent_appendix.md)
Scope: Small
Update the Phase Routing section (lines 73-94) to add prep to all robustness levels:
Addmegaplan watch --plan <name> to the Command Reference (section 11, lines 248-272) under core commands.
Addmegaplan list to the Command Reference.
Verify step editing commands (step add/remove/move) are already in the reference — they are at lines 270-272.
Step 9: Update instructions.md and README.md for accuracy
Scope: Small
Updatemegaplan/data/instructions.md — remove megaplan watch if we implement it as a different shape than documented, or leave it if the implementation matches. Verify all listed commands exist.
UpdateREADME.md:82-87 robustness descriptions — standard now includes prep:
standard: "prep + 4 critique checks (default)"
light: "prep + streamlined critique, fast"
heavy: "prep + 8 critique checks" (already has prep, just verify description)
Phase 4: Test Updates and Validation
Step 10: Update workflow tests for standard prep (tests/test_megaplan.py)
Scope: Medium
Updatetest_megaplan.py:175 — the test that asserts standard's initialized state goes to ["plan"] must now assert ["prep"].
Updatetest_megaplan.py:248 — the test that asserts standard's next step from initialized is "plan" must now assert "prep".
Updatetest_megaplan.py:333 — light robustness next step from initialized should now be "prep".
Update any tests in test_core.py or test_megaplan.py that test the workflow state machine transitions for standard/light.
Add a test for watch command handler.
Run the full test suite: python -m pytest tests/ to catch any breakage.
Step 11: Run full validation
Scope: Small
Runpython -m pytest tests/ -x to verify all tests pass.
Verifymegaplan watch --plan <name> works on an existing plan directory.
Verifymegaplan status --plan <name> returns the enriched fields.
Execution Order
Steps 1-2 (active_step types and handler wiring) first — they're the core behavioral change.
Step 3 (status enrichment) depends on Step 1-2.
Steps 4 and 10 (test updates) after the code changes they test.
Steps 5-6 (watch) can run in parallel with Steps 7-9 (prep/docs).
Step 11 (validation) last.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Steps 1-4.
Run python -m pytest tests/ -x after all code changes.
Manual smoke test: megaplan init, megaplan status, megaplan watch on a test plan.
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-04-09T19:08:12Z",
"hash": "sha256:5f01eb1362db712db67b80bcc929c66d6f343292a42d394aa5d758cc648dc86f",
"questions": [
"Should watch be a single-shot enhanced status (matches README description, simpler) or a continuous polling loop (more traditional watch semantics)? Plan assumes single-shot.",
"When standard/light gain prep, should the subagent be instructed to always run prep, or should it still skip prep when the task is trivially scoped? The prep prompt already has a skip mechanism, so the agent decides \u2014 but should the subagent instructions mention this?",
"Should active_step include the worker PID for external kill detection, or is timestamp-based staleness detection sufficient?"
],
"success_criteria": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns enriched status information",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and matches the actual CLI",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "Subagent phase routing instructions updated for all robustness levels to include prep",
"priority": "must"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle and enriched status fields",
"priority": "should"
}
],
"assumptions": [
"watch is implemented as single-shot enhanced status (not a continuous polling loop) since the README description matches that and it avoids terminal loop complexity",
"All robustness levels gain prep, not just standard \u2014 light and tiny inherit from standard via the workflow hierarchy, and the prep prompt's skip mechanism prevents unnecessary investigation for trivial tasks",
"active_step uses timestamp-based staleness detection rather than PID tracking, since workers are child processes that may not have stable PIDs across agent types",
"The agent type can be resolved from args and state config before invoking the worker, without needing to refactor run_step_with_worker",
"Existing mock worker infrastructure in tests is sufficient to verify active_step lifecycle without needing real worker invocations"
],
"structure_warnings": [
"Each step section should include at least one numbered substep."
]
}
code
Gate signals:
{
"robustness": "standard",
"signals": {
"iteration": 1,
"idea": "Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.",
"significant_flags": 8,
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it watch creates a semantic mismatch with standard CLI conventions where watch implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using args.agent or state['config'].get('agents', {}).get(step, 'claude'), but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: Step 2 lists the handlers that need _set_active_step calls: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review. I confirmed these exist at the listed lines (handlers.py). However, handle_critique has a special tiny-robustness fast path (handlers.py:741-749) that stubs the critique without calling _run_worker. The plan should note that this path doesn't need active_step since no worker runs, but if active_step is set unconditionally before the robustness check, it needs to be cleared on the stub path too.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"category": "correctness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [],
"weighted_score": 12.5,
"weighted_history": [],
"plan_delta_from_previous": null,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 1. Weighted score trajectory: 12.5. Plan deltas: n/a. Recurring critiques: 0. Resolved flags: 0. Open significant flags: 8.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"warnings": [],
"criteria_check": {
"count": 12,
"items": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns enriched status information",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and matches the actual CLI",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "Subagent phase routing instructions updated for all robustness levels to include prep",
"priority": "must"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle and enriched status fields",
"priority": "should"
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "resolve_agent_mode at workers.py:1135-1220 handles --phase-model, --hermes, --agent, config file, and DEFAULT_AGENT_ROUTING with fallbacks. The plan's suggestion at Step 2.5 ('args.agent or state["config"].get("agents", {}).get(step, "claude")') skips all of these. The simplest correct approach: call resolve_agent_mode directly before _run_worker (it has no side effects beyond reading config), then pass the resolved tuple to run_step_with_worker via its existing resolved parameter.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json. The plan prompt builder needs to be checked for prep.json consumption. The plan's Step 7 only removes the workflow override; it doesn't touch the prompt builder.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it watch creates a semantic mismatch with standard CLI conventions where watch implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it watch creates a semantic mismatch with standard CLI conventions where watch implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using args.agent or state['config'].get('agents', {}).get(step, 'claude'), but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using args.agent or state['config'].get('agents', {}).get(step, 'claude'), but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: Step 2 lists the handlers that need _set_active_step calls: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review. I confirmed these exist at the listed lines (handlers.py). However, handle_critique has a special tiny-robustness fast path (handlers.py:741-749) that stubs the critique without calling _run_worker. The plan should note that this path doesn't need active_step since no worker runs, but if active_step is set unconditionally before the robustness check, it needs to be cleared on the stub path too.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Step 2 lists the handlers that need _set_active_step calls: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review. I confirmed these exist at the listed lines (handlers.py). However, handle_critique has a special tiny-robustness fast path (handlers.py:741-749) that stubs the critique without calling _run_worker. The plan should note that this path doesn't need active_step since no worker runs, but if active_step is set unconditionally before the robustness check, it needs to be cleared on the stub path too.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "_run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
}
]
}
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"evidence": "resolve_agent_mode at workers.py:1135-1220 handles --phase-model, --hermes, --agent, config file, and DEFAULT_AGENT_ROUTING with fallbacks. The plan's suggestion at Step 2.5 ('args.agent or state["config"].get("agents", {}).get(step, "claude")') skips all of these. The simplest correct approach: call resolve_agent_mode directly before _run_worker (it has no side effects beyond reading config), then pass the resolved tuple to run_step_with_worker via its existing resolved parameter.",
"category": "correctness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"evidence": "Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json. The plan prompt builder needs to be checked for prep.json consumption. The plan's Step 7 only removes the workflow override; it doesn't touch the prompt builder.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it watch creates a semantic mismatch with standard CLI conventions where watch implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"evidence": "The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it watch creates a semantic mismatch with standard CLI conventions where watch implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using args.agent or state['config'].get('agents', {}).get(step, 'claude'), but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"evidence": "Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using args.agent or state['config'].get('agents', {}).get(step, 'claude'), but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"category": "correctness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"evidence": "Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: Step 2 lists the handlers that need _set_active_step calls: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review. I confirmed these exist at the listed lines (handlers.py). However, handle_critique has a special tiny-robustness fast path (handlers.py:741-749) that stubs the critique without calling _run_worker. The plan should note that this path doesn't need active_step since no worker runs, but if active_step is set unconditionally before the robustness check, it needs to be cleared on the stub path too.",
"evidence": "Step 2 lists the handlers that need _set_active_step calls: handle_plan (:667), handle_prep (:713), handle_critique (:734), handle_revise, handle_gate, handle_finalize, handle_execute, handle_review. I confirmed these exist at the listed lines (handlers.py). However, handle_critique has a special tiny-robustness fast path (handlers.py:741-749) that stubs the critique without calling _run_worker. The plan should note that this path doesn't need active_step since no worker runs, but if active_step is set unconditionally before the robustness check, it needs to be cleared on the stub path too.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"evidence": "handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"category": "correctness",
"severity": "significant",
"status": "open",
"weight": null
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"evidence": "_run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"category": "correctness",
"severity": "significant",
"status": "open",
"weight": null
}
]
code
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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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"
]
}
],
"criteria-prompt": [
{
"id": "DEBT-026",
"concern": "criteria prompt: v3 replaces _review_prompt() in heavy mode with a new heavy_criteria_review_prompt, so the plan no longer follows the brief's explicit requirement that _review_prompt() remain the heavy-mode criteria_verdict check.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new heavy_criteria_review_prompt, but the brief said _review_prompt() should stay as-is and still run as the criteria_verdict check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"diff-capture": [
{
"id": "DEBT-027",
"concern": "diff capture: the proposed collect_git_diff_patch(project_dir) helper uses git diff head, which will miss untracked files even though the existing execution-evidence path already treats untracked files as real changed work.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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"
]
},
{
"id": "DEBT-033",
"concern": "does the change touch all locations and supporting infrastructure?: the prior missing locations in megaplan/workers.py and tests/test_workers.py are now covered, but one supporting-infrastructure path is still absent from the steps: the repo-root generated schema copy under .megaplan/schemas/review.json and the tests that read it directly. without either explicitly regenerating that file or changing those tests to materialize schemas in a temp root, the plan can still leave the runtime-schema copy out of sync with the raw registry.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through validate_payload() is now accounted for, but the runtime-schema caller path still is not: strict_schema() only reaches the on-disk runtime schemas through ensure_runtime_layout(), while current tests like tests/test_schemas.py and tests/test_parallel_review.py consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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"
]
}
],
"runtime-schema-sync": [
{
"id": "DEBT-031",
"concern": "runtime schema sync: the plan still does not include an explicit refresh or validation step for the generated .megaplan/schemas/review.json copy that repository tests read directly.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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"
]
},
{
"id": "DEBT-030",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the revised plan correctly narrows the schema-shape problem itself back to the six audited mismatches, but the generated runtime-schema consumer path is broader than the plan acknowledges: tests/test_parallel_review.py also reads the runtime review.json schema from schemas_root(repo_root), so stale generated schema copies can affect more than the direct schema tests.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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": "are-the-proposed-changes-technically-correct",
"total_occurrences": 4,
"plan_count": 3,
"entries": [
{
"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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new heavy_criteria_review_prompt, but the brief said _review_prompt() should stay as-is and still run as the criteria_verdict check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
]
},
{
"subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through validate_payload() is now accounted for, but the runtime-schema caller path still is not: strict_schema() only reaches the on-disk runtime schemas through ensure_runtime_layout(), while current tests like tests/test_schemas.py and tests/test_parallel_review.py consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"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:
- Treat recurring debt as decision context, not background noise.
- If the current unresolved flags overlap an escalated subsystem, prefer recommending holistic redesign over another point fix.
Robustness level:
standard
Requirements:
- Decide exactly one of: PROCEED, ITERATE, ESCALATE.
- Use the weighted score, flag details (including `evidence`), plan delta, recurring critiques, and preflight results as judgment context.
- PROCEED when execution should move forward now.
- ITERATE when revising the plan is the best next move.
- ESCALATE when the loop is stuck, churn is recurring, or user intervention is needed.
- `signals_assessment`: one paragraph summarizing score trajectory, flag status, and preflight posture.
Flags come in two tiers:
- **Blocking** (severity = significant/likely-significant): These are serious concerns. If you PROCEED, any blocking flags you don't explicitly resolve will be implicitly accepted as tradeoffs.
- **Noted** (everything else): Acknowledge in your rationale but they don't block PROCEED.
If there are blocking flags and you want to PROCEED, you may provide `flag_resolutions` — one entry per flag you are explicitly resolving. Two actions are allowed:
- **dispute**: The critique was factually wrong. You MUST cite specific evidence (file path, line, API doc, etc.) proving the concern is invalid.
- **accept_tradeoff**: The concern is real but intentionally accepted as a known limitation. Always allowed; the flag is recorded as tech debt.
You may resolve at most 3 flags explicitly per gate call. Any remaining blocking flags are implicitly accepted as tradeoffs if you recommend PROCEED.
If a flag is structurally unresolvable (e.g., references infrastructure outside the repo), you should still PROCEED — do not loop indefinitely on flags that cannot be addressed.
If there are no blocking flags, `flag_resolutions` can be omitted.
Populate `settled_decisions` with design choices that should carry into review without re-litigation. Return `[]` when there are none.
Example:
```json
{
"recommendation": "PROCEED",
"rationale": "Core fix is correct. Convention concern accepted.",
"signals_assessment": "Score stable at 2.5, preflight passed, no recurring critiques.",
"warnings": ["Verify edge case with composite moduli during execution."],
"flag_resolutions": [
{"flag_id": "correctness-1", "action": "dispute", "evidence": "allow_migrate and allow_migrate_model produce identical behavior for this use case (verified at django/db/utils.py:286)."},
{"flag_id": "conventions-1", "action": "accept_tradeoff", "rationale": "Minor naming inconsistency; tracked as debt for later cleanup."}
],
"settled_decisions": []
}
```
{"recommendation":"ITERATE","rationale":"The plan is directionally right, but it should not move to execution yet because several implementation details are still underspecified in ways that would likely produce misleading lifecycle metadata. The biggest blocker is agent resolution: active_step.agent must come from the same resolve_agent_mode() path the worker actually uses, not a simplified reimplementation. The other core gap is coverage: active_step instrumentation must account for non-_run_worker paths such as execute dispatch and the special review branches, otherwise status will still lie during some active work. The watch proposal also needs to be corrected from a single-shot alias into actual watch semantics or renamed, because the current plan preserves a doc/CLI mismatch under a different shape.","signals_assessment":"Iteration 1 starts at a weighted score of 12.5 with 8 open significant flags and no resolved flags yet. Preflight is otherwise healthy: project dir exists, is writable, success criteria are present, and both Claude and Codex are available. The score is not the problem here; the issue is that the remaining flags are concentrated in correctness/completeness areas on the critical path, so revising the plan is cheaper than executing a partially-specified fix and then repairing it.","warnings":["Do not duplicate agent-routing logic; use resolve_agent_mode() and pass the resolved tuple through to worker execution.","Instrument active worker state at every real worker entry point, including execute dispatch and review branches, not just handlers that call _run_worker().","The standard/light prep change is valid only because plan prompts already consume prep.json; keep that linkage explicit in the revised plan.","watch should behave like a watch command, not a renamed one-shot status view, unless the command name/documentation is changed together."],"settled_decisions":[{"id":"SD-001","decision":"Prep should be enabled for standard and light planning.","rationale":"megaplan/prompts/planning.py already calls _render_prep_block(plan_dir) inside _plan_prompt(), and _render_prep_block in megaplan/prompts/_shared.py reads prep.json, so a visible prep phase is actually consumed by downstream planning."},{"id":"SD-002","decision":"Active-step agent metadata must be resolved via the existing worker routing code.","rationale":"megaplan/workers.py:1142 already centralizes routing, fallback, and model override behavior in resolve_agent_mode(). Reimplementing that logic in handlers would drift immediately and produce false status metadata."},{"id":"SD-003","decision":"Active-step lifecycle should be implemented around worker execution boundaries, not per-command checkpoint semantics.","rationale":"The user requirement explicitly rejects execute-style checkpointing for planning. The fix should be lightweight state metadata that turns on when a worker starts and clears when that worker path finishes or fails."}],"flag_resolutions":[],"accepted_tradeoffs":[]}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are the gatekeeper for the megaplan workflow. Make the continuation decision directly.
Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.
code
Plan:
# Implementation Plan: Fix Planning Lifecycle — Real In-Progress State, Status Enrichment, Doc Parity
Overview
Megaplan's planning lifecycle has four honest gaps:
No in-progress indicator: When a worker (plan, prep, critique, etc.) is running, state.json still shows the previous completed state (e.g. initialized). Status reports the plan as idle when it's actively working. There is no active_step concept.
Status is anemic: handle_status (cli.py:82-95) returns state, iteration, next_step, valid_next, and artifact list. It doesn't expose session metadata, cost accumulation, last step duration, or whether a worker is currently running.
watch is documented but unimplemented: README:91, instructions.md:116 both reference megaplan watch --plan <name>. No parser entry, no handler, no implementation exists.
Standard/light planning collapses investigation into a black box: Heavy robustness runs init → prep → plan. Standard overrides initialized to skip directly to plan (workflow.py:76-78). This means the planning agent silently does all codebase investigation inside the plan step with no visible prep artifact and no way to inspect what it found before the plan is generated.
Subagent command reference is stale: claude_subagent_appendix.md:247-273 omits list and watch from the command reference. Phase routing instructions only show prep for heavy.
Design constraint
The idea explicitly says: "Do not force execute-style checkpointing or batch semantics onto planning." The fix should be lightweight metadata — not task tracking, batch numbering, or progress percentages applied to planning phases.
Key verified facts
Prep is already consumed by planning: _plan_prompt() (prompts/planning.py:87) calls _render_prep_block(plan_dir) which reads prep.json from disk (prompts/_shared.py:124-252). Adding prep to standard/light will produce an artifact that the plan step actually reads. (Settles FLAG-002/scope.)
resolve_agent_mode() is side-effect-free: workers.py:1142-1227 resolves agent, mode, refreshed, and model from args/config without running any worker. It can be called before _run_worker to populate active_step. (Settles FLAG-001/correctness.)
Status response consumers are additive: The subagent reads state, next_step, valid_next from status output by name. Adding new fields is non-breaking. (Settles callers-1.)
Execute already calls resolve_agent_mode early: handle_execute (handlers.py:1069) resolves agent before dispatch. Active-step can be set between resolution and dispatch. (Settles callers-2 for execute.)
Tiny critique stubs without calling _run_worker: handle_critique (handlers.py:741-791) takes a fast path that creates a stub critique. Active-step must only be set on the real-worker path, not the stub path. (Settles all_locations.)
Phase 1: Active-Step Metadata and Status Enrichment
Step 1: Add active_step field to state types (megaplan/types.py)
Scope: Small
Add an ActiveStep TypedDict after SessionInfo at megaplan/types.py:~52:
python
class ActiveStep(TypedDict, total=False):
step: str # "plan", "prep", "critique", etc.
started_at: str # ISO UTC timestamp
session_key: str # session key being used
agent: str # "claude", "hermes", "codex"
Addactive_step: NotRequired[ActiveStep] to PlanState at megaplan/types.py:111.
Step 2: Wire active_step lifecycle around worker execution (megaplan/handlers.py, megaplan/workers.py)
Scope: Medium
The approach: call resolve_agent_mode() before the worker runs (it's already side-effect-free per workers.py:1142), set active_step, then pass the resolved tuple through to run_step_with_worker via its existing resolved parameter so the agent isn't resolved twice.
Add a helper _set_active_step(plan_dir, state, step, agent) in handlers.py that sets state["active_step"] and calls save_state(plan_dir, state).
Add a helper _clear_active_step(state) that does state.pop("active_step", None) (no save — the caller saves).
Refactor_run_worker (handlers.py:135-149) to accept an optional resolved tuple and pass it through to run_step_with_worker:
In _finish_step (handlers.py:174), add _clear_active_step(state) before the existing save_state call at line 213. This ensures active_step is cleared atomically with the state update on success.
In the except path of _run_worker, add _clear_active_step(state) before record_step_failure so failures also clear the marker. record_step_failure already calls save_state.
Instrument each handler that calls _run_worker — resolve agent first, set active_step, pass resolved through. For each handler:
handle_plan (handlers.py:667): Add before line 672:
Addactive_step to the status response when present in state — exposes what's currently running.
Add a staleness check: if active_step is present but started_at is older than 2 hours, add "possibly_stale": true to the active_step dict in the response.
Addlast_step: extract from the most recent history entry — {"step": ..., "result": ..., "duration_ms": ...}.
Addtotal_cost_usd from state["meta"].get("total_cost_usd", 0).
Addsessions summary: {key: {"last_used_at": info["last_used_at"]} for key, info in state["sessions"].items()}.
All new fields are additive. Existing consumers (subagent, tests) read by field name and ignore unknown keys. No breaking changes.
Step 4: Update tests for active_step and enriched status (tests/test_megaplan.py)
Scope: Medium
Add a test that runs a mock step (e.g. handle_plan) and verifies:
After step completion, state["active_step"] is absent (cleared by _finish_step).
The returned response has no active_step leak.
Add a test that verifies active_step is cleared on worker failure: monkeypatch _run_worker to raise, then assert active_step is not in saved state.
Add a test that calls handle_status on a state with active_step present and verifies the response includes it.
Add a test that calls handle_status and verifies last_step, total_cost_usd, sessions fields are present.
Update any existing tests that assert on exact status response keys if they break with the new fields (unlikely since existing tests don't strictly enumerate keys).
Phase 2: Watch Command
Step 5: Implement megaplan watch as a rich single-shot status (megaplan/cli.py)
Scope: Medium
The README says watch "shows current state, last completed phase, pending notes, and execution progress." This is a composite view — status + progress + notes in one call. Implement as a single-shot command that merges these views. Add --follow flag (optional, future) for continuous polling.
Addwatch to the argparse subparsers at cli.py:~516:
Status fields: state, iteration, next_step, valid_next, active_step (if present).
Last completed step from history.
Notes from state["meta"].get("notes", []).
Execution progress from finalize.json (reuse handle_progress logic or factor out a helper).
Cost summary from state["meta"].get("total_cost_usd", 0).
Session metadata.
Returns a StepResponse dict with all fields (JSON output, same as other commands).
Add"watch": handle_watch to COMMAND_HANDLERS at cli.py:630.
Test: Add a basic test that calls handle_watch and verifies the response shape includes status, notes, and progress fields.
Phase 3: Standard/Light Prep Visibility
Step 6: Enable prep for standard robustness (megaplan/_core/workflow.py:73-79)
Scope: Small
Remove the standard override at workflow.py:75-79:
python
# BEFORE
"standard": {
STATE_INITIALIZED: [
Transition("plan", STATE_PLANNED),
],
},
# AFTER
"standard": {},
With an empty standard override, standard inherits the base WORKFLOW which routes initialized → prep → plan.
Verify light and tiny inherit correctly via _ROBUSTNESS_WORKFLOW_LEVELS: "light": ("standard", "light") and "tiny": ("standard", "light", "tiny"). With standard now empty, all levels gain initialized → prep.
Confirmed: The plan step already consumes prep.json via _render_prep_block(plan_dir) in _plan_prompt() (prompts/planning.py:87, prompts/_shared.py:124). If prep.json doesn't exist (skip or not yet run), _render_prep_block returns empty strings — so the plan step degrades gracefully.
Confirmed: The prep prompt (planning.py:138-191) has a skip: true fast-path for trivial tasks. Adding prep to standard/light doesn't force unnecessary investigation.
Add a note in Phase Routing about the prep skip mechanism: "The prep agent may set skip: true for trivial tasks. When it does, proceed directly to plan — the empty prep artifact is expected."
Step 8: Update instructions.md and README.md for accuracy
Scope: Small
Verifymegaplan/data/instructions.md:116 — megaplan watch --plan <name> is already listed. Now that watch is implemented, it matches. Verify all other listed commands exist in the parser.
UpdateREADME.md:82-87 robustness descriptions:
light — prep + streamlined critique, fast
standard — prep + 4 critique checks (default)
heavy — prep + 8 critique checks + parallel review
Phase 4: Test Updates and Validation
Step 9: Update workflow tests for standard/light prep (tests/test_megaplan.py)
Scope: Medium
Updatetest_megaplan.py:175 — standard's initialized state next steps: change expected from ["plan"] to ["prep"].
Updatetest_megaplan.py:248 — standard's inferred next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:333 — light robustness next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:289 — heavy robustness test (already expects "prep", should still pass).
Search for any other tests that assert on standard/light workflow routing from initialized state and update them.
Runpython -m pytest tests/ -x to catch any remaining breakage.
Step 10: Run full validation
Scope: Small
Runpython -m pytest tests/ -x to verify all tests pass.
Verifymegaplan watch --plan <name> works on an existing plan directory.
Verifymegaplan status --plan <name> returns the enriched fields.
Execution Order
Steps 1-2 (active_step types and handler wiring) first — core behavioral change.
Step 3 (status enrichment) depends on Steps 1-2.
Step 4 (active_step tests) after Steps 1-3.
Step 5 (watch command) can proceed after Step 3 since it reuses the enriched status data.
Steps 6-8 (prep workflow + docs) are independent of Steps 1-5 and can be done in parallel.
Step 9 (workflow test updates) after Step 6.
Step 10 (full validation) last.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Steps 1-4.
Run python -m pytest tests/ -x after all code changes.
Manual smoke test: megaplan init, megaplan status, megaplan watch on a test plan.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-04-09T19:31:23Z",
"hash": "sha256:a096e53224b8a2ec8cc8175dd91c1ba72647afa6bd73e053cf74e240e2aab8f9",
"changes_summary": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"issue_hints",
"correctness",
"scope",
"all_locations",
"callers-1",
"callers-2"
],
"questions": [
"Should the watch command also support a --follow flag for continuous polling in a future iteration, or is single-shot sufficient for now?",
"When standard/light gain prep, should the subagent instructions explicitly mention the prep skip mechanism, or just list prep in the routing and let the agent handle it naturally?"
],
"success_criteria": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing resolved parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
],
"assumptions": [
"resolve_agent_mode() is safe to call before _run_worker \u2014 it reads config and CLI args but does not start any worker process or create sessions",
"All robustness levels gain prep via workflow hierarchy inheritance \u2014 light and tiny inherit from standard which inherits the base WORKFLOW",
"The prep prompt's skip mechanism is sufficient to prevent unnecessary investigation for trivial tasks at lower robustness levels",
"Status response consumers (subagent orchestration, tests) use field-name access and tolerate additional fields \u2014 verified by reading the subagent appendix instructions",
"handle_execute's dispatch functions (dispatch_execute_one_batch, dispatch_execute_auto_loop) eventually call save_state, so active_step clearing can be coordinated with their save points"
],
"delta_from_previous_percent": 55.36,
"structure_warnings": []
}
code
Gate signals:
{
"robustness": "standard",
"signals": {
"iteration": 2,
"idea": "Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.",
"significant_flags": 1,
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it creates a semantic mismatch with standard CLI conventions where implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using , but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
}
],
"weighted_score": 1.5,
"weighted_history": [
12.5
],
"plan_delta_from_previous": 55.36,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 2. Weighted score trajectory: 12.5 -> 1.5. Plan deltas: 55.4%. Recurring critiques: 0. Resolved flags: 7. Open significant flags: 1.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"warnings": [],
"criteria_check": {
"count": 13,
"items": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": true,
"addressed_in": "plan_v2.md",
"verified_in": "critique_v2.json"
}
]
}
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
}
]
code
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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 level. given that the plan currently removes the working mobile nav, there should be at least a or criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"criteria-prompt": [
{
"id": "DEBT-026",
"concern": "criteria prompt: v3 replaces in heavy mode with a new , so the plan no longer follows the brief's explicit requirement that remain the heavy-mode check.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"diff-capture": [
{
"id": "DEBT-027",
"concern": "diff capture: the proposed helper uses , which will miss untracked files even though the existing execution-evidence path already treats untracked files as real changed work.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 to carry mobile actions, the plan must also include a supporting change in or render a separate mobile control surface outside the card. right now step 4.9 removes the mobile nav but does not list 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"
]
},
{
"id": "DEBT-033",
"concern": "does the change touch all locations and supporting infrastructure?: the prior missing locations in and are now covered, but one supporting-infrastructure path is still absent from the steps: the repo-root generated schema copy under and the tests that read it directly. without either explicitly regenerating that file or changing those tests to materialize schemas in a temp root, the plan can still leave the runtime-schema copy out of sync with the raw registry.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 helper in only renders , so the step 7 requirement to assert cannot be implemented unless that helper is extended to expose . 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 .",
"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 would break mobile navigation and scoring because that footer slot is hidden below the breakpoint.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"runtime-schema-sync": [
{
"id": "DEBT-031",
"concern": "runtime schema sync: the plan still does not include an explicit refresh or validation step for the generated copy that repository tests read directly.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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. already has a pre-existing mobile gap because its score panel is desktop-only and its footer actions are also hidden on mobile ( plus ). 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"
]
},
{
"id": "DEBT-030",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the revised plan correctly narrows the schema-shape problem itself back to the six audited mismatches, but the generated runtime-schema consumer path is broader than the plan acknowledges: also reads the runtime schema from , so stale generated schema copies can affect more than the direct schema tests.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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": "are-the-proposed-changes-technically-correct",
"total_occurrences": 4,
"plan_count": 3,
"entries": [
{
"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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
]
},
{
"subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"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:
- Treat recurring debt as decision context, not background noise.
- If the current unresolved flags overlap an escalated subsystem, prefer recommending holistic redesign over another point fix.
Robustness level:
standard
Requirements:
- Decide exactly one of: PROCEED, ITERATE, ESCALATE.
- Use the weighted score, flag details (including `evidence`), plan delta, recurring critiques, and preflight results as judgment context.
- PROCEED when execution should move forward now.
- ITERATE when revising the plan is the best next move.
- ESCALATE when the loop is stuck, churn is recurring, or user intervention is needed.
- `signals_assessment`: one paragraph summarizing score trajectory, flag status, and preflight posture.
Flags come in two tiers:
- **Blocking** (severity = significant/likely-significant): These are serious concerns. If you PROCEED, any blocking flags you don't explicitly resolve will be implicitly accepted as tradeoffs.
- **Noted** (everything else): Acknowledge in your rationale but they don't block PROCEED.
If there are blocking flags and you want to PROCEED, you may provide `flag_resolutions` — one entry per flag you are explicitly resolving. Two actions are allowed:
- **dispute**: The critique was factually wrong. You MUST cite specific evidence (file path, line, API doc, etc.) proving the concern is invalid.
- **accept_tradeoff**: The concern is real but intentionally accepted as a known limitation. Always allowed; the flag is recorded as tech debt.
You may resolve at most 3 flags explicitly per gate call. Any remaining blocking flags are implicitly accepted as tradeoffs if you recommend PROCEED.
If a flag is structurally unresolvable (e.g., references infrastructure outside the repo), you should still PROCEED — do not loop indefinitely on flags that cannot be addressed.
If there are no blocking flags, `flag_resolutions` can be omitted.
Populate `settled_decisions` with design choices that should carry into review without re-litigation. Return `[]` when there are none.
Example:
```json
{
"recommendation": "PROCEED",
"rationale": "Core fix is correct. Convention concern accepted.",
"signals_assessment": "Score stable at 2.5, preflight passed, no recurring critiques.",
"warnings": ["Verify edge case with composite moduli during execution."],
"flag_resolutions": [
{"flag_id": "correctness-1", "action": "dispute", "evidence": "allow_migrate and allow_migrate_model produce identical behavior for this use case (verified at django/db/utils.py:286)."},
{"flag_id": "conventions-1", "action": "accept_tradeoff", "rationale": "Minor naming inconsistency; tracked as debt for later cleanup."}
],
"settled_decisions": []
}
```
{"recommendation":"PROCEED","rationale":"The plan is ready to execute. Score dropped from 12.5 to 1.5, 7 of 8 significant flags were resolved, and the remaining flag is a minor plan-text completeness issue rather than a design flaw. The core architecture is now coherent: active_step is lightweight state metadata, agent selection is anchored on resolve_agent_mode(), status/watch are additive observability improvements, and standard/light prep is both visible and actually consumed by the planning prompt. This is the right point to move into implementation rather than spend another loop polishing wording.","signals_assessment":"Iteration 2 materially improved the plan: weighted score moved from 12.5 to 1.5, unresolved significant flags fell from 8 to 1, plan delta was 55.36%, and there are no recurring critiques or scope-creep flags. Preflight remains fully green: the project directory exists and is writable, success criteria are present, and both Claude and Codex are available. The remaining concern is narrow and non-blocking relative to the now-stable overall design.","warnings":["During implementation, make the critique sequential path pass the already-resolved tuple into _run_worker(...) so the code matches the plan's single-resolution intent exactly."],"flag_resolutions":[{"flag_id":"all_locations","action":"dispute","evidence":"The revised plan already sets the invariant at Phase 1, Step 2: 'Instrument each handler that calls _run_worker — resolve agent first, set active_step, pass resolved through.' handle_critique is explicitly covered under that section, and its real-worker path is described as occurring after the existing resolve_agent_mode(\"critique\", args) call. The open flag is asking for an implementation detail that is already required by the plan-wide rule; it does not expose a remaining architectural gap."}],"settled_decisions":[{"id":"SD-001","decision":"Use resolve_agent_mode() as the single source of truth for active-step agent metadata.","rationale":"This avoids drift from routing fallbacks, model overrides, and availability checks already implemented in megaplan/workers.py."},{"id":"SD-002","decision":"Standard and light robustness should inherit the visible prep -> plan flow.","rationale":"_plan_prompt() already consumes prep.json, so the prep phase is real workflow context rather than cosmetic ceremony."},{"id":"SD-003","decision":"watch should be implemented as a real command that returns a composite observability view without introducing execute-style planning checkpoints.","rationale":"That matches the idea, keeps planning lightweight, and aligns docs/subagent instructions with the actual CLI."}]}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are the gatekeeper for the megaplan workflow. Make the continuation decision directly.
Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.
code
Plan:
# Implementation Plan: Fix Planning Lifecycle — Real In-Progress State, Status Enrichment, Doc Parity
Overview
Megaplan's planning lifecycle has four honest gaps:
No in-progress indicator: When a worker (plan, prep, critique, etc.) is running, state.json still shows the previous completed state (e.g. initialized). Status reports the plan as idle when it's actively working. There is no active_step concept.
Status is anemic: handle_status (cli.py:82-95) returns state, iteration, next_step, valid_next, and artifact list. It doesn't expose session metadata, cost accumulation, last step duration, or whether a worker is currently running.
watch is documented but unimplemented: README:91, instructions.md:116 both reference megaplan watch --plan <name>. No parser entry, no handler, no implementation exists.
Standard/light planning collapses investigation into a black box: Heavy robustness runs init → prep → plan. Standard overrides initialized to skip directly to plan (workflow.py:76-78). This means the planning agent silently does all codebase investigation inside the plan step with no visible prep artifact and no way to inspect what it found before the plan is generated.
Subagent command reference is stale: claude_subagent_appendix.md:247-273 omits list and watch from the command reference. Phase routing instructions only show prep for heavy.
Design constraint
The idea explicitly says: "Do not force execute-style checkpointing or batch semantics onto planning." The fix should be lightweight metadata — not task tracking, batch numbering, or progress percentages applied to planning phases.
Key verified facts
Prep is already consumed by planning: _plan_prompt() (prompts/planning.py:87) calls _render_prep_block(plan_dir) which reads prep.json from disk (prompts/_shared.py:124-252). Adding prep to standard/light will produce an artifact that the plan step actually reads. (Settles FLAG-002/scope.)
resolve_agent_mode() is side-effect-free: workers.py:1142-1227 resolves agent, mode, refreshed, and model from args/config without running any worker. It can be called before _run_worker to populate active_step. (Settles FLAG-001/correctness.)
Status response consumers are additive: The subagent reads state, next_step, valid_next from status output by name. Adding new fields is non-breaking. (Settles callers-1.)
Execute already calls resolve_agent_mode early: handle_execute (handlers.py:1069) resolves agent before dispatch. Active-step can be set between resolution and dispatch. (Settles callers-2 for execute.)
Tiny critique stubs without calling _run_worker: handle_critique (handlers.py:741-791) takes a fast path that creates a stub critique. Active-step must only be set on the real-worker path, not the stub path. (Settles all_locations.)
Phase 1: Active-Step Metadata and Status Enrichment
Step 1: Add active_step field to state types (megaplan/types.py)
Scope: Small
Add an ActiveStep TypedDict after SessionInfo at megaplan/types.py:~52:
python
class ActiveStep(TypedDict, total=False):
step: str # "plan", "prep", "critique", etc.
started_at: str # ISO UTC timestamp
session_key: str # session key being used
agent: str # "claude", "hermes", "codex"
Addactive_step: NotRequired[ActiveStep] to PlanState at megaplan/types.py:111.
Step 2: Wire active_step lifecycle around worker execution (megaplan/handlers.py, megaplan/workers.py)
Scope: Medium
The approach: call resolve_agent_mode() before the worker runs (it's already side-effect-free per workers.py:1142), set active_step, then pass the resolved tuple through to run_step_with_worker via its existing resolved parameter so the agent isn't resolved twice.
Add a helper _set_active_step(plan_dir, state, step, agent) in handlers.py that sets state["active_step"] and calls save_state(plan_dir, state).
Add a helper _clear_active_step(state) that does state.pop("active_step", None) (no save — the caller saves).
Refactor_run_worker (handlers.py:135-149) to accept an optional resolved tuple and pass it through to run_step_with_worker:
In _finish_step (handlers.py:174), add _clear_active_step(state) before the existing save_state call at line 213. This ensures active_step is cleared atomically with the state update on success.
In the except path of _run_worker, add _clear_active_step(state) before record_step_failure so failures also clear the marker. record_step_failure already calls save_state.
Instrument each handler that calls _run_worker — resolve agent first, set active_step, pass resolved through. For each handler:
handle_plan (handlers.py:667): Add before line 672:
Addactive_step to the status response when present in state — exposes what's currently running.
Add a staleness check: if active_step is present but started_at is older than 2 hours, add "possibly_stale": true to the active_step dict in the response.
Addlast_step: extract from the most recent history entry — {"step": ..., "result": ..., "duration_ms": ...}.
Addtotal_cost_usd from state["meta"].get("total_cost_usd", 0).
Addsessions summary: {key: {"last_used_at": info["last_used_at"]} for key, info in state["sessions"].items()}.
All new fields are additive. Existing consumers (subagent, tests) read by field name and ignore unknown keys. No breaking changes.
Step 4: Update tests for active_step and enriched status (tests/test_megaplan.py)
Scope: Medium
Add a test that runs a mock step (e.g. handle_plan) and verifies:
After step completion, state["active_step"] is absent (cleared by _finish_step).
The returned response has no active_step leak.
Add a test that verifies active_step is cleared on worker failure: monkeypatch _run_worker to raise, then assert active_step is not in saved state.
Add a test that calls handle_status on a state with active_step present and verifies the response includes it.
Add a test that calls handle_status and verifies last_step, total_cost_usd, sessions fields are present.
Update any existing tests that assert on exact status response keys if they break with the new fields (unlikely since existing tests don't strictly enumerate keys).
Phase 2: Watch Command
Step 5: Implement megaplan watch as a rich single-shot status (megaplan/cli.py)
Scope: Medium
The README says watch "shows current state, last completed phase, pending notes, and execution progress." This is a composite view — status + progress + notes in one call. Implement as a single-shot command that merges these views. Add --follow flag (optional, future) for continuous polling.
Addwatch to the argparse subparsers at cli.py:~516:
Status fields: state, iteration, next_step, valid_next, active_step (if present).
Last completed step from history.
Notes from state["meta"].get("notes", []).
Execution progress from finalize.json (reuse handle_progress logic or factor out a helper).
Cost summary from state["meta"].get("total_cost_usd", 0).
Session metadata.
Returns a StepResponse dict with all fields (JSON output, same as other commands).
Add"watch": handle_watch to COMMAND_HANDLERS at cli.py:630.
Test: Add a basic test that calls handle_watch and verifies the response shape includes status, notes, and progress fields.
Phase 3: Standard/Light Prep Visibility
Step 6: Enable prep for standard robustness (megaplan/_core/workflow.py:73-79)
Scope: Small
Remove the standard override at workflow.py:75-79:
python
# BEFORE
"standard": {
STATE_INITIALIZED: [
Transition("plan", STATE_PLANNED),
],
},
# AFTER
"standard": {},
With an empty standard override, standard inherits the base WORKFLOW which routes initialized → prep → plan.
Verify light and tiny inherit correctly via _ROBUSTNESS_WORKFLOW_LEVELS: "light": ("standard", "light") and "tiny": ("standard", "light", "tiny"). With standard now empty, all levels gain initialized → prep.
Confirmed: The plan step already consumes prep.json via _render_prep_block(plan_dir) in _plan_prompt() (prompts/planning.py:87, prompts/_shared.py:124). If prep.json doesn't exist (skip or not yet run), _render_prep_block returns empty strings — so the plan step degrades gracefully.
Confirmed: The prep prompt (planning.py:138-191) has a skip: true fast-path for trivial tasks. Adding prep to standard/light doesn't force unnecessary investigation.
Add a note in Phase Routing about the prep skip mechanism: "The prep agent may set skip: true for trivial tasks. When it does, proceed directly to plan — the empty prep artifact is expected."
Step 8: Update instructions.md and README.md for accuracy
Scope: Small
Verifymegaplan/data/instructions.md:116 — megaplan watch --plan <name> is already listed. Now that watch is implemented, it matches. Verify all other listed commands exist in the parser.
UpdateREADME.md:82-87 robustness descriptions:
light — prep + streamlined critique, fast
standard — prep + 4 critique checks (default)
heavy — prep + 8 critique checks + parallel review
Phase 4: Test Updates and Validation
Step 9: Update workflow tests for standard/light prep (tests/test_megaplan.py)
Scope: Medium
Updatetest_megaplan.py:175 — standard's initialized state next steps: change expected from ["plan"] to ["prep"].
Updatetest_megaplan.py:248 — standard's inferred next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:333 — light robustness next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:289 — heavy robustness test (already expects "prep", should still pass).
Search for any other tests that assert on standard/light workflow routing from initialized state and update them.
Runpython -m pytest tests/ -x to catch any remaining breakage.
Step 10: Run full validation
Scope: Small
Runpython -m pytest tests/ -x to verify all tests pass.
Verifymegaplan watch --plan <name> works on an existing plan directory.
Verifymegaplan status --plan <name> returns the enriched fields.
Execution Order
Steps 1-2 (active_step types and handler wiring) first — core behavioral change.
Step 3 (status enrichment) depends on Steps 1-2.
Step 4 (active_step tests) after Steps 1-3.
Step 5 (watch command) can proceed after Step 3 since it reuses the enriched status data.
Steps 6-8 (prep workflow + docs) are independent of Steps 1-5 and can be done in parallel.
Step 9 (workflow test updates) after Step 6.
Step 10 (full validation) last.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Steps 1-4.
Run python -m pytest tests/ -x after all code changes.
Manual smoke test: megaplan init, megaplan status, megaplan watch on a test plan.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-04-09T19:31:23Z",
"hash": "sha256:a096e53224b8a2ec8cc8175dd91c1ba72647afa6bd73e053cf74e240e2aab8f9",
"changes_summary": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"issue_hints",
"correctness",
"scope",
"all_locations",
"callers-1",
"callers-2"
],
"questions": [
"Should the watch command also support a --follow flag for continuous polling in a future iteration, or is single-shot sufficient for now?",
"When standard/light gain prep, should the subagent instructions explicitly mention the prep skip mechanism, or just list prep in the routing and let the agent handle it naturally?"
],
"success_criteria": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing resolved parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
],
"assumptions": [
"resolve_agent_mode() is safe to call before _run_worker \u2014 it reads config and CLI args but does not start any worker process or create sessions",
"All robustness levels gain prep via workflow hierarchy inheritance \u2014 light and tiny inherit from standard which inherits the base WORKFLOW",
"The prep prompt's skip mechanism is sufficient to prevent unnecessary investigation for trivial tasks at lower robustness levels",
"Status response consumers (subagent orchestration, tests) use field-name access and tolerate additional fields \u2014 verified by reading the subagent appendix instructions",
"handle_execute's dispatch functions (dispatch_execute_one_batch, dispatch_execute_auto_loop) eventually call save_state, so active_step clearing can be coordinated with their save points"
],
"delta_from_previous_percent": 55.36,
"structure_warnings": []
}
code
Gate signals:
{
"robustness": "standard",
"signals": {
"iteration": 2,
"idea": "Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.",
"significant_flags": 1,
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it creates a semantic mismatch with standard CLI conventions where implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using , but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
}
],
"weighted_score": 1.5,
"weighted_history": [
12.5
],
"plan_delta_from_previous": 55.36,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 2. Weighted score trajectory: 12.5 -> 1.5. Plan deltas: 55.4%. Recurring critiques: 0. Resolved flags: 7. Open significant flags: 1.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"warnings": [],
"criteria_check": {
"count": 13,
"items": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": true,
"addressed_in": "plan_v2.md",
"verified_in": "critique_v2.json"
}
]
}
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
}
]
code
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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 level. given that the plan currently removes the working mobile nav, there should be at least a or criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"criteria-prompt": [
{
"id": "DEBT-026",
"concern": "criteria prompt: v3 replaces in heavy mode with a new , so the plan no longer follows the brief's explicit requirement that remain the heavy-mode check.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"diff-capture": [
{
"id": "DEBT-027",
"concern": "diff capture: the proposed helper uses , which will miss untracked files even though the existing execution-evidence path already treats untracked files as real changed work.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 to carry mobile actions, the plan must also include a supporting change in or render a separate mobile control surface outside the card. right now step 4.9 removes the mobile nav but does not list 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"
]
},
{
"id": "DEBT-033",
"concern": "does the change touch all locations and supporting infrastructure?: the prior missing locations in and are now covered, but one supporting-infrastructure path is still absent from the steps: the repo-root generated schema copy under and the tests that read it directly. without either explicitly regenerating that file or changing those tests to materialize schemas in a temp root, the plan can still leave the runtime-schema copy out of sync with the raw registry.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 helper in only renders , so the step 7 requirement to assert cannot be implemented unless that helper is extended to expose . 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 .",
"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 would break mobile navigation and scoring because that footer slot is hidden below the breakpoint.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"runtime-schema-sync": [
{
"id": "DEBT-031",
"concern": "runtime schema sync: the plan still does not include an explicit refresh or validation step for the generated copy that repository tests read directly.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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. already has a pre-existing mobile gap because its score panel is desktop-only and its footer actions are also hidden on mobile ( plus ). 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"
]
},
{
"id": "DEBT-030",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the revised plan correctly narrows the schema-shape problem itself back to the six audited mismatches, but the generated runtime-schema consumer path is broader than the plan acknowledges: also reads the runtime schema from , so stale generated schema copies can affect more than the direct schema tests.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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": "are-the-proposed-changes-technically-correct",
"total_occurrences": 4,
"plan_count": 3,
"entries": [
{
"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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
]
},
{
"subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"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:
- Treat recurring debt as decision context, not background noise.
- If the current unresolved flags overlap an escalated subsystem, prefer recommending holistic redesign over another point fix.
Robustness level:
standard
Requirements:
- Decide exactly one of: PROCEED, ITERATE, ESCALATE.
- Use the weighted score, flag details (including `evidence`), plan delta, recurring critiques, and preflight results as judgment context.
- PROCEED when execution should move forward now.
- ITERATE when revising the plan is the best next move.
- ESCALATE when the loop is stuck, churn is recurring, or user intervention is needed.
- `signals_assessment`: one paragraph summarizing score trajectory, flag status, and preflight posture.
Flags come in two tiers:
- **Blocking** (severity = significant/likely-significant): These are serious concerns. If you PROCEED, any blocking flags you don't explicitly resolve will be implicitly accepted as tradeoffs.
- **Noted** (everything else): Acknowledge in your rationale but they don't block PROCEED.
If there are blocking flags and you want to PROCEED, you may provide `flag_resolutions` — one entry per flag you are explicitly resolving. Two actions are allowed:
- **dispute**: The critique was factually wrong. You MUST cite specific evidence (file path, line, API doc, etc.) proving the concern is invalid.
- **accept_tradeoff**: The concern is real but intentionally accepted as a known limitation. Always allowed; the flag is recorded as tech debt.
You may resolve at most 3 flags explicitly per gate call. Any remaining blocking flags are implicitly accepted as tradeoffs if you recommend PROCEED.
If a flag is structurally unresolvable (e.g., references infrastructure outside the repo), you should still PROCEED — do not loop indefinitely on flags that cannot be addressed.
If there are no blocking flags, `flag_resolutions` can be omitted.
Populate `settled_decisions` with design choices that should carry into review without re-litigation. Return `[]` when there are none.
Example:
```json
{
"recommendation": "PROCEED",
"rationale": "Core fix is correct. Convention concern accepted.",
"signals_assessment": "Score stable at 2.5, preflight passed, no recurring critiques.",
"warnings": ["Verify edge case with composite moduli during execution."],
"flag_resolutions": [
{"flag_id": "correctness-1", "action": "dispute", "evidence": "allow_migrate and allow_migrate_model produce identical behavior for this use case (verified at django/db/utils.py:286)."},
{"flag_id": "conventions-1", "action": "accept_tradeoff", "rationale": "Minor naming inconsistency; tracked as debt for later cleanup."}
],
"settled_decisions": []
}
```
{"recommendation":"PROCEED","rationale":"The plan is ready to execute. Score dropped from 12.5 to 1.5, 7 of 8 significant flags were resolved, and the remaining flag is a minor plan-text completeness issue rather than a design flaw. The core architecture is now coherent: active_step is lightweight state metadata, agent selection is anchored on resolve_agent_mode(), status/watch are additive observability improvements, and standard/light prep is both visible and actually consumed by the planning prompt. This is the right point to move into implementation rather than spend another loop polishing wording.","signals_assessment":"Iteration 2 materially improved the plan: weighted score moved from 12.5 to 1.5, unresolved significant flags fell from 8 to 1, plan delta was 55.36%, and there are no recurring critiques or scope-creep flags. Preflight remains fully green: the project directory exists and is writable, success criteria are present, and both Claude and Codex are available. The remaining concern is narrow and non-blocking relative to the now-stable overall design.","warnings":["During implementation, make the critique sequential path pass the already-resolved tuple into _run_worker(...) so the code matches the plan's single-resolution intent exactly."],"flag_resolutions":[{"flag_id":"all_locations","action":"dispute","evidence":"The revised plan already sets the invariant at Phase 1, Step 2: 'Instrument each handler that calls _run_worker — resolve agent first, set active_step, pass resolved through.' handle_critique is explicitly covered under that section, and its real-worker path is described as occurring after the existing resolve_agent_mode(\"critique\", args) call. The open flag is asking for an implementation detail that is already required by the plan-wide rule; it does not expose a remaining architectural gap."}],"settled_decisions":[{"id":"SD-001","decision":"Use resolve_agent_mode() as the single source of truth for active-step agent metadata.","rationale":"This avoids drift from routing fallbacks, model overrides, and availability checks already implemented in megaplan/workers.py."},{"id":"SD-002","decision":"Standard and light robustness should inherit the visible prep -> plan flow.","rationale":"_plan_prompt() already consumes prep.json, so the prep phase is real workflow context rather than cosmetic ceremony."},{"id":"SD-003","decision":"watch should be implemented as a real command that returns a composite observability view without introducing execute-style planning checkpoints.","rationale":"That matches the idea, keeps planning lightweight, and aligns docs/subagent instructions with the actual CLI."}]}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
You are the gatekeeper for the megaplan workflow. Make the continuation decision directly.
Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.
code
Plan:
# Implementation Plan: Fix Planning Lifecycle — Real In-Progress State, Status Enrichment, Doc Parity
Overview
Megaplan's planning lifecycle has four honest gaps:
No in-progress indicator: When a worker (plan, prep, critique, etc.) is running, state.json still shows the previous completed state (e.g. initialized). Status reports the plan as idle when it's actively working. There is no active_step concept.
Status is anemic: handle_status (cli.py:82-95) returns state, iteration, next_step, valid_next, and artifact list. It doesn't expose session metadata, cost accumulation, last step duration, or whether a worker is currently running.
watch is documented but unimplemented: README:91, instructions.md:116 both reference megaplan watch --plan <name>. No parser entry, no handler, no implementation exists.
Standard/light planning collapses investigation into a black box: Heavy robustness runs init → prep → plan. Standard overrides initialized to skip directly to plan (workflow.py:76-78). This means the planning agent silently does all codebase investigation inside the plan step with no visible prep artifact and no way to inspect what it found before the plan is generated.
Subagent command reference is stale: claude_subagent_appendix.md:247-273 omits list and watch from the command reference. Phase routing instructions only show prep for heavy.
Design constraint
The idea explicitly says: "Do not force execute-style checkpointing or batch semantics onto planning." The fix should be lightweight metadata — not task tracking, batch numbering, or progress percentages applied to planning phases.
Key verified facts
Prep is already consumed by planning: _plan_prompt() (prompts/planning.py:87) calls _render_prep_block(plan_dir) which reads prep.json from disk (prompts/_shared.py:124-252). Adding prep to standard/light will produce an artifact that the plan step actually reads. (Settles FLAG-002/scope.)
resolve_agent_mode() is side-effect-free: workers.py:1142-1227 resolves agent, mode, refreshed, and model from args/config without running any worker. It can be called before _run_worker to populate active_step. (Settles FLAG-001/correctness.)
Status response consumers are additive: The subagent reads state, next_step, valid_next from status output by name. Adding new fields is non-breaking. (Settles callers-1.)
Execute already calls resolve_agent_mode early: handle_execute (handlers.py:1069) resolves agent before dispatch. Active-step can be set between resolution and dispatch. (Settles callers-2 for execute.)
Tiny critique stubs without calling _run_worker: handle_critique (handlers.py:741-791) takes a fast path that creates a stub critique. Active-step must only be set on the real-worker path, not the stub path. (Settles all_locations.)
Phase 1: Active-Step Metadata and Status Enrichment
Step 1: Add active_step field to state types (megaplan/types.py)
Scope: Small
Add an ActiveStep TypedDict after SessionInfo at megaplan/types.py:~52:
python
class ActiveStep(TypedDict, total=False):
step: str # "plan", "prep", "critique", etc.
started_at: str # ISO UTC timestamp
session_key: str # session key being used
agent: str # "claude", "hermes", "codex"
Addactive_step: NotRequired[ActiveStep] to PlanState at megaplan/types.py:111.
Step 2: Wire active_step lifecycle around worker execution (megaplan/handlers.py, megaplan/workers.py)
Scope: Medium
The approach: call resolve_agent_mode() before the worker runs (it's already side-effect-free per workers.py:1142), set active_step, then pass the resolved tuple through to run_step_with_worker via its existing resolved parameter so the agent isn't resolved twice.
Add a helper _set_active_step(plan_dir, state, step, agent) in handlers.py that sets state["active_step"] and calls save_state(plan_dir, state).
Add a helper _clear_active_step(state) that does state.pop("active_step", None) (no save — the caller saves).
Refactor_run_worker (handlers.py:135-149) to accept an optional resolved tuple and pass it through to run_step_with_worker:
In _finish_step (handlers.py:174), add _clear_active_step(state) before the existing save_state call at line 213. This ensures active_step is cleared atomically with the state update on success.
In the except path of _run_worker, add _clear_active_step(state) before record_step_failure so failures also clear the marker. record_step_failure already calls save_state.
Instrument each handler that calls _run_worker — resolve agent first, set active_step, pass resolved through. For each handler:
handle_plan (handlers.py:667): Add before line 672:
Addactive_step to the status response when present in state — exposes what's currently running.
Add a staleness check: if active_step is present but started_at is older than 2 hours, add "possibly_stale": true to the active_step dict in the response.
Addlast_step: extract from the most recent history entry — {"step": ..., "result": ..., "duration_ms": ...}.
Addtotal_cost_usd from state["meta"].get("total_cost_usd", 0).
Addsessions summary: {key: {"last_used_at": info["last_used_at"]} for key, info in state["sessions"].items()}.
All new fields are additive. Existing consumers (subagent, tests) read by field name and ignore unknown keys. No breaking changes.
Step 4: Update tests for active_step and enriched status (tests/test_megaplan.py)
Scope: Medium
Add a test that runs a mock step (e.g. handle_plan) and verifies:
After step completion, state["active_step"] is absent (cleared by _finish_step).
The returned response has no active_step leak.
Add a test that verifies active_step is cleared on worker failure: monkeypatch _run_worker to raise, then assert active_step is not in saved state.
Add a test that calls handle_status on a state with active_step present and verifies the response includes it.
Add a test that calls handle_status and verifies last_step, total_cost_usd, sessions fields are present.
Update any existing tests that assert on exact status response keys if they break with the new fields (unlikely since existing tests don't strictly enumerate keys).
Phase 2: Watch Command
Step 5: Implement megaplan watch as a rich single-shot status (megaplan/cli.py)
Scope: Medium
The README says watch "shows current state, last completed phase, pending notes, and execution progress." This is a composite view — status + progress + notes in one call. Implement as a single-shot command that merges these views. Add --follow flag (optional, future) for continuous polling.
Addwatch to the argparse subparsers at cli.py:~516:
Status fields: state, iteration, next_step, valid_next, active_step (if present).
Last completed step from history.
Notes from state["meta"].get("notes", []).
Execution progress from finalize.json (reuse handle_progress logic or factor out a helper).
Cost summary from state["meta"].get("total_cost_usd", 0).
Session metadata.
Returns a StepResponse dict with all fields (JSON output, same as other commands).
Add"watch": handle_watch to COMMAND_HANDLERS at cli.py:630.
Test: Add a basic test that calls handle_watch and verifies the response shape includes status, notes, and progress fields.
Phase 3: Standard/Light Prep Visibility
Step 6: Enable prep for standard robustness (megaplan/_core/workflow.py:73-79)
Scope: Small
Remove the standard override at workflow.py:75-79:
python
# BEFORE
"standard": {
STATE_INITIALIZED: [
Transition("plan", STATE_PLANNED),
],
},
# AFTER
"standard": {},
With an empty standard override, standard inherits the base WORKFLOW which routes initialized → prep → plan.
Verify light and tiny inherit correctly via _ROBUSTNESS_WORKFLOW_LEVELS: "light": ("standard", "light") and "tiny": ("standard", "light", "tiny"). With standard now empty, all levels gain initialized → prep.
Confirmed: The plan step already consumes prep.json via _render_prep_block(plan_dir) in _plan_prompt() (prompts/planning.py:87, prompts/_shared.py:124). If prep.json doesn't exist (skip or not yet run), _render_prep_block returns empty strings — so the plan step degrades gracefully.
Confirmed: The prep prompt (planning.py:138-191) has a skip: true fast-path for trivial tasks. Adding prep to standard/light doesn't force unnecessary investigation.
Add a note in Phase Routing about the prep skip mechanism: "The prep agent may set skip: true for trivial tasks. When it does, proceed directly to plan — the empty prep artifact is expected."
Step 8: Update instructions.md and README.md for accuracy
Scope: Small
Verifymegaplan/data/instructions.md:116 — megaplan watch --plan <name> is already listed. Now that watch is implemented, it matches. Verify all other listed commands exist in the parser.
UpdateREADME.md:82-87 robustness descriptions:
light — prep + streamlined critique, fast
standard — prep + 4 critique checks (default)
heavy — prep + 8 critique checks + parallel review
Phase 4: Test Updates and Validation
Step 9: Update workflow tests for standard/light prep (tests/test_megaplan.py)
Scope: Medium
Updatetest_megaplan.py:175 — standard's initialized state next steps: change expected from ["plan"] to ["prep"].
Updatetest_megaplan.py:248 — standard's inferred next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:333 — light robustness next step from initialized: change expected from "plan" to "prep".
Updatetest_megaplan.py:289 — heavy robustness test (already expects "prep", should still pass).
Search for any other tests that assert on standard/light workflow routing from initialized state and update them.
Runpython -m pytest tests/ -x to catch any remaining breakage.
Step 10: Run full validation
Scope: Small
Runpython -m pytest tests/ -x to verify all tests pass.
Verifymegaplan watch --plan <name> works on an existing plan directory.
Verifymegaplan status --plan <name> returns the enriched fields.
Execution Order
Steps 1-2 (active_step types and handler wiring) first — core behavioral change.
Step 3 (status enrichment) depends on Steps 1-2.
Step 4 (active_step tests) after Steps 1-3.
Step 5 (watch command) can proceed after Step 3 since it reuses the enriched status data.
Steps 6-8 (prep workflow + docs) are independent of Steps 1-5 and can be done in parallel.
Step 9 (workflow test updates) after Step 6.
Step 10 (full validation) last.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Steps 1-4.
Run python -m pytest tests/ -x after all code changes.
Manual smoke test: megaplan init, megaplan status, megaplan watch on a test plan.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-04-09T19:31:23Z",
"hash": "sha256:a096e53224b8a2ec8cc8175dd91c1ba72647afa6bd73e053cf74e240e2aab8f9",
"changes_summary": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"issue_hints",
"correctness",
"scope",
"all_locations",
"callers-1",
"callers-2"
],
"questions": [
"Should the watch command also support a --follow flag for continuous polling in a future iteration, or is single-shot sufficient for now?",
"When standard/light gain prep, should the subagent instructions explicitly mention the prep skip mechanism, or just list prep in the routing and let the agent handle it naturally?"
],
"success_criteria": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing resolved parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
],
"assumptions": [
"resolve_agent_mode() is safe to call before _run_worker \u2014 it reads config and CLI args but does not start any worker process or create sessions",
"All robustness levels gain prep via workflow hierarchy inheritance \u2014 light and tiny inherit from standard which inherits the base WORKFLOW",
"The prep prompt's skip mechanism is sufficient to prevent unnecessary investigation for trivial tasks at lower robustness levels",
"Status response consumers (subagent orchestration, tests) use field-name access and tolerate additional fields \u2014 verified by reading the subagent appendix instructions",
"handle_execute's dispatch functions (dispatch_execute_one_batch, dispatch_execute_auto_loop) eventually call save_state, so active_step clearing can be coordinated with their save points"
],
"delta_from_previous_percent": 55.36,
"structure_warnings": []
}
code
Gate signals:
{
"robustness": "standard",
"signals": {
"iteration": 2,
"idea": "Fix megaplan's planning lifecycle honestly, not cosmetically: planning should have a real in-progress workflow state instead of looking initialized until completion; status/watch should project that real state and active worker/session metadata; docs and subagent instructions must match the actual CLI; and standard/light planning should stop quietly collapsing large repo investigation into a black-box plan step. Do not force execute-style checkpointing or batch semantics onto planning.",
"significant_flags": 1,
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [
{
"id": "FLAG-001",
"concern": "Agent resolution: the plan's shortcut formula (args.agent or state.config.agents.step) is an incomplete reimplementation of resolve_agent_mode() which has 5 priority levels, availability fallbacks, and model overrides. Using it for active_step.agent would produce incorrect metadata in many configurations.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing resolved parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "FLAG-002",
"concern": "Prep artifact consumption: the plan adds prep to standard/light but doesn't verify that the plan step's prompt builder reads prep.json. If it doesn't, prep generates an unused artifact and the investigation is still invisible to the planning agent \u2014 the exact problem the plan claims to fix.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: The idea says 'status/watch should project that real state and active worker/session metadata.' The plan addresses this in Steps 3 and 5. However, Step 5 makes a decision to implement watch as 'single-shot enhanced status' rather than a polling/streaming command. The README (line ~91) says 'Shows current state, last completed phase, pending notes, and execution progress' which is compatible with single-shot, but calling it creates a semantic mismatch with standard CLI conventions where implies continuous observation. The plan acknowledges this tension but proceeds anyway.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Step 2 says to call _set_active_step before _run_worker in each handler (handle_plan at :667, handle_prep at :713, etc.). But the plan also says to determine the agent string before the worker call. Currently resolve_agent_mode() is called inside run_step_with_worker() (workers.py:1223-1269), and _run_worker in handlers.py has no access to it beforehand. The plan suggests factoring out resolve_agent or using , but this would be an incomplete reimplementation \u2014 resolve_agent_mode has complex fallback logic including --phase-model, --hermes flag, config file, availability checks, and model overrides (workers.py:1135-1220). The plan's shortcut formula would produce different agent strings than the actual worker uses in many cases.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Existing debt DEBT-006/007/008 documents that _plan_prompt() doesn't read research.json, so replanning from state_researched ignores research results. The plan adds prep to standard/light, generating a prep.json artifact. But the planning prompt needs to actually consume prep.json when building the plan prompt. The plan doesn't verify that the plan step's prompt builder reads prep.json \u2014 if it doesn't, adding prep to standard/light would generate an unused artifact. This is critical to the 'stop collapsing investigation into a black box' goal.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-1",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: handle_status (cli.py:82-95) is called by the CLI dispatch and also by the plan's new handle_watch (Step 5). The status response currently returns a fixed shape. Step 3 adds new fields (active_step, sessions, last_step, total_cost_usd). Any consumer that does strict key checking on the status response could break. The subagent orchestration in the megaplan skill calls handle_status \u2014 if it parses the response strictly, the new fields could cause issues. The plan's Step 4 mentions updating tests that assert exact response shape, but doesn't mention checking subagent/skill consumers.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
},
{
"id": "callers-2",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: _run_worker (handlers.py:135-149) is called by all step handlers. The plan modifies the behavior around this function (set active_step before, clear after). But handle_critique has two code paths: one that calls _run_worker (standard/heavy) and one that stubs (tiny). handle_execute also has complex dispatch \u2014 it calls dispatch_execute_one_batch or dispatch_execute_auto_loop rather than _run_worker directly. The plan lists handle_execute in Step 2's handler list, but execute's worker invocation goes through a different path than _run_worker.",
"resolution": "Revised the plan to address all 8 significant flags from critique. Key changes: (1) Use resolve_agent_mode() directly instead of reimplementing agent resolution \u2014 it's side-effect-free and already has an existing parameter on run_step_with_worker. (2) Confirmed prep.json is already consumed by _plan_prompt via _render_prep_block, so enabling prep for standard/light actually works end-to-end. (3) Restructured active_step instrumentation to account for handle_critique's tiny stub path (no active_step on stub), handle_execute's separate dispatch path (resolve already happens at line 1069), and handle_review's multiple branches. (4) Changed watch from a renamed single-shot status into a composite view that merges status + progress + notes \u2014 matching the README description while being an actual command (not a renamed status). (5) Confirmed status response consumers use field-name access (additive changes are safe). (6) Added try/finally safety net for active_step cleanup."
}
],
"weighted_score": 1.5,
"weighted_history": [
12.5
],
"plan_delta_from_previous": 55.36,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 2. Weighted score trajectory: 12.5 -> 1.5. Plan deltas: 55.4%. Recurring critiques: 0. Resolved flags: 7. Open significant flags: 1.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"warnings": [],
"criteria_check": {
"count": 13,
"items": [
{
"criterion": "handle_status returns active_step metadata when a worker is running, and omits it when no worker is running",
"priority": "must"
},
{
"criterion": "active_step is written to state.json before worker invocation and cleared after completion or error (including in handle_execute dispatch and handle_critique stub paths)",
"priority": "must"
},
{
"criterion": "resolve_agent_mode() is called once per handler invocation \u2014 the resolved tuple is passed through to run_step_with_worker via its existing parameter, not re-resolved",
"priority": "must"
},
{
"criterion": "megaplan watch --plan is a valid CLI command that returns a composite view: status + progress + notes + cost",
"priority": "must"
},
{
"criterion": "Standard and light robustness route initialized -> prep -> plan instead of initialized -> plan",
"priority": "must"
},
{
"criterion": "claude_subagent_appendix.md command reference includes watch, list, and phase routing shows prep for all robustness levels",
"priority": "must"
},
{
"criterion": "instructions.md commands section matches the implemented CLI commands",
"priority": "must"
},
{
"criterion": "All existing tests pass after updates (python -m pytest tests/)",
"priority": "must"
},
{
"criterion": "handle_status response includes sessions summary, last_step, and total_cost_usd",
"priority": "should"
},
{
"criterion": "active_step includes a staleness indicator when started_at is older than threshold",
"priority": "should"
},
{
"criterion": "README robustness descriptions updated to reflect standard/light having prep",
"priority": "should"
},
{
"criterion": "New tests cover active_step lifecycle (set before worker, cleared after success, cleared after failure) and enriched status fields",
"priority": "should"
},
{
"criterion": "handle_critique tiny stub path does not set or leak active_step",
"priority": "must"
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass . The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": true,
"addressed_in": "plan_v2.md",
"verified_in": "critique_v2.json"
}
]
}
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"evidence": "The plan adds _set_active_step and _clear_active_step helpers to handlers.py. _run_worker (handlers.py:135) is modified to accept a resolved parameter. But _run_worker is also called directly by handle_critique's sequential fallback at line 801 and 803. These calls currently don't pass resolved. The plan's Step 2.6 for handle_critique says to set active_step after resolution at line 794 \u2014 but the _run_worker calls at 801/803 would re-resolve the agent internally (since resolved isn't passed). This means the agent is resolved twice on the critique sequential path. The double-resolution is wasteful but correct (same result). However, to match the plan's goal of 'resolve_agent_mode() is called once per handler invocation', the resolved tuple should be passed to these _run_worker calls too.",
"category": "completeness",
"severity": "significant",
"status": "open",
"weight": null
}
]
code
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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 level. given that the plan currently removes the working mobile nav, there should be at least a or criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"criteria-prompt": [
{
"id": "DEBT-026",
"concern": "criteria prompt: v3 replaces in heavy mode with a new , so the plan no longer follows the brief's explicit requirement that remain the heavy-mode check.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"diff-capture": [
{
"id": "DEBT-027",
"concern": "diff capture: the proposed helper uses , which will miss untracked files even though the existing execution-evidence path already treats untracked files as real changed work.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
],
"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 to carry mobile actions, the plan must also include a supporting change in or render a separate mobile control surface outside the card. right now step 4.9 removes the mobile nav but does not list 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"
]
},
{
"id": "DEBT-033",
"concern": "does the change touch all locations and supporting infrastructure?: the prior missing locations in and are now covered, but one supporting-infrastructure path is still absent from the steps: the repo-root generated schema copy under and the tests that read it directly. without either explicitly regenerating that file or changing those tests to materialize schemas in a temp root, the plan can still leave the runtime-schema copy out of sync with the raw registry.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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 helper in only renders , so the step 7 requirement to assert cannot be implemented unless that helper is extended to expose . 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 .",
"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 would break mobile navigation and scoring because that footer slot is hidden below the breakpoint.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"runtime-schema-sync": [
{
"id": "DEBT-031",
"concern": "runtime schema sync: the plan still does not include an explicit refresh or validation step for the generated copy that repository tests read directly.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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. already has a pre-existing mobile gap because its score panel is desktop-only and its footer actions are also hidden on mobile ( plus ). 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"
]
},
{
"id": "DEBT-030",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the revised plan correctly narrows the schema-shape problem itself back to the six audited mismatches, but the generated runtime-schema consumer path is broader than the plan acknowledges: also reads the runtime schema from , so stale generated schema copies can affect more than the direct schema tests.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
],
"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": "are-the-proposed-changes-technically-correct",
"total_occurrences": 4,
"plan_count": 3,
"entries": [
{
"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"
]
},
{
"id": "DEBT-029",
"concern": "are the proposed changes technically correct?: checked the new diff-helper proposal against the repo's existing execution-evidence semantics. validate_execution_evidence() in megaplan/evaluation.py:109-175 uses git status --short, so untracked files count as real changed files today, but step 3 proposes collect_git_diff_patch(project_dir) via git diff head; by git behavior that will not include untracked files, so heavy review could miss exactly the newly created files that execute and review already treat as part of the patch.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
},
{
"id": "DEBT-032",
"concern": "are the proposed changes technically correct?: a generated-schema gap remains. tests/test_schemas.py reads the repo-root .megaplan/schemas/review.json directly via _review_disk_schema(), the checked-in local file is currently stale relative to schemas, and ensure_runtime_layout() in megaplan/_core/io.py is the production writer for that file class. the plan says generated schemas must stay aligned, but it never names a regeneration step or a test adjustment for that disk-schema path, so the validation story is still incomplete.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"subsystem": "did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 slot in submissioncarouselcard', but renders inside . in the current repo, the mobile sticky nav at 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 . the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-028",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: checked step 7 against the brief's explicit prompt-builder requirement. the revision fixes the old context leak by introducing a brand-new , but the brief said should stay as-is and still run as the check in heavy mode; v3 solves the problem by replacing that heavy-mode criteria path instead of reusing the baseline review prompt, which is still a material divergence from the requested design.",
"occurrence_count": 1,
"plan_ids": [
"robust-review-v2"
]
}
]
},
{
"subsystem": "find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them",
"total_occurrences": 3,
"plan_count": 2,
"entries": [
{
"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 looks redundant. optimistically adds the id to in , and already reactively filters skipped entries from in . calling 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. invokes its own prop when an unauthenticated user interacts with the score ui (), which is independent of the scoring hook's internal path. the plan should be read as requiring that caller to dispatch ; otherwise one caller remains broken even if is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-034",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i rechecked the caller paths after the revision. the raw-schema caller path through is now accounted for, but the runtime-schema caller path still is not: only reaches the on-disk runtime schemas through , while current tests like and consume the already-written repo copy directly. the plan does not yet say how that caller path gets refreshed or asserted after the code change.",
"occurrence_count": 1,
"plan_ids": [
"fix-the-6-remaining-openai-20260409-0502"
]
}
]
},
{
"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:
- Treat recurring debt as decision context, not background noise.
- If the current unresolved flags overlap an escalated subsystem, prefer recommending holistic redesign over another point fix.
Robustness level:
standard
Requirements:
- Decide exactly one of: PROCEED, ITERATE, ESCALATE.
- Use the weighted score, flag details (including `evidence`), plan delta, recurring critiques, and preflight results as judgment context.
- PROCEED when execution should move forward now.
- ITERATE when revising the plan is the best next move.
- ESCALATE when the loop is stuck, churn is recurring, or user intervention is needed.
- `signals_assessment`: one paragraph summarizing score trajectory, flag status, and preflight posture.
Flags come in two tiers:
- **Blocking** (severity = significant/likely-significant): These are serious concerns. If you PROCEED, any blocking flags you don't explicitly resolve will be implicitly accepted as tradeoffs.
- **Noted** (everything else): Acknowledge in your rationale but they don't block PROCEED.
If there are blocking flags and you want to PROCEED, you may provide `flag_resolutions` — one entry per flag you are explicitly resolving. Two actions are allowed:
- **dispute**: The critique was factually wrong. You MUST cite specific evidence (file path, line, API doc, etc.) proving the concern is invalid.
- **accept_tradeoff**: The concern is real but intentionally accepted as a known limitation. Always allowed; the flag is recorded as tech debt.
You may resolve at most 3 flags explicitly per gate call. Any remaining blocking flags are implicitly accepted as tradeoffs if you recommend PROCEED.
If a flag is structurally unresolvable (e.g., references infrastructure outside the repo), you should still PROCEED — do not loop indefinitely on flags that cannot be addressed.
If there are no blocking flags, `flag_resolutions` can be omitted.
Populate `settled_decisions` with design choices that should carry into review without re-litigation. Return `[]` when there are none.
Example:
```json
{
"recommendation": "PROCEED",
"rationale": "Core fix is correct. Convention concern accepted.",
"signals_assessment": "Score stable at 2.5, preflight passed, no recurring critiques.",
"warnings": ["Verify edge case with composite moduli during execution."],
"flag_resolutions": [
{"flag_id": "correctness-1", "action": "dispute", "evidence": "allow_migrate and allow_migrate_model produce identical behavior for this use case (verified at django/db/utils.py:286)."},
{"flag_id": "conventions-1", "action": "accept_tradeoff", "rationale": "Minor naming inconsistency; tracked as debt for later cleanup."}
],
"settled_decisions": []
}
```
{"recommendation":"PROCEED","rationale":"The plan should move forward. The score improved sharply from 12.5 to 1.5, seven significant flags are resolved, and the remaining flag is a narrow implementation-detail reminder rather than a design-level blocker. The plan now correctly anchors agent resolution on resolve_agent_mode(), confirms that prep.json is actually consumed by the planning prompt, covers the execute/review special paths, and keeps the fix lightweight instead of importing execute-style progress semantics into planning.","signals_assessment":"Iteration 2 shows a clear convergence signal: weighted score dropped from 12.5 to 1.5, plan delta is 55.36%, there are no recurring critiques, and preflight is fully green (project_dir_exists, project_dir_writable, success criteria present, Claude and Codex available). Only one significant flag remains, and it is limited to making the critique sequential path explicitly pass the already-resolved tuple so the single-resolution invariant is implemented consistently.","warnings":["Ensure the sequential handle_critique path passes resolved=... into _run_worker(...) so the implementation matches the plan's stated single-resolution rule."],"flag_resolutions":[{"flag_id":"all_locations","action":"accept_tradeoff","rationale":"The concern is real as an implementation reminder, but it is not a reason to re-open planning. The remaining work is a local consistency detail on the critique sequential path, not a gap in the overall design. Proceeding is lower-cost than another plan iteration, and the warning above captures the required follow-through."}],"settled_decisions":[{"id":"SD-001","decision":"active_step remains lightweight lifecycle metadata, not planning-task checkpointing.","rationale":"The idea explicitly rejects execute-style checkpoint semantics for planning."},{"id":"SD-002","decision":"Agent metadata for active_step must come from resolve_agent_mode(), with the resolved tuple threaded through worker execution.","rationale":"This keeps status truthful under config overrides, fallbacks, and model-routing behavior already implemented in megaplan/workers.py."},{"id":"SD-003","decision":"Standard and light robustness should route through visible prep before planning.","rationale":"_plan_prompt() already consumes prep.json, so enabling prep solves the black-box investigation problem rather than adding cosmetic ceremony."},{"id":"SD-004","decision":"watch should exist as a real CLI command that returns a composite observability view.","rationale":"That aligns the docs and subagent instructions with the actual CLI while keeping the output additive and machine-readable."}]}
“You are already running inside the megaplan harness for this step. Do the requested….” Conversation with gpt-5.4, from the Peter O’Mallet DataClaw Conversations dataset. The Chat Archive, 2026. https://thechatarchive.com/c/01m80eq59zzrz3dzq40jqaxssf
Dataset releases
Not yet included in a published release.
Change _run_worker call to pass resolved=resolved.
handle_prep (handlers.py:713): Same pattern — resolve, set, pass.
handle_critique (handlers.py:734): The handler has two paths:
Tiny stub path (line 741-791): No worker runs, so do NOT set active_step. The stub path already resolves the agent at line 771 for history recording. No active_step needed.
Real worker path (line 792+): Agent is already resolved at line 794 (agent_type, mode, refreshed, model = resolve_agent_mode("critique", args)). Set active_step after resolution, before the parallel or sequential worker dispatch.
handle_revise: Same resolve-set-pass pattern as plan/prep.
handle_gate: Same pattern.
handle_finalize: Same pattern.
handle_execute (handlers.py:1055): Agent is already resolved at line 1069. Add _set_active_step(plan_dir, state, "execute", agent) after the resolution and rework-refresh check (after line 1072), before the dispatch call. _clear_active_step happens in the dispatch functions' success path — both dispatch_execute_one_batch and dispatch_execute_auto_loop call _finish_step or save_state at the end. Add _clear_active_step(state) before their final save_state calls, or wrap the dispatch in try/finally in handle_execute.
handle_review: Same resolve-set-pass pattern. Review has multiple branches (parallel vs sequential, needs_rework vs approved) but all ultimately go through _finish_step or explicit save_state. _clear_active_step in _finish_step covers the normal path; add it to the error/exception paths.
Safety net: For handlers where active_step might leak on unexpected exceptions, wrap the worker invocation section in a try/finally that ensures _clear_active_step is called. The finally only clears in-memory; the next save_state (in _finish_step or error recording) persists it.
resolved
watch
watch
resolved
args.agent or state['config'].get('agents', {}).get(step, 'claude')
Change _run_worker call to pass resolved=resolved.
handle_prep (handlers.py:713): Same pattern — resolve, set, pass.
handle_critique (handlers.py:734): The handler has two paths:
Tiny stub path (line 741-791): No worker runs, so do NOT set active_step. The stub path already resolves the agent at line 771 for history recording. No active_step needed.
Real worker path (line 792+): Agent is already resolved at line 794 (agent_type, mode, refreshed, model = resolve_agent_mode("critique", args)). Set active_step after resolution, before the parallel or sequential worker dispatch.
handle_revise: Same resolve-set-pass pattern as plan/prep.
handle_gate: Same pattern.
handle_finalize: Same pattern.
handle_execute (handlers.py:1055): Agent is already resolved at line 1069. Add _set_active_step(plan_dir, state, "execute", agent) after the resolution and rework-refresh check (after line 1072), before the dispatch call. _clear_active_step happens in the dispatch functions' success path — both dispatch_execute_one_batch and dispatch_execute_auto_loop call _finish_step or save_state at the end. Add _clear_active_step(state) before their final save_state calls, or wrap the dispatch in try/finally in handle_execute.
handle_review: Same resolve-set-pass pattern. Review has multiple branches (parallel vs sequential, needs_rework vs approved) but all ultimately go through _finish_step or explicit save_state. _clear_active_step in _finish_step covers the normal path; add it to the error/exception paths.
Safety net: For handlers where active_step might leak on unexpected exceptions, wrap the worker invocation section in a try/finally that ensures _clear_active_step is called. The finally only clears in-memory; the next save_state (in _finish_step or error recording) persists it.
resolved
watch
watch
resolved
args.agent or state['config'].get('agents', {}).get(step, 'claude')
Change _run_worker call to pass resolved=resolved.
handle_prep (handlers.py:713): Same pattern — resolve, set, pass.
handle_critique (handlers.py:734): The handler has two paths:
Tiny stub path (line 741-791): No worker runs, so do NOT set active_step. The stub path already resolves the agent at line 771 for history recording. No active_step needed.
Real worker path (line 792+): Agent is already resolved at line 794 (agent_type, mode, refreshed, model = resolve_agent_mode("critique", args)). Set active_step after resolution, before the parallel or sequential worker dispatch.
handle_revise: Same resolve-set-pass pattern as plan/prep.
handle_gate: Same pattern.
handle_finalize: Same pattern.
handle_execute (handlers.py:1055): Agent is already resolved at line 1069. Add _set_active_step(plan_dir, state, "execute", agent) after the resolution and rework-refresh check (after line 1072), before the dispatch call. _clear_active_step happens in the dispatch functions' success path — both dispatch_execute_one_batch and dispatch_execute_auto_loop call _finish_step or save_state at the end. Add _clear_active_step(state) before their final save_state calls, or wrap the dispatch in try/finally in handle_execute.
handle_review: Same resolve-set-pass pattern. Review has multiple branches (parallel vs sequential, needs_rework vs approved) but all ultimately go through _finish_step or explicit save_state. _clear_active_step in _finish_step covers the normal path; add it to the error/exception paths.
Safety net: For handlers where active_step might leak on unexpected exceptions, wrap the worker invocation section in a try/finally that ensures _clear_active_step is called. The finally only clears in-memory; the next save_state (in _finish_step or error recording) persists it.
resolved
watch
watch
resolved
args.agent or state['config'].get('agents', {}).get(step, 'claude')