Refactor megaplan skill so that the entire workflow runs inside a Claude Code Agent (subagent) by default. The agent runs all phases autonomously (init→plan→critique→gate→revise loop→finalize→execute→review) and only 'breaks out' to the main conversation at defined breakpoints that require user input (gate escalate, execute approval in review mode, etc.). The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns via SendMessage, relays user answers, and reports the final result. This keeps the main context window clean and makes auto-approve runs fully hands-off. Reference the pattern used in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) for how the autonomous loop works, but adapt it to use Claude Code Agent+SendMessage instead of subprocess+feedback-injection.
Current state: The megaplan skill (.claude/skills/megaplan.md) is a set of instructions that tell the main Claude Code conversation how to orchestrate megaplan CLI calls. Each phase (init, plan, critique, gate, revise, finalize, execute, review) runs as a separate Bash tool call in the main context window. This means the main conversation accumulates all the CLI output, prompts, and orchestration reasoning across every phase — polluting context and making auto-approve runs require babysitting.
Goal: Move the entire workflow into a Claude Code Agent (subagent). The skill becomes a thin launcher that:
Triages the request (same as today)
Asks mode + robustness (same as today)
Launches a single Agent with a comprehensive prompt containing all workflow logic
Handles "breakpoint returns" — moments where the agent pauses and returns to the main conversation for user input (gate escalate, execute approval in review mode)
Relays user answers back to the agent via SendMessage
Reports the final result
Key constraint: The megaplan CLI, handlers, workers, and state machine are untouched. Only the Claude Code skill file changes. The CLI is already a clean state machine with next_step routing — the agent just drives it instead of the main conversation.
Reference pattern: The MegaLoop engine () demonstrates the autonomous loop: . The agent replicates this pattern but uses Claude Code's Agent tool + SendMessage instead of subprocess + feedback-injection.
Assistant
User
Assistant
I’m checking the revised plan against the repo paths and state machine that were problematic last round, then I’ll update the critique artifact with which flags are actually resolved and any new risks.
Assistant
I’ve confirmed the revised plan fixes the packaging and state-machine issues from the first pass. I’m now checking for second-order problems in the new test/update strategy and the breakpoint/success-criteria contract before I write the next critique.
User
Assistant
The revised plan fixes most of the repo-structure issues, but the new user constraint changes the acceptance bar: I’m checking whether the plan preserves inline mode as the default and whether the referenced auto-improve pattern implies any missing launcher/config mechanics.
Assistant
I’ve got the remaining deltas. The revised plan does fix the earlier source-of-truth and workflow issues, but it still misses the new user requirement that inline mode stay the default, and it doesn’t import the retry/escape guards from the referenced run_megaplan_loop pattern.
Assistant
Updated critique_output.json.
Main result: the revised plan does resolve the earlier source-of-truth and state-machine issues, and I marked those as verified. I flagged two new significant problems: it still makes subagent mode the default for Claude instead of keeping inline mode as the default with an opt-in switch, and it omits the retry/backoff/escalation guards that the referenced Hermes loop uses for repeated next_step=execute failures. I also kept the breakpoint-verification concern open because the plan still lacks explicit tests for ESCALATE, needs_rework, timeout/blocked retries, and the new mode-selection behavior.
User
Assistant
I’m checking the third revision against the real CLI/config/install surfaces now. The main questions are whether the new opt-in mode actually covers every supported setup path and whether the guessed retry caps match the accessible Hermes reference well enough to count as “sense-checked.”
Assistant
I’ve narrowed the remaining gaps to two concrete ones: the plan still ignores the supported setup --local/AGENTS.md installation path, and its new retry numbers are guessed even though the referenced Hermes loop is available and uses materially different safeguards. I’m writing those plus the remaining verification gap now.
Assistant
Updated critique_output.json.
This revision resolves the inline-default/mode-selection issue, the execute stop-condition issue, and the missing Claude-content test coverage; I marked those prior flags as verified. I left three concerns open:
FLAG-006: the plan still ignores the supported megaplan setup --local / AGENTS.md install path, so one real setup flow would never get the opt-in subagent mode.
FLAG-007: the plan says the Hermes reference is inaccessible and uses guessed retry counts, but the actual reference file is available and uses materially different safeguards.
verification-2: the highest-risk branches are still under-tested, especially ESCALATE, needs_rework, repeated next_step=execute, config-vs-per-run overrides, and the local setup path.
megaplan/loop/engine.py
while should_continue → run phase → save state → check breakpoints
Main Phase
Step 1: Audit current skill and define breakpoint protocol (.claude/skills/megaplan.md)
Scope: Small
Identify all user-facing breakpoints in the current skill:
Gate ESCALATE recommendation → user must decide (force-proceed / replan / abort) — always a breakpoint
Execute approval in review mode → user must explicitly approve — breakpoint only in review mode
Gate PROCEED in review mode → present gate result, ask user to confirm before execute — breakpoint only in review mode
Review needs_rework → inform user, but agent can auto-continue (return to execute) — not a breakpoint, just a status update
Define a structured breakpoint return format the agent uses when it needs user input:
code
BREAKPOINT: <type>
PLAN: <plan_name>
STATE: <current_state>
CONTEXT: <what happened and what the user needs to decide>
OPTIONS: <available choices>
The main conversation parses this and presents it to the user.
Breakpoint protocol: when to pause and return vs. when to continue autonomously
Session and override commands
A "Breakpoint Handling" section telling the main conversation how to:
Detect that the agent returned with a breakpoint (vs. final completion)
Present the breakpoint context to the user
Relay the user's decision back via SendMessage
Handle the agent's final completion message
Structure the agent prompt with clear sections:
markdown
## Your Role
You are an autonomous megaplan orchestrator...
## Workflow
Run phases in order, following next_step from CLI output...
## Phase Rules
(All current step rules, condensed)
## Breakpoint Protocol
- Auto-approve mode: NO breakpoints. Run init→...→review without stopping.
- Review mode: STOP at gate-to-execute transition. Return breakpoint message.
- Always: STOP on gate ESCALATE. Return breakpoint message.
## When Resuming After Breakpoint
You will receive a SendMessage with the user's decision. Continue from where you stopped.
## Completion
When done (STATE_DONE or ABORTED), return a summary with...
Step 3: Handle auto-approve vs review mode divergence
Scope: Small
Auto-approve mode: Agent runs fully autonomously. The Agent tool call completes when the workflow reaches STATE_DONE or a terminal state. Main conversation just reports the result. No SendMessage needed.
Review mode: Agent runs until the gate-to-execute breakpoint. Returns to main conversation. User approves/rejects. Main conversation sends decision via SendMessage. Agent continues. This may happen multiple times if review triggers rework cycles.
Gate ESCALATE (either mode): Agent always returns with breakpoint. User decides force-proceed/replan/abort. Main conversation relays via SendMessage.
Step 4: Add status reporting and error handling
Scope: Small
Progress updates: The agent should output status lines as it completes each phase (these appear in the agent's output but not the main conversation — only the final return is visible). The main conversation can use run_in_background: true for auto-approve runs and get notified on completion.
Error recovery: If a CLI call fails, the agent should:
Read the error message
Check megaplan status --plan <name> for state
Retry once if transient, otherwise return a breakpoint with the error for user guidance
Timeout handling: Execute phase uses timeout: 600000 (10 min). If it times out, agent checks status and continues with next batch or reports failure.
Step 5: Validate the rewritten skill
Scope: Small
Dry-read test: Read the final .claude/skills/megaplan.md and verify:
Triage logic is preserved
Agent prompt contains all current workflow rules (nothing lost)
Breakpoint protocol covers all user-input scenarios
Auto-approve path has zero breakpoints
Review path pauses at the right moments
Spot-check that the agent prompt references correct CLI commands and flags (compare against current skill's Commands section).
Verify the skill doesn't reference any files/functions that don't exist (the skill only uses megaplan CLI commands — no code changes needed elsewhere).
Execution Order
Step 1 (audit) informs the breakpoint protocol design.
Step 2 (rewrite) is the core implementation — single file change.
Steps 3-4 are refinements folded into the rewrite.
Step 5 validates the result.
Validation Order
Read the rewritten skill and verify completeness against the current skill's rules.
Confirm no megaplan CLI or Python code needs changes (this is purely a skill-layer refactor).
Manual smoke test: run /megaplan on a test idea in both auto-approve and review mode.
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-04-06T16:23:03Z",
"hash": "sha256:49f58959fced254728cc980eb3388f88aad3a326ccd1d3b4964aab4ef5800900",
"questions": [
"Should the agent run in the background (run_in_background: true) for auto-approve mode so the main conversation stays fully responsive? Or foreground so the user sees the result immediately when it finishes?",
"When the agent hits a breakpoint in review mode and returns, should the main conversation show the full gate/critique output, or just a summary with the recommendation and options?",
"Should the agent use run_in_background: true for the execute phase internally (as the current skill does), or is it acceptable for the agent to block on execute since the agent itself is already offloaded from the main context?",
"Is there a maximum number of revise\u2192critique\u2192gate loops the agent should attempt before escalating to the user, even in auto-approve mode? The current skill doesn't cap this \u2014 the gate/worker decides."
],
"success_criteria": [
{
"criterion": "The megaplan skill spawns a single Claude Code Agent that autonomously runs all phases (init through review) via megaplan CLI calls",
"priority": "must"
},
{
"criterion": "Auto-approve runs complete without any breakpoint returns or user interaction after the initial mode/robustness questions",
"priority": "must"
},
{
"criterion": "Review-mode runs pause at the gate-to-execute transition and wait for user approval before proceeding",
"priority": "must"
},
{
"criterion": "Gate ESCALATE recommendations always return to the main conversation for user decision regardless of mode",
"priority": "must"
},
{
"criterion": "All current workflow rules (step rules, gate principle, orchestrator_guidance, override commands) are preserved in the agent prompt",
"priority": "must"
},
{
"criterion": "The main conversation context window only contains: triage, two questions, agent launch, breakpoint handling (if any), and final result summary",
"priority": "must"
},
{
"criterion": "No changes to megaplan CLI, handlers, workers, or any Python code",
"priority": "must"
},
{
"criterion": "The agent prompt is under ~400 lines to avoid excessive token overhead on launch",
"priority": "should"
},
{
"criterion": "Breakpoint messages from the agent include enough context (plan name, state, gate output summary) that the user can make an informed decision without reading artifacts",
"priority": "should"
},
{
"criterion": "Error recovery: if a CLI call fails, the agent retries once or returns a breakpoint with the error rather than silently failing",
"priority": "should"
},
{
"criterion": "Manual smoke test: /megaplan on a test idea completes successfully in both auto-approve and review mode",
"priority": "info"
}
],
"assumptions": [
"Only .claude/skills/megaplan.md needs to change. No modifications to the megaplan CLI, handlers, workers, or Python code.",
"The Agent tool's SendMessage mechanism is sufficient for the breakpoint-resume pattern \u2014 the agent preserves full context when resumed.",
"The agent prompt can be embedded directly in the skill markdown as a template/block that the main conversation copies into the Agent tool's prompt parameter, substituting the idea, mode, robustness, and project directory.",
"Auto-approve mode means zero breakpoints \u2014 the agent runs to completion without returning. Review mode means one breakpoint at gate\u2192execute (and possibly more if rework cycles happen).",
"Gate ESCALATE is always a breakpoint regardless of mode, since it represents a situation the gate worker explicitly flagged for human judgment.",
"The current triage logic (simple tasks skip megaplan) and the two pre-launch questions (mode, robustness) remain in the main conversation \u2014 only the post-init workflow moves into the agent.",
"The agent will have access to all the same tools (Bash, Read, Glob, etc.) that the main conversation currently uses to run megaplan CLI commands."
],
"structure_warnings": [
"Each step section should reference at least one file in backticks."
]
}
code
Plan structure warnings from validator:
[
"Each step section should reference at least one file in backticks."
]
code
Existing flags:
[]
Known accepted debt grouped by subsystem:
{
"are-the-proposed-changes-technically-correct": [
{
"id": "DEBT-009",
"concern": "are the proposed changes technically correct?: the mobile action-surface plan is technically incorrect for the current component structure. submissioncarouselcard hides footercontent below the md breakpoint (src/components/submissioncarouselcard.tsx:219), while submissionscarouselpage also hides the score panel on mobile via asidecontent={<div classname=\"hidden md:block\">... and passes hideactions to scorepanel at src/pages/submissionscarouselpage.tsx:250-263,347. reusing that pattern for entrypage would leave mobile users with no navigation controls and no scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-010",
"concern": "are the proposed changes technically correct?: i checked the sign-in callback path again. submissionslayout already wires usescoring(..., { onrequiresignin: () => pagemachine.dispatch({ type: 'open_sign_in_modal' }) }) at src/pages/submissionslayout.tsx:38-40, and scorepanel still has its own onrequiresignin prop. the revised step 4.2 is acceptable only if it explicitly rewires that prop to pagemachine.dispatch; otherwise removing local modal state would orphan the direct ui callback. the plan hints at this, but it remains easy to misread because the scoring-context callback and the scorepanel prop are separate mechanisms.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"are-the-success-criteria-well-prioritized-and-verifiable": [
{
"id": "DEBT-019",
"concern": "are the success criteria well-prioritized and verifiable?: mobile behavior is still under-prioritized relative to the actual risk in this repo. the user constraint specifically mentions the mobile bottom nav, but the only mobile-specific success criterion left is 'mobile scoring ux is coherent' at info level. given that the plan currently removes the working mobile nav, there should be at least a should or must criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [
{
"id": "DEBT-011",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: a new critical issue is introduced on mobile. step 4.9 says to remove entrypage's mobile sticky bottom nav and 'use the same footercontent slot in submissioncarouselcard', but src/components/submissioncarouselcard.tsx:217-221 renders footercontent inside classname=\"hidden md:block\". in the current repo, the mobile sticky nav at src/pages/entrypage.tsx:283-340 is the only mobile surface for back/next and the score toggle, so the revised plan would remove working mobile controls and replace them with a slot that is explicitly hidden on phones.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-012",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: the plan still contradicts itself on mobile behavior. assumption #3 says the browse-mode mobile score toggle will be preserved, but step 4.9 removes the entire mobile sticky nav that contains that toggle in src/pages/entrypage.tsx:314-330. the implementer cannot satisfy both instructions as written.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"does-the-change-touch-all-locations-and-supporting-infrastructure": [
{
"id": "DEBT-018",
"concern": "does the change touch all locations and supporting infrastructure?: if the implementation really wants footercontent to carry mobile actions, the plan must also include a supporting change in src/components/submissioncarouselcard.tsx or render a separate mobile control surface outside the card. right now step 4.9 removes the mobile nav but does not list submissioncarouselcard.tsx:217-221 as a place that must change, so the required glue for mobile controls is missing.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"execute-phase-contract": [
{
"id": "DEBT-003",
"concern": "early-killed baselines pass truncated output to the execute worker, which may produce lower-quality diagnosis than full output.",
"occurrence_count": 1,
"plan_ids": [
"design-and-implement-a-20260327-0512"
]
}
],
"find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them": [
{
"id": "DEBT-014",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: i checked the skip caller path against the real hook behavior and removefromqueue(entryid) looks redundant. scoring.skipentry(entryid) optimistically adds the id to skippedentryids in src/hooks/usescoring.ts:245-249, and usecarouselqueue already reactively filters skipped entries from submissions[] in src/hooks/usecarouselqueue.ts:154-165. calling removefromqueue() immediately afterward is safe, but it duplicates an existing state transition and should be justified as an explicit ux optimization rather than required logic.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-015",
"concern": "find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the direct ui sign-in caller is still important here. scorepanel invokes its own onrequiresignin prop when an unauthenticated user interacts with the score ui (src/components/scorepanel.tsx:499-515), which is independent of the scoring hook's internal requireauth() path. the plan should be read as requiring that caller to dispatch open_sign_in_modal; otherwise one caller remains broken even if submitscore() is correctly wired.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"handler-boilerplate": [
{
"id": "DEBT-004",
"concern": "_run_worker() pseudocode hardcodes iteration=state['iteration'] but handle_plan and handle_revise use different failure iteration values.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-005",
"concern": "same issue as correctness-1: failure iteration would be wrong for plan/revise handlers.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
],
"is-there-convincing-verification-for-the-change": [
{
"id": "DEBT-016",
"concern": "is there convincing verification for the change?: the test-plan details still miss a small but real infrastructure update: the current locationdisplay helper in src/pages/submissionscarouselpage.test.tsx:289-291 only renders location.pathname, so the step 7 requirement to assert { state: { carousel: true, navdirection: 'forward' } } cannot be implemented unless that helper is extended to expose location.state. the same pattern exists in the related page tests.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
},
{
"id": "DEBT-017",
"concern": "is there convincing verification for the change?: there is still no explicit mobile regression test in the plan, even though the revised implementation proposal removes the only current mobile nav/score surface. given the repository's actual component structure, a mobile-focused test or visual verification step is needed to prove controls remain accessible below md.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"mobile-ui": [
{
"id": "DEBT-020",
"concern": "mobile ui: removing entrypage's mobile sticky nav and relying on submissioncarouselcard.footercontent would break mobile navigation and scoring because that footer slot is hidden below the md breakpoint.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"search-for-related-code-that-handles-the-same-concept-is-the-reported-issue-a-symptom-of-something-broader": [
{
"id": "DEBT-013",
"concern": "search for related code that handles the same concept. is the reported issue a symptom of something broader?: the mobile problem is broader than entrypage. submissionscarouselpage already has a pre-existing mobile gap because its score panel is desktop-only and its footer actions are also hidden on mobile (src/pages/submissionscarouselpage.tsx:250-263,347-354 plus src/components/submissioncarouselcard.tsx:219). the revised plan says entrypage should 'match the carouselpage pattern', which would spread that existing gap into the one page that currently has working mobile controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"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": "workflow-state-machine",
"total_occurrences": 3,
"plan_count": 1,
"entries": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
]
code
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Your output template is at: /Users/user_c042661f/Documents/megaplan/.megaplan/plans/refactor-megaplan-skill-so-20260406-1818/critique_output.json
Read this file first — it contains 4 checks, each with a question and guidance.
For each check, investigate the codebase, then add your findings to the findings array for that check.
Each finding needs:
"detail": what you specifically checked and what you found (at least a full sentence)
"flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false}
Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true}
Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected
Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the flags array (e.g., security, performance, dependencies).
Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.
Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
code
Additional guidelines:
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess.
- Verify that the plan follows the expected structure when validator warnings or the outline suggest drift.
- Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other.
- Focus on concrete issues, not structural formatting.
{"checks":[{"id":"issue_hints","question":"Did the work fully address the issue hints, user notes, and approved plan requirements?","findings":[{"detail":"Checked the current bundled instructions against the repo-local Claude skill. megaplan/data/instructions.md:10-15 says the harness should choose robustness itself and only ask execution mode, with valid values light|standard|heavy, but the plan preserves a second robustness question and the stale thorough value from .claude/skills/megaplan.md:13-18, so it is carrying forward obsolete behavior rather than the repo's current contract.","flagged":true},{"detail":"Checked how megaplan actually distributes its skill text. megaplan/cli.py:272-309 treats megaplan/data/instructions.md as the canonical source and installs it to .claude/skills/megaplan/SKILL.md plus the Codex/Cursor targets, and tests/test_megaplan.py:1603-1609 asserts that installed Claude path. The plan's assumption that only .claude/skills/megaplan.md needs to change would leave the packaged skill flow untouched.","flagged":true}]},{"id":"correctness","question":"Are the proposed changes technically correct?","findings":[{"detail":"Checked the real workflow transitions in megaplan/_core/workflow.py:31-66 and the execute guard in megaplan/handlers.py:964-977. The repo's standard/heavy flow is ... gate -> finalize -> execute -> review, heavy starts with prep, light skips gate/review, and execute is only legal from STATE_FINALIZED. The plan's breakpoint model is based on a stale gate -> execute handoff and largely ignores the light/heavy branches, so an agent prompt written that way would not match the actual CLI state machine.","flagged":true},{"detail":"Checked the non-happy-path resume behavior. megaplan/handlers.py:1089-1103 can send review needs_rework back to STATE_FINALIZED with next_stepexecute, and megaplan/execution.py:960-988 also returns next_step: execute after blocked or timed-out runs. The proposed launcher only describes explicit human breakpoints plus a generic retry path, so it under-specifies how the outer conversation distinguishes an ordinary resume-to-execute state from a true breakpoint that needs user input.","flagged":true},{"detail":"Checked the exposed CLI surface in the handlers and workflow code. All phases the subagent would need to drive already exist as CLI commands (prep, plan, critique, gate, finalize, execute, review, plus overrides), so this refactor can stay at the skill/orchestrator layer if it mirrors the real transitions instead of the stale skill document.","flagged":false}]},{"id":"scope","question":"Search for related code that handles the same concept. Is the reported issue a symptom of something broader?","findings":[{"detail":"Checked the adjacent orchestration features that live in the same instructions surface. megaplan/data/instructions.md:46-63 documents per-batch execution and megaplan progress, and megaplan/data/instructions.md:76-83 documents megaplan step add/remove/move; the plan only ports the phase loop and override commands. If the goal is to preserve the current skill contract while moving orchestration into a subagent, the scope is broader than one launcher prompt rewrite.","flagged":true},{"detail":"Checked the multi-target install path rather than just the repo-local Claude file. megaplan/cli.py:306-309 writes the same canonical instructions to Claude, Codex, and Cursor targets, so this is not just a local .claude concern. A change limited to one repo file would fix at most one consumer while the other skill entry points keep the old orchestration model.","flagged":true}]},{"id":"verification","question":"Is there convincing verification for the change?","findings":[{"detail":"Checked the existing repo coverage against the proposed validation. The repository already has explicit tests for robustness-dependent routing in tests/test_megaplan.py:147-163 and for setup-global skill installation in tests/test_megaplan.py:1603-1633, but the plan only proposes manual /megaplan smoke tests in auto-approve and review mode. That is not enough to verify light vs standard vs heavy behavior or that the installed skill files actually pick up the new instructions.","flagged":true},{"detail":"Checked the branches most likely to break under a SendMessage-based launcher. The validation section does not mention exercising gate ESCALATE, review needs_rework loops (megaplan/handlers.py:1089-1101), or execute timeout/blocked resumes (megaplan/execution.py:960-988), even though those are the cases where breakpoint detection and agent resumption logic would be stressed.","flagged":true}]}],"flags":[{"id":"FLAG-001","concern":"Skill packaging: The plan edits .claude/skills/megaplan.md, but the repo's canonical instructions and installed skill targets are sourced from megaplan/data/instructions.md via megaplan/cli.py, so the proposed scope misses the files that actually drive setup and multi-agent distribution.","category":"completeness","severity_hint":"likely-significant","evidence":"megaplan/cli.py:272-309 reads megaplan/data/instructions.md and installs .claude/skills/megaplan/SKILL.md, .codex/skills/megaplan/SKILL.md, and .cursor/rules/megaplan.mdc; tests/test_megaplan.py:1603-1609 asserts the installed Claude path."},{"id":"FLAG-002","concern":"Workflow contract: The proposed agent loop is modeled on a stale gate -> execute flow and does not fully match the current state machine's prep/finalize phases, light/heavy robustness branches, or finalized-state execute requirement.","category":"correctness","severity_hint":"likely-significant","evidence":"megaplan/_core/workflow.py:31-66 defines prep -> plan -> critique -> gate -> finalize -> execute -> review, with light skipping gate/review and heavy starting at prep, and megaplan/handlers.py:964-977 only allows execute from STATE_FINALIZED."},{"id":"FLAG-003","concern":"Verification: The proposed smoke tests cover only the happy-path launcher flow and miss the repo's high-risk branches such as heavy robustness, setup-global output, gate escalation, review rework, and execute timeout/blocked resume behavior.","category":"completeness","severity_hint":"likely-significant","evidence":"tests/test_megaplan.py:147-163 already distinguishes light/standard/heavy routing, tests/test_megaplan.py:1603-1633 covers setup-global, megaplan/handlers.py:1089-1101 returns review rework to execute, and megaplan/execution.py:960-988 returns next_step: execute on blocked/timeout runs."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
Refactor megaplan skill so that the entire workflow runs inside a Claude Code Agent (subagent) by default. The agent runs all phases autonomously (init→plan→critique→gate→revise loop→finalize→execute→review) and only 'breaks out' to the main conversation at defined breakpoints that require user input (gate escalate, execute approval in review mode, etc.). The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns via SendMessage, relays user answers, and reports the final result. This keeps the main context window clean and makes auto-approve runs fully hands-off. Reference the pattern used in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) for how the autonomous loop works, but adapt it to use Claude Code Agent+SendMessage instead of subprocess+feedback-injection.
Current state: The canonical megaplan skill instructions live in megaplan/data/instructions.md and are installed to three targets via megaplan/cli.py:306-309: .claude/skills/megaplan/SKILL.md, .codex/skills/megaplan/SKILL.md, and .cursor/rules/megaplan.mdc. These instructions tell the host conversation to orchestrate megaplan CLI calls sequentially, phase by phase, in the main context window.
Goal: For Claude Code specifically, wrap the existing instructions inside a subagent so the main context stays clean. The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns (gate ESCALATE, finalize-to-execute approval in review mode), and reports the final result. Auto-approve runs are fully hands-off.
Key design decision: The canonical megaplan/data/instructions.md stays unchanged — it's the shared orchestration contract for Claude, Codex, and Cursor. The subagent wrapper is Claude Code-specific and lives in a new file (megaplan/data/claude_subagent.md) that the install path uses only for the Claude target. Codex and Cursor continue to get the current instructions.
Real workflow per robustness level (from megaplan/_core/workflow.py):
Light: init → plan → critique → revise → finalize → execute (no gate, no review)
Finalize-to-execute in review mode: agent pauses after finalize, returns for user approval
Gate ESCALATE (standard/heavy only): agent pauses, returns for user decision (force-proceed / replan / abort)
Auto-approve mode: zero breakpoints — agent runs to completion
Review needs_rework: agent auto-continues (re-executes), no breakpoint — up to 3 cycles
Execute timeout/blocked resume: agent auto-continues with next batch or re-runs
Phase 1: Create Claude-Specific Subagent Wrapper
Step 1: Create the subagent prompt file (megaplan/data/claude_subagent.md)
Scope: Medium
Createmegaplan/data/claude_subagent.md with the following structure:
Frontmatter (skill header, same as current _SKILL_HEADER)
Triage section — copied verbatim from megaplan/data/instructions.md:3-8 (skip megaplan / light / standard / heavy criteria)
Start section — ask only execution mode (auto-approve or review). Pick robustness per triage guidance. Then launch a subagent using the Agent tool.
Agent Prompt Template — a fenced block or clearly delimited section the outer conversation pastes into the Agent tool's prompt parameter, with placeholders {IDEA}, {PROJECT_DIR}, {AUTO_APPROVE}, {ROBUSTNESS}. This template contains:
Role: autonomous megaplan orchestrator
Full workflow rules including all three robustness branches (light/standard/heavy)
Phase rules from instructions.md:29-34 (plan, critique, gate, revise, finalize, review)
Gate principle from instructions.md:35-38
Execute rules including per-batch mode and megaplan progress (instructions.md:39-63)
Override and replan commands (instructions.md:64-75)
Step editing commands (instructions.md:76-83)
Session rules (instructions.md:84-90)
Full command reference (instructions.md:91-112)
Breakpoint protocol:
In auto-approve mode: run all phases without stopping. Use --confirm-destructive for execute. No breakpoints.
In review mode: run through finalize, then STOP and return a breakpoint message with the finalize summary and gate result, asking for execute approval.
On gate ESCALATE (standard/heavy): always STOP and return breakpoint message with the gate warnings and available overrides (force-proceed / replan / abort).
On review needs_rework: auto-continue to re-execute (no breakpoint). Cap at 3 rework cycles (handled by CLI).
On execute timeout or blocked batch: auto-continue — re-run same --batch N or check progress.
Breakpoint message format:
code
Step 2: Update the install path to use the subagent wrapper for Claude (megaplan/cli.py)
Scope: Small
Add a new bundled_global_file case in megaplan/cli.py:297-303 for a Claude-specific variant:
python
def bundled_global_file(name: str) -> str:
content = _canonical_instructions()
if name == "skill.md":
return _SKILL_HEADER + content
if name == "claude_skill.md":
return _claude_subagent_content()
if name == "cursor_rule.mdc":
return _CURSOR_HEADER + content
return content
Add helper _claude_subagent_content() that reads megaplan/data/claude_subagent.md.
Update the Claude target in _GLOBAL_TARGETS (megaplan/cli.py:307) to use "data": "claude_skill.md" instead of "skill.md":
Leave the Codex and Cursor targets unchanged — they keep the current instructions.
Step 3: Update tests for the new install path (tests/test_megaplan.py)
Scope: Small
Find the test at tests/test_megaplan.py:1603-1609 that asserts the installed Claude skill content.
Update it to expect the subagent wrapper content instead of _SKILL_HEADER + canonical_instructions.
Add a test that the Codex target still gets the original _SKILL_HEADER + canonical_instructions (no regression).
Phase 2: Update Repo-Local Skill
Step 4: Replace the repo-local skill file (.claude/skills/megaplan.md)
Scope: Small
Overwrite.claude/skills/megaplan.md with a simplified version that matches the subagent pattern. This file is for the megaplan repo's own development — it should use the same subagent approach.
This is a local convenience file, not distributed via setup-global. It just needs to match the new pattern.
Phase 3: Validation
Step 5: Verify completeness and correctness
Scope: Small
Diff the agent prompt template against megaplan/data/instructions.md to verify all sections are covered:
Triage criteria (light/standard/heavy) ✓
Workflow per robustness (light: no gate/review, heavy: adds prep) ✓
Run existing tests: python -m pytest tests/test_megaplan.py -x to verify the install path change doesn't break anything.
Execution Order
Step 1 first — create the new file before wiring it.
Step 2 — wire the install path to use it.
Step 3 — update tests for the new install behavior.
Step 4 — update the local skill file.
Step 5 — final validation pass.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Step 3 to catch install-path regressions early.
Read-verify the agent prompt against instructions.md after Step 1.
Manual smoke test after all steps: run /megaplan in both auto-approve and review mode on a test idea.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-04-06T16:30:48Z",
"hash": "sha256:010a78ae23ac65fc64c61e67bed671fbc8b1bc3618efd71c4d75e42c749c1607",
"changes_summary": "Major revision addressing all 9 flags. Three foundational changes:\n\n1. Correct file target (FLAG-001, issue_hints-2, scope-2): canonical megaplan/data/instructions.md stays unchanged. New megaplan/data/claude_subagent.md is created as a Claude-specific wrapper. Install path in megaplan/cli.py updated to route Claude target to the subagent file while Codex/Cursor keep the original instructions.\n\n2. Correct workflow model (FLAG-002, correctness-1, correctness-2): Agent prompt now models the real state machine \u2014 gate\u2192finalize\u2192execute\u2192review for standard/heavy, no gate/review for light, prep phase for heavy. Breakpoint is at finalize\u2192execute (not gate\u2192execute). Review needs_rework and execute timeout/blocked are auto-continue, not breakpoints.\n\n3. Complete scope (FLAG-003, scope-1, issue_hints-1): Agent prompt includes per-batch execution with megaplan progress, step editing commands, override commands, all three robustness branches, and the full command reference. Robustness question removed \u2014 harness chooses it per the canonical instructions.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"FLAG-003",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope-1",
"scope-2"
],
"questions": [
"The agent prompt will duplicate most of instructions.md content. Should we instead have the agent read instructions.md at runtime (via the Read tool) to avoid content drift, or is a static copy acceptable given that the install path already snapshots content?",
"For the breakpoint message format: should it be structured JSON that the outer conversation parses, or plain text that the outer conversation presents as-is to the user?"
],
"success_criteria": [
{
"criterion": "The megaplan skill spawns a single Claude Code Agent that autonomously runs all phases via megaplan CLI calls, following the correct state machine per robustness level (light: no gate/review; standard: full loop; heavy: adds prep)",
"priority": "must"
},
{
"criterion": "Auto-approve runs complete without any breakpoint returns or user interaction after the initial execution-mode question",
"priority": "must"
},
{
"criterion": "Review-mode runs pause at the finalize-to-execute transition (not gate-to-execute) and wait for user approval",
"priority": "must"
},
{
"criterion": "Gate ESCALATE recommendations (standard/heavy only) always return to the main conversation for user decision",
"priority": "must"
},
{
"criterion": "The agent prompt contains all orchestration rules from megaplan/data/instructions.md: workflow per robustness, step rules, gate principle, per-batch execute, progress polling, overrides, step editing, sessions, and full command reference",
"priority": "must"
},
{
"criterion": "The canonical megaplan/data/instructions.md is unchanged \u2014 Codex and Cursor targets are unaffected",
"priority": "must"
},
{
"criterion": "The Claude install target in megaplan/cli.py routes to the new claude_subagent.md content",
"priority": "must"
},
{
"criterion": "Existing tests pass after updating the setup-global assertion for the Claude target",
"priority": "must"
},
{
"criterion": "The main conversation context window only contains: triage, execution-mode question, agent launch, breakpoint handling (if any), and final result summary",
"priority": "must"
},
{
"criterion": "Robustness is chosen by the harness (not asked of the user), matching the canonical instructions contract",
"priority": "must"
},
{
"criterion": "The agent prompt is under ~400 lines to avoid excessive token overhead on launch",
"priority": "should"
},
{
"criterion": "Breakpoint messages include enough context (plan name, state, gate/finalize summary) for the user to decide without reading artifacts",
"priority": "should"
},
{
"criterion": "Error recovery: if a CLI call fails, the agent retries once or returns a breakpoint with the error rather than silently failing",
"priority": "should"
},
{
"criterion": "Manual smoke test: /megaplan on a test idea completes successfully in both auto-approve and review mode",
"priority": "info"
}
],
"assumptions": [
"The canonical stays unchanged \u2014 all its content is embedded (not referenced) in the agent prompt template within the new file.",
"Codex and Cursor don't support Agent+SendMessage, so they keep the current instructions unchanged. The subagent pattern is Claude Code-specific.",
"The file is self-contained \u2014 it includes the skill frontmatter, triage, launcher instructions, the full agent prompt template, and breakpoint handling. It does not import from at runtime.",
"The Agent tool preserves full context across SendMessage calls, so breakpoint-resume works without re-injecting state.",
"The repo-local is a convenience file for megaplan development and can be freely replaced with the subagent pattern.",
" on the Agent tool call is suitable for auto-approve mode since no breakpoints are expected."
],
"delta_from_previous_percent": 92.37,
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "FLAG-001",
"concern": "Skill packaging: The plan edits .claude/skills/megaplan.md, but the repo's canonical instructions and installed skill targets are sourced from megaplan/data/instructions.md via megaplan/cli.py, so the proposed scope misses the files that actually drive setup and multi-agent distribution.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-002",
"concern": "Workflow contract: The proposed agent loop is modeled on a stale gate -> execute flow and does not fully match the current state machine's prep/finalize phases, light/heavy robustness branches, or finalized-state execute requirement.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-003",
"concern": "Verification: The proposed smoke tests cover only the happy-path launcher flow and miss the repo's high-risk branches such as heavy robustness, setup-global output, gate escalation, review rework, and execute timeout/blocked resume behavior.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked the current bundled instructions against the repo-local Claude skill. megaplan/data/instructions.md:10-15 says the harness should choose robustness itself and only ask execution mode, with valid values light|standard|heavy, but the plan preserves a second robustness question and the stale thorough value from .claude/skills/megaplan.md:13-18, so it is carrying forward obsolete behavior rather than the repo's current contract.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked how megaplan actually distributes its skill text. megaplan/cli.py:272-309 treats megaplan/data/instructions.md as the canonical source and installs it to .claude/skills/megaplan/SKILL.md plus the Codex/Cursor targets, and tests/test_megaplan.py:1603-1609 asserts that installed Claude path. The plan's assumption that only .claude/skills/megaplan.md needs to change would leave the packaged skill flow untouched.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Checked the real workflow transitions in megaplan/_core/workflow.py:31-66 and the execute guard in megaplan/handlers.py:964-977. The repo's standard/heavy flow is ... gate -> finalize -> execute -> review, heavy starts with prep, light skips gate/review, and execute is only legal from STATE_FINALIZED. The plan's breakpoint model is based on a stale handoff and largely ignores the light/heavy branches, so an agent prompt written that way would not match the actual CLI state machine.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Checked the non-happy-path resume behavior. can send review back to with , and also returns after blocked or timed-out runs. The proposed launcher only describes explicit human breakpoints plus a generic retry path, so it under-specifies how the outer conversation distinguishes an ordinary resume-to-execute state from a true breakpoint that needs user input.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope-1",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Checked the adjacent orchestration features that live in the same instructions surface. documents per-batch execution and , and documents ; the plan only ports the phase loop and override commands. If the goal is to preserve the current skill contract while moving orchestration into a subagent, the scope is broader than one launcher prompt rewrite.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope-2",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Checked the multi-target install path rather than just the repo-local Claude file. writes the same canonical instructions to Claude, Codex, and Cursor targets, so this is not just a local concern. A change limited to one repo file would fix at most one consumer while the other skill entry points keep the old orchestration model.",
"status": "addressed",
"severity": "significant"
},
{
"id": "verification-1",
"concern": "Is there convincing verification for the change?: Checked the existing repo coverage against the proposed validation. The repository already has explicit tests for robustness-dependent routing in and for setup-global skill installation in , but the plan only proposes manual smoke tests in auto-approve and review mode. That is not enough to verify light vs standard vs heavy behavior or that the installed skill files actually pick up the new instructions.",
"status": "open",
"severity": "minor"
},
{
"id": "verification-2",
"concern": "Is there convincing verification for the change?: Checked the branches most likely to break under a SendMessage-based launcher. The validation section does not mention exercising gate , review loops (), or execute timeout/blocked resumes (), even though those are the cases where breakpoint detection and agent resumption logic would be stressed.",
"status": "open",
"severity": "minor"
}
]
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"
]
}
],
"are-the-success-criteria-well-prioritized-and-verifiable": [
{
"id": "DEBT-019",
"concern": "are the success criteria well-prioritized and verifiable?: mobile behavior is still under-prioritized relative to the actual risk in this repo. the user constraint specifically mentions the mobile bottom nav, but the only mobile-specific success criterion left is 'mobile scoring ux is coherent' at info level. given that the plan currently removes the working mobile nav, there should be at least a should or must criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [
{
"id": "DEBT-011",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: a new critical issue is introduced on mobile. step 4.9 says to remove entrypage's mobile sticky bottom nav and 'use the same footercontent slot in submissioncarouselcard', but src/components/submissioncarouselcard.tsx:217-221 renders footercontent inside . 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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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": "workflow-state-machine",
"total_occurrences": 3,
"plan_count": 1,
"entries": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
]
code
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Your output template is at: /Users/user_c042661f/Documents/megaplan/.megaplan/plans/refactor-megaplan-skill-so-20260406-1818/critique_output.json
Read this file first — it contains 4 checks, each with a question and guidance.
For each check, investigate the codebase, then add your findings to the findings array for that check.
Each finding needs:
"detail": what you specifically checked and what you found (at least a full sentence)
"flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false}
Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true}
Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected
Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the flags array (e.g., security, performance, dependencies).
Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.
Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
This is critique iteration 2. The template file includes prior findings with their status. Verify addressed flags were actually fixed, re-flag if inadequate, and check for new issues introduced by the revision.
code
Additional guidelines:
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess.
- Verify that the plan follows the expected structure when validator warnings or the outline suggest drift.
- Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other.
- Focus on concrete issues, not structural formatting.
You are an independent reviewer. Critique the plan against the actual repository.
Refactor megaplan skill so that the entire workflow runs inside a Claude Code Agent (subagent) by default. The agent runs all phases autonomously (init→plan→critique→gate→revise loop→finalize→execute→review) and only 'breaks out' to the main conversation at defined breakpoints that require user input (gate escalate, execute approval in review mode, etc.). The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns via SendMessage, relays user answers, and reports the final result. This keeps the main context window clean and makes auto-approve runs fully hands-off. Reference the pattern used in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) for how the autonomous loop works, but adapt it to use Claude Code Agent+SendMessage instead of subprocess+feedback-injection.
User notes and answers:
Key constraint from user: The CURRENT behavior (phases run inline in main conversation) must remain the DEFAULT. The subagent mode is an opt-in alternative, not a replacement. There should be a setting/flag to choose which mode to use — default can be overridden per-run. Also: sense-check the design against the similar implementation in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) to make sure we're not missing patterns that already work well there.
Current state: The canonical megaplan skill instructions live in megaplan/data/instructions.md and are installed to three targets via megaplan/cli.py:306-309: .claude/skills/megaplan/SKILL.md, .codex/skills/megaplan/SKILL.md, and .cursor/rules/megaplan.mdc. These instructions tell the host conversation to orchestrate megaplan CLI calls sequentially, phase by phase, in the main context window.
Goal: For Claude Code specifically, wrap the existing instructions inside a subagent so the main context stays clean. The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns (gate ESCALATE, finalize-to-execute approval in review mode), and reports the final result. Auto-approve runs are fully hands-off.
Key design decision: The canonical megaplan/data/instructions.md stays unchanged — it's the shared orchestration contract for Claude, Codex, and Cursor. The subagent wrapper is Claude Code-specific and lives in a new file (megaplan/data/claude_subagent.md) that the install path uses only for the Claude target. Codex and Cursor continue to get the current instructions.
Real workflow per robustness level (from megaplan/_core/workflow.py):
Light: init → plan → critique → revise → finalize → execute (no gate, no review)
Finalize-to-execute in review mode: agent pauses after finalize, returns for user approval
Gate ESCALATE (standard/heavy only): agent pauses, returns for user decision (force-proceed / replan / abort)
Auto-approve mode: zero breakpoints — agent runs to completion
Review needs_rework: agent auto-continues (re-executes), no breakpoint — up to 3 cycles
Execute timeout/blocked resume: agent auto-continues with next batch or re-runs
Phase 1: Create Claude-Specific Subagent Wrapper
Step 1: Create the subagent prompt file (megaplan/data/claude_subagent.md)
Scope: Medium
Createmegaplan/data/claude_subagent.md with the following structure:
Frontmatter (skill header, same as current _SKILL_HEADER)
Triage section — copied verbatim from megaplan/data/instructions.md:3-8 (skip megaplan / light / standard / heavy criteria)
Start section — ask only execution mode (auto-approve or review). Pick robustness per triage guidance. Then launch a subagent using the Agent tool.
Agent Prompt Template — a fenced block or clearly delimited section the outer conversation pastes into the Agent tool's prompt parameter, with placeholders {IDEA}, {PROJECT_DIR}, {AUTO_APPROVE}, {ROBUSTNESS}. This template contains:
Role: autonomous megaplan orchestrator
Full workflow rules including all three robustness branches (light/standard/heavy)
Phase rules from instructions.md:29-34 (plan, critique, gate, revise, finalize, review)
Gate principle from instructions.md:35-38
Execute rules including per-batch mode and megaplan progress (instructions.md:39-63)
Override and replan commands (instructions.md:64-75)
Step editing commands (instructions.md:76-83)
Session rules (instructions.md:84-90)
Full command reference (instructions.md:91-112)
Breakpoint protocol:
In auto-approve mode: run all phases without stopping. Use --confirm-destructive for execute. No breakpoints.
In review mode: run through finalize, then STOP and return a breakpoint message with the finalize summary and gate result, asking for execute approval.
On gate ESCALATE (standard/heavy): always STOP and return breakpoint message with the gate warnings and available overrides (force-proceed / replan / abort).
On review needs_rework: auto-continue to re-execute (no breakpoint). Cap at 3 rework cycles (handled by CLI).
On execute timeout or blocked batch: auto-continue — re-run same --batch N or check progress.
Breakpoint message format:
code
Step 2: Update the install path to use the subagent wrapper for Claude (megaplan/cli.py)
Scope: Small
Add a new bundled_global_file case in megaplan/cli.py:297-303 for a Claude-specific variant:
python
def bundled_global_file(name: str) -> str:
content = _canonical_instructions()
if name == "skill.md":
return _SKILL_HEADER + content
if name == "claude_skill.md":
return _claude_subagent_content()
if name == "cursor_rule.mdc":
return _CURSOR_HEADER + content
return content
Add helper _claude_subagent_content() that reads megaplan/data/claude_subagent.md.
Update the Claude target in _GLOBAL_TARGETS (megaplan/cli.py:307) to use "data": "claude_skill.md" instead of "skill.md":
Leave the Codex and Cursor targets unchanged — they keep the current instructions.
Step 3: Update tests for the new install path (tests/test_megaplan.py)
Scope: Small
Find the test at tests/test_megaplan.py:1603-1609 that asserts the installed Claude skill content.
Update it to expect the subagent wrapper content instead of _SKILL_HEADER + canonical_instructions.
Add a test that the Codex target still gets the original _SKILL_HEADER + canonical_instructions (no regression).
Phase 2: Update Repo-Local Skill
Step 4: Replace the repo-local skill file (.claude/skills/megaplan.md)
Scope: Small
Overwrite.claude/skills/megaplan.md with a simplified version that matches the subagent pattern. This file is for the megaplan repo's own development — it should use the same subagent approach.
This is a local convenience file, not distributed via setup-global. It just needs to match the new pattern.
Phase 3: Validation
Step 5: Verify completeness and correctness
Scope: Small
Diff the agent prompt template against megaplan/data/instructions.md to verify all sections are covered:
Triage criteria (light/standard/heavy) ✓
Workflow per robustness (light: no gate/review, heavy: adds prep) ✓
Run existing tests: python -m pytest tests/test_megaplan.py -x to verify the install path change doesn't break anything.
Execution Order
Step 1 first — create the new file before wiring it.
Step 2 — wire the install path to use it.
Step 3 — update tests for the new install behavior.
Step 4 — update the local skill file.
Step 5 — final validation pass.
Validation Order
Run python -m pytest tests/test_megaplan.py -x after Step 3 to catch install-path regressions early.
Read-verify the agent prompt against instructions.md after Step 1.
Manual smoke test after all steps: run /megaplan in both auto-approve and review mode on a test idea.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-04-06T16:30:48Z",
"hash": "sha256:010a78ae23ac65fc64c61e67bed671fbc8b1bc3618efd71c4d75e42c749c1607",
"changes_summary": "Major revision addressing all 9 flags. Three foundational changes:\n\n1. Correct file target (FLAG-001, issue_hints-2, scope-2): canonical megaplan/data/instructions.md stays unchanged. New megaplan/data/claude_subagent.md is created as a Claude-specific wrapper. Install path in megaplan/cli.py updated to route Claude target to the subagent file while Codex/Cursor keep the original instructions.\n\n2. Correct workflow model (FLAG-002, correctness-1, correctness-2): Agent prompt now models the real state machine \u2014 gate\u2192finalize\u2192execute\u2192review for standard/heavy, no gate/review for light, prep phase for heavy. Breakpoint is at finalize\u2192execute (not gate\u2192execute). Review needs_rework and execute timeout/blocked are auto-continue, not breakpoints.\n\n3. Complete scope (FLAG-003, scope-1, issue_hints-1): Agent prompt includes per-batch execution with megaplan progress, step editing commands, override commands, all three robustness branches, and the full command reference. Robustness question removed \u2014 harness chooses it per the canonical instructions.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"FLAG-003",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope-1",
"scope-2"
],
"questions": [
"The agent prompt will duplicate most of instructions.md content. Should we instead have the agent read instructions.md at runtime (via the Read tool) to avoid content drift, or is a static copy acceptable given that the install path already snapshots content?",
"For the breakpoint message format: should it be structured JSON that the outer conversation parses, or plain text that the outer conversation presents as-is to the user?"
],
"success_criteria": [
{
"criterion": "The megaplan skill spawns a single Claude Code Agent that autonomously runs all phases via megaplan CLI calls, following the correct state machine per robustness level (light: no gate/review; standard: full loop; heavy: adds prep)",
"priority": "must"
},
{
"criterion": "Auto-approve runs complete without any breakpoint returns or user interaction after the initial execution-mode question",
"priority": "must"
},
{
"criterion": "Review-mode runs pause at the finalize-to-execute transition (not gate-to-execute) and wait for user approval",
"priority": "must"
},
{
"criterion": "Gate ESCALATE recommendations (standard/heavy only) always return to the main conversation for user decision",
"priority": "must"
},
{
"criterion": "The agent prompt contains all orchestration rules from megaplan/data/instructions.md: workflow per robustness, step rules, gate principle, per-batch execute, progress polling, overrides, step editing, sessions, and full command reference",
"priority": "must"
},
{
"criterion": "The canonical megaplan/data/instructions.md is unchanged \u2014 Codex and Cursor targets are unaffected",
"priority": "must"
},
{
"criterion": "The Claude install target in megaplan/cli.py routes to the new claude_subagent.md content",
"priority": "must"
},
{
"criterion": "Existing tests pass after updating the setup-global assertion for the Claude target",
"priority": "must"
},
{
"criterion": "The main conversation context window only contains: triage, execution-mode question, agent launch, breakpoint handling (if any), and final result summary",
"priority": "must"
},
{
"criterion": "Robustness is chosen by the harness (not asked of the user), matching the canonical instructions contract",
"priority": "must"
},
{
"criterion": "The agent prompt is under ~400 lines to avoid excessive token overhead on launch",
"priority": "should"
},
{
"criterion": "Breakpoint messages include enough context (plan name, state, gate/finalize summary) for the user to decide without reading artifacts",
"priority": "should"
},
{
"criterion": "Error recovery: if a CLI call fails, the agent retries once or returns a breakpoint with the error rather than silently failing",
"priority": "should"
},
{
"criterion": "Manual smoke test: /megaplan on a test idea completes successfully in both auto-approve and review mode",
"priority": "info"
}
],
"assumptions": [
"The canonical stays unchanged \u2014 all its content is embedded (not referenced) in the agent prompt template within the new file.",
"Codex and Cursor don't support Agent+SendMessage, so they keep the current instructions unchanged. The subagent pattern is Claude Code-specific.",
"The file is self-contained \u2014 it includes the skill frontmatter, triage, launcher instructions, the full agent prompt template, and breakpoint handling. It does not import from at runtime.",
"The Agent tool preserves full context across SendMessage calls, so breakpoint-resume works without re-injecting state.",
"The repo-local is a convenience file for megaplan development and can be freely replaced with the subagent pattern.",
" on the Agent tool call is suitable for auto-approve mode since no breakpoints are expected."
],
"delta_from_previous_percent": 92.37,
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "FLAG-001",
"concern": "Skill packaging: The plan edits .claude/skills/megaplan.md, but the repo's canonical instructions and installed skill targets are sourced from megaplan/data/instructions.md via megaplan/cli.py, so the proposed scope misses the files that actually drive setup and multi-agent distribution.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-002",
"concern": "Workflow contract: The proposed agent loop is modeled on a stale gate -> execute flow and does not fully match the current state machine's prep/finalize phases, light/heavy robustness branches, or finalized-state execute requirement.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-003",
"concern": "Verification: The proposed smoke tests cover only the happy-path launcher flow and miss the repo's high-risk branches such as heavy robustness, setup-global output, gate escalation, review rework, and execute timeout/blocked resume behavior.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked the current bundled instructions against the repo-local Claude skill. megaplan/data/instructions.md:10-15 says the harness should choose robustness itself and only ask execution mode, with valid values light|standard|heavy, but the plan preserves a second robustness question and the stale thorough value from .claude/skills/megaplan.md:13-18, so it is carrying forward obsolete behavior rather than the repo's current contract.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked how megaplan actually distributes its skill text. megaplan/cli.py:272-309 treats megaplan/data/instructions.md as the canonical source and installs it to .claude/skills/megaplan/SKILL.md plus the Codex/Cursor targets, and tests/test_megaplan.py:1603-1609 asserts that installed Claude path. The plan's assumption that only .claude/skills/megaplan.md needs to change would leave the packaged skill flow untouched.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Checked the real workflow transitions in megaplan/_core/workflow.py:31-66 and the execute guard in megaplan/handlers.py:964-977. The repo's standard/heavy flow is ... gate -> finalize -> execute -> review, heavy starts with prep, light skips gate/review, and execute is only legal from STATE_FINALIZED. The plan's breakpoint model is based on a stale handoff and largely ignores the light/heavy branches, so an agent prompt written that way would not match the actual CLI state machine.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Checked the non-happy-path resume behavior. can send review back to with , and also returns after blocked or timed-out runs. The proposed launcher only describes explicit human breakpoints plus a generic retry path, so it under-specifies how the outer conversation distinguishes an ordinary resume-to-execute state from a true breakpoint that needs user input.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope-1",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Checked the adjacent orchestration features that live in the same instructions surface. documents per-batch execution and , and documents ; the plan only ports the phase loop and override commands. If the goal is to preserve the current skill contract while moving orchestration into a subagent, the scope is broader than one launcher prompt rewrite.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope-2",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Checked the multi-target install path rather than just the repo-local Claude file. writes the same canonical instructions to Claude, Codex, and Cursor targets, so this is not just a local concern. A change limited to one repo file would fix at most one consumer while the other skill entry points keep the old orchestration model.",
"status": "addressed",
"severity": "significant"
},
{
"id": "verification-1",
"concern": "Is there convincing verification for the change?: Checked the existing repo coverage against the proposed validation. The repository already has explicit tests for robustness-dependent routing in and for setup-global skill installation in , but the plan only proposes manual smoke tests in auto-approve and review mode. That is not enough to verify light vs standard vs heavy behavior or that the installed skill files actually pick up the new instructions.",
"status": "open",
"severity": "minor"
},
{
"id": "verification-2",
"concern": "Is there convincing verification for the change?: Checked the branches most likely to break under a SendMessage-based launcher. The validation section does not mention exercising gate , review loops (), or execute timeout/blocked resumes (), even though those are the cases where breakpoint detection and agent resumption logic would be stressed.",
"status": "open",
"severity": "minor"
}
]
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"
]
}
],
"are-the-success-criteria-well-prioritized-and-verifiable": [
{
"id": "DEBT-019",
"concern": "are the success criteria well-prioritized and verifiable?: mobile behavior is still under-prioritized relative to the actual risk in this repo. the user constraint specifically mentions the mobile bottom nav, but the only mobile-specific success criterion left is 'mobile scoring ux is coherent' at info level. given that the plan currently removes the working mobile nav, there should be at least a should or must criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [
{
"id": "DEBT-011",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: a new critical issue is introduced on mobile. step 4.9 says to remove entrypage's mobile sticky bottom nav and 'use the same footercontent slot in submissioncarouselcard', but src/components/submissioncarouselcard.tsx:217-221 renders footercontent inside . 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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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": "workflow-state-machine",
"total_occurrences": 3,
"plan_count": 1,
"entries": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
]
code
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Your output template is at: /Users/user_c042661f/Documents/megaplan/.megaplan/plans/refactor-megaplan-skill-so-20260406-1818/critique_output.json
Read this file first — it contains 4 checks, each with a question and guidance.
For each check, investigate the codebase, then add your findings to the findings array for that check.
Each finding needs:
"detail": what you specifically checked and what you found (at least a full sentence)
"flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false}
Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true}
Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected
Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the flags array (e.g., security, performance, dependencies).
Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.
Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
This is critique iteration 2. The template file includes prior findings with their status. Verify addressed flags were actually fixed, re-flag if inadequate, and check for new issues introduced by the revision.
code
Additional guidelines:
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess.
- Verify that the plan follows the expected structure when validator warnings or the outline suggest drift.
- Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other.
- Focus on concrete issues, not structural formatting.
You are an independent reviewer. Critique the plan against the actual repository.
Refactor megaplan skill so that the entire workflow runs inside a Claude Code Agent (subagent) by default. The agent runs all phases autonomously (init→plan→critique→gate→revise loop→finalize→execute→review) and only 'breaks out' to the main conversation at defined breakpoints that require user input (gate escalate, execute approval in review mode, etc.). The outer skill becomes a thin launcher that starts the agent, handles breakpoint returns via SendMessage, relays user answers, and reports the final result. This keeps the main context window clean and makes auto-approve runs fully hands-off. Reference the pattern used in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) for how the autonomous loop works, but adapt it to use Claude Code Agent+SendMessage instead of subprocess+feedback-injection.
User notes and answers:
Key constraint from user: The CURRENT behavior (phases run inline in main conversation) must remain the DEFAULT. The subagent mode is an opt-in alternative, not a replacement. There should be a setting/flag to choose which mode to use — default can be overridden per-run. Also: sense-check the design against the similar implementation in /Users/user_c042661f/Documents/hermes-agent/auto-improve (run_evals.py run_megaplan_loop) to make sure we're not missing patterns that already work well there.
Current state: The canonical megaplan skill instructions live in megaplan/data/instructions.md and are installed identically to Claude, Codex, and Cursor targets via megaplan/cli.py:306-309. The instructions tell the host LLM to orchestrate megaplan CLI calls inline, phase by phase, in the main context window.
Goal: Add an opt-in subagent mode for Claude Code that wraps the workflow in a subagent. Inline orchestration remains the default. When subagent mode is active, the outer skill launches an Agent, handles breakpoint returns (gate ESCALATE, finalize-to-execute approval in review mode), and reports the final result. Auto-approve + subagent = fully hands-off.
Key constraint from user: Current inline behavior stays the default. Subagent is opt-in via a persistent setting (megaplan config set orchestration.mode subagent) or per-run user request ("use subagent mode"). Default can be overridden per-run in either direction.
Design: Install a unified Claude skill file = _SKILL_HEADER + instructions.md (inline mode, unchanged) + subagent appendix from new megaplan/data/claude_subagent_appendix.md. The appendix is conditional — the LLM activates it only when the user opts in or megaplan config show returns orchestration.mode: subagent. Codex and Cursor targets are unchanged (they don't support Agent+SendMessage).
Real workflow per robustness level (from megaplan/_core/workflow.py:31-86):
Light: init → plan → critique → revise → finalize → execute (no gate, no review)
Finalize-to-execute in review mode: agent pauses after finalize, returns for user approval
Gate ESCALATE (standard/heavy): agent always pauses, returns for user decision (force-proceed / replan / abort)
Auto-approve + non-escalated happy path: zero breakpoints — agent runs to completion
Review needs_rework: agent auto-continues (re-execute), capped at 3 cycles by CLI
Execute timeout/blocked: agent auto-retries same batch, max 3 consecutive retries without progress → escalate to user
Safeguards (ported from hermes-agent run_megaplan_loop pattern):
Phase retry cap: if a CLI call fails, retry once with --fresh session. If it fails again, escalate to user.
Execute loop cap: max 3 consecutive next_step=execute responses without new tasks completing → escalate breakpoint to user.
Stuck-session detection: if same phase returns identical output/error twice, force --fresh session on next attempt.
Phase 1: Config Key for Mode Selection
Step 1: Expand config handler to support orchestration.mode (megaplan/cli.py:389-401)
Scope: Small
Modifyhandle_config at megaplan/cli.py:389-401 to accept keys with prefix orchestration in addition to agents:
python
if action == "set":
key, value = args.key, args.value
parts = key.split(".", 1)
if len(parts) != 2:
raise CliError("invalid_args", f"Key must be 'agents.<step>' or 'orchestration.mode', got '{key}'")
if parts[0] == "agents":
# existing agent validation...
elif parts[0] == "orchestration" and parts[1] == "mode":
if value not in ("inline", "subagent"):
raise CliError("invalid_args", f"orchestration.mode must be 'inline' or 'subagent', got '{value}'")
config = load_config()
config.setdefault("orchestration", {})["mode"] = value
save_config(config)
return {"success": True, "step": "config", "action": "set", "key": key, "value": value}
else:
raise CliError("invalid_args", f"Unknown key '{key}'. Use 'agents.<step>' or 'orchestration.mode'")
Update the show action to include orchestration mode in the response (megaplan/cli.py:385-388):
Add tests for megaplan config set orchestration.mode subagent and megaplan config set orchestration.mode inline.
Add test that invalid values are rejected (megaplan config set orchestration.mode foo → error).
Add test that megaplan config show includes the orchestration key.
Phase 2: Subagent Appendix and Unified Install
Step 3: Create the subagent appendix (megaplan/data/claude_subagent_appendix.md)
Scope: Medium
Createmegaplan/data/claude_subagent_appendix.md containing only the Claude-specific subagent additions (not a duplicate of instructions.md). Structure:
markdown
## Subagent Mode (Claude Code only)
When subagent mode is active (user requests it, or `megaplan config show` returns
`orchestration.mode: subagent`), run the entire megaplan workflow inside a Claude
Code Agent instead of inline. If the user says "use inline mode" for this run,
override back to inline regardless of the config setting.
### Launching the Subagent
After asking execution mode and picking robustness, launch an Agent with:
- `description`: "megaplan: <3-5 word idea summary>"
- `prompt`: the agent prompt below, with {IDEA}, {PROJECT_DIR}, {AUTO_APPROVE},
{ROBUSTNESS} filled in
- For auto-approve: consider `run_in_background: true`
### Agent Prompt Template
(Fenced block containing:)
- Role and context
- Full workflow per robustness level (matching instructions.md Workflow section)
- Phase rules, gate principle, execute rules, overrides, step editing, sessions
- Per-batch execution and progress polling
- Breakpoint protocol:
- Auto-approve non-escalated: zero breakpoints
- Review mode: STOP after finalize, return breakpoint
- Gate ESCALATE: always STOP, return breakpoint
- Safeguards:
- Phase failure: retry once with --fresh. Second failure → escalate breakpoint
- Execute loop: track consecutive execute calls without progress. After 3 → escalate breakpoint
- Stuck session: identical error twice → --fresh on next attempt
- Resume protocol (for after SendMessage)
- Completion format (plan name, final state, verdicts, issues)
### Breakpoint Handling
When the agent returns:
- If output contains `BREAKPOINT:` → present summary and options to user,
relay decision via SendMessage
- Otherwise → final completion, report summary to user
### Commands (subagent mode additions)
Step 4: Update install path to produce unified Claude skill (megaplan/cli.py:272-309)
Scope: Small
Add a helper to read the subagent appendix (megaplan/cli.py):
Updatetest_global_setup_creates_files to verify the Claude skill file contains BOTH the inline instructions AND the subagent appendix (e.g., assert it contains "Subagent Mode" section header).
Add a test that verifies the Codex target does NOT contain the subagent appendix (regression guard).
Verify idempotency test still passes with the new content.
Phase 3: Local Skill File and Validation
Step 6: Update the repo-local skill file (.claude/skills/megaplan.md)
Scope: Small
Regenerate.claude/skills/megaplan.md by running the equivalent of bundled_global_file("claude_skill.md") — i.e., skill header + instructions + subagent appendix. This keeps the local dev skill in sync with what setup-global installs.
Step 7: Verify completeness and run tests
Scope: Small
Diff the agent prompt template inside the appendix against megaplan/data/instructions.md to verify all sections are covered:
Triage, workflow per robustness, step rules, gate principle, execute + per-batch, overrides, replan, step editing, sessions, full command reference
Verify breakpoint model matches real state machine:
Light: no gate → no ESCALATE possible. Only finalize→execute breakpoint in review mode.
Standard/heavy: ESCALATE breakpoint + finalize→execute breakpoint in review mode.
needs_rework → auto-continue (capped at 3 by CLI)
Execute blocked/timeout → auto-retry (capped at 3 by agent prompt)
Runpython -m pytest tests/test_megaplan.py -x to verify all tests pass.
Execution Order
Step 1-2: config key first (foundation for mode selection).
Step 3: create the appendix file (core content).
Step 4-5: wire the install path and update tests.
Step 6: sync the local skill file.
Step 7: final validation.
Validation Order
Run tests after Step 2 to verify config changes don't break existing tests.
Run tests after Step 5 to verify install path changes.
Read-verify the agent prompt against instructions.md after Step 3.
Full test suite + manual smoke test after Step 7.
code
Plan metadata:
{
"version": 3,
"timestamp": "2026-04-06T16:41:05Z",
"hash": "sha256:f1cb2484c742cb7931bcd960da295cf76c7279b060a9b4af5cea60de5c827992",
"changes_summary": "Revision addressing 7 open flags from v2. Three key changes:\n\n1. Mode selection \u2014 inline stays default (FLAG-004, issue_hints-1, scope): Replaced the "always install subagent" approach with a unified skill file = instructions.md (inline, default) + subagent appendix (opt-in). Added orchestration.mode config key (megaplan config set orchestration.mode subagent|inline) so the mode persists and can be overridden per-run. Codex/Cursor targets unchanged.\n\n2. Execute retry caps and safeguards (FLAG-005, correctness-2, issue_hints-2): Added concrete safeguards to the agent prompt: phase retry cap (retry once with --fresh, then escalate), execute loop cap (3 consecutive execute calls without progress \u2192 escalate), stuck-session detection (identical error twice \u2192 --fresh). These mirror the patterns described in the hermes-agent run_megaplan_loop critique evidence.\n\n3. Success criteria fix (correctness-1): Narrowed "auto-approve zero breakpoints" to "on the non-escalated happy path" \u2014 ESCALATE can still break out even in auto-approve mode.",
"flags_addressed": [
"FLAG-003",
"FLAG-004",
"FLAG-005",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope"
],
"questions": [
"The hermes-agent reference implementation is not accessible from the sandbox. The safeguard numbers (1 phase retry, 3 execute retries) are reasonable defaults \u2014 should they be validated against the actual hermes-agent code before implementation, or are these defaults acceptable?"
],
"success_criteria": [
{
"criterion": "In subagent mode, the skill spawns a single Claude Code Agent that autonomously runs all phases via megaplan CLI calls, following the correct state machine per robustness level",
"priority": "must"
},
{
"criterion": "Inline orchestration (current behavior) remains the default. Subagent mode is opt-in via megaplan config set orchestration.mode subagent or per-run user request",
"priority": "must"
},
{
"criterion": "In subagent + auto-approve mode, the non-escalated happy path completes without breakpoint returns or user interaction after the initial execution-mode question",
"priority": "must"
},
{
"criterion": "In subagent + review mode, the agent pauses at the finalize-to-execute transition and waits for user approval",
"priority": "must"
},
{
"criterion": "Gate ESCALATE recommendations (standard/heavy) always return to the main conversation for user decision, regardless of auto-approve setting",
"priority": "must"
},
{
"criterion": "The agent prompt contains all orchestration rules from megaplan/data/instructions.md: workflow per robustness, step rules, gate principle, per-batch execute, progress polling, overrides, step editing, sessions, and full command reference",
"priority": "must"
},
{
"criterion": "The canonical megaplan/data/instructions.md is unchanged \u2014 Codex and Cursor targets are unaffected",
"priority": "must"
},
{
"criterion": "The Claude install target includes both inline instructions (default) and the subagent appendix (opt-in)",
"priority": "must"
},
{
"criterion": "megaplan config set/show supports the orchestration.mode key with values inline and subagent",
"priority": "must"
},
{
"criterion": "Existing tests pass after all changes",
"priority": "must"
},
{
"criterion": "Execute loop has a retry cap (3 consecutive calls without progress) before escalating to user",
"priority": "must"
},
{
"criterion": "Phase failures retry once with --fresh session before escalating",
"priority": "should"
},
{
"criterion": "The subagent appendix is under ~250 lines",
"priority": "should"
},
{
"criterion": "Breakpoint messages include enough context for the user to decide without reading artifacts",
"priority": "should"
},
{
"criterion": "Manual smoke test: /megaplan in subagent mode completes in both auto-approve and review mode",
"priority": "info"
}
],
"assumptions": [
"The canonical stays unchanged \u2014 the subagent appendix is additive, appended only to the Claude install target.",
"The unified Claude skill file = + + . The LLM reads both sections but only activates the subagent path when opted in.",
"The config key lives in the same as agent routing. Default is (absent key = inline).",
"Codex and Cursor don't support Agent+SendMessage, so they get only (no appendix).",
"The hermes-agent safeguards (retry caps, stuck-session, execute-loop escalation) are adapted based on the patterns described in critique evidence since the hermes-agent repo is not accessible. Specific numbers (3 execute retries, 1 phase retry) are reasonable defaults that can be tuned.",
"The subagent appendix should be under ~250 lines to keep the total installed skill file manageable.",
" on the Agent tool call is suitable for auto-approve subagent mode since no breakpoints are expected on the happy path."
],
"delta_from_previous_percent": 74.91,
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "FLAG-003",
"concern": "Verification: The proposed smoke tests cover only the happy-path launcher flow and miss the repo's high-risk branches such as heavy robustness, setup-global output, gate escalation, review rework, and execute timeout/blocked resume behavior.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked the new user note requiring the current inline orchestration to remain the default and subagent mode to be opt-in with a setting or per-run override. The revised plan still rewires the Claude install target to always install the subagent wrapper and replaces .claude/skills/megaplan.md with the subagent pattern, with no mode selector in the plan, so it does not satisfy that explicit requirement.",
"status": "addressed",
"severity": "significant"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Checked the requested comparison against the existing Hermes implementation. The referenced working loop is in /Users/user_c042661f/Documents/hermes-agent/evals/run_evals.py:519-840, and it includes concrete safeguards like phase retry caps, stuck-session handling, and execute-loop escalation; the revised plan says it was sense-checked against that design but does not carry those patterns forward.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Checked the must success criteria against actual gate behavior. megaplan/_core/workflow.py:42-50 and megaplan/handlers.py:539-551 allow standard and heavy runs to hit ESCALATE, and the revised plan also says ESCALATE must always return to the main conversation, so the separate must criterion that auto-approve runs have zero breakpoint returns is not satisfiable as written unless it is narrowed to the non-escalated happy path.",
"status": "addressed",
"severity": "significant"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Checked the execute auto-continue rule against the real CLI and the referenced run_megaplan_loop() implementation. megaplan/execution.py:973-988 can keep returning state=finalized with next_step=execute on blocked or timed-out runs, and /Users/user_c042661f/Documents/hermes-agent/evals/run_evals.py:645-669,791-797 adds retry limits, backoff, and escalation after repeated execute attempts; the revised plan's 'auto-continue' rule has no stop condition, so the subagent can spin indefinitely on persistent execution failures.",
"status": "addressed",
"severity": "significant"
},
{
"id": "verification-1",
"concern": "Is there convincing verification for the change?: Checked the specific test reference in Step 3. tests/test_megaplan.py:1604-1610 only asserts that the Claude skill file exists; it does not assert installed file content, so the plan understates the test work here and needs new content assertions rather than simply 'updating' an existing assertion.",
"status": "open",
"severity": "minor"
},
{
"id": "verification-2",
"concern": "Is there convincing verification for the change?: Checked the remaining high-risk paths for the new launcher design. The validation still does not propose an explicit test or smoke scenario for gate , review , execute timeout/blocked retry capping, or the new default-inline versus opt-in-subagent selector, so the breakpoint/resume logic remains under-verified.",
"status": "open",
"severity": "minor"
},
{
"id": "FLAG-004",
"concern": "Mode selection: The revised plan still makes the Claude subagent wrapper the default installed skill instead of preserving the current inline orchestration as the default with an opt-in setting or per-run override, which contradicts the user's explicit requirement.",
"status": "addressed",
"severity": "significant"
},
{
"id": "FLAG-005",
"concern": "Loop control: The revised plan adopts automatic resume for execute timeout/blocked states but does not carry over the retry caps, backoff, or escalation safeguards from the referenced pattern, so the launcher can loop forever on repeated responses.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: Checked how an opt-in subagent mode would fit the current repo plumbing. installs exactly one skill payload per detected agent target, and only supports routing keys rather than any skill-behavior mode switch, so honoring the user requirement that inline mode stay default with per-run override likely touches more than the four files listed in the plan.",
"status": "addressed",
"severity": "significant"
}
]
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"
]
}
],
"are-the-success-criteria-well-prioritized-and-verifiable": [
{
"id": "DEBT-019",
"concern": "are the success criteria well-prioritized and verifiable?: mobile behavior is still under-prioritized relative to the actual risk in this repo. the user constraint specifically mentions the mobile bottom nav, but the only mobile-specific success criterion left is 'mobile scoring ux is coherent' at info level. given that the plan currently removes the working mobile nav, there should be at least a should or must criterion stating that mobile users retain navigation and scoring controls.",
"occurrence_count": 1,
"plan_ids": [
"move-the-entry-page-into-20260401-0450"
]
}
],
"did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements": [
{
"id": "DEBT-011",
"concern": "did the work fully address the issue hints, user notes, and approved plan requirements?: a new critical issue is introduced on mobile. step 4.9 says to remove entrypage's mobile sticky bottom nav and 'use the same footercontent slot in submissioncarouselcard', but src/components/submissioncarouselcard.tsx:217-221 renders footercontent inside . 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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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"
]
}
],
"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": "workflow-state-machine",
"total_occurrences": 3,
"plan_count": 1,
"entries": [
{
"id": "DEBT-006",
"concern": "_plan_prompt() does not read research.json, so replanning from state_researched would ignore research results.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-007",
"concern": "same issue as correctness-2: state_researched \u2192 plan path is only partially wired.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
},
{
"id": "DEBT-008",
"concern": "_plan_prompt() is a missed location for the state_researched \u2192 plan change.",
"occurrence_count": 1,
"plan_ids": [
"clean-up-and-properly-20260331-0149"
]
}
]
}
]
code
Debt guidance:
- These are known accepted limitations. Do not re-flag them unless the current plan makes them worse, broadens them, or fails to contain them.
- Prefix every new concern with a subsystem tag followed by a colon, for example `Timeout recovery: retry backoff remains brittle`.
- When a concern is recurring debt that still needs to be flagged, prefix it with `Recurring debt:` after the subsystem tag, for example `Timeout recovery: Recurring debt: retry backoff remains brittle`.
Your output template is at: /Users/user_c042661f/Documents/megaplan/.megaplan/plans/refactor-megaplan-skill-so-20260406-1818/critique_output.json
Read this file first — it contains 4 checks, each with a question and guidance.
For each check, investigate the codebase, then add your findings to the findings array for that check.
Each finding needs:
"detail": what you specifically checked and what you found (at least a full sentence)
"flagged": true if this describes a difference, risk, or tension — even if you think it's justified. false only if purely informational with no possible downside.
When in doubt, flag it — the gate can accept tradeoffs, but it can't act on findings it never sees.
Good: {"detail": "Checked callers of nthroot_mod in solveset.py line 1205 — passes prime moduli only, consistent with the fix.", "flagged": false}
Good: {"detail": "The fix handles empty tuples but not single-element tuples which need a trailing comma.", "flagged": true}
Bad: {"detail": "No issue found", "flagged": false} ← too brief, will be rejected
Bad: {"detail": "The hints suggest approach X but the plan uses Y. However Y is consistent with X's intent.", "flagged": false} ← a different approach than the hints IS a flag. You found a divergence — flag it. The gate decides if it's acceptable.
After filling in checks, add any additional concerns to the flags array (e.g., security, performance, dependencies).
Use the standard format (id, concern, category, severity_hint, evidence). This array can be empty.
Workflow: read the file → investigate → read file again → add finding → write file back. Repeat for each check.
This is critique iteration 3. The template file includes prior findings with their status. Verify addressed flags were actually fixed, re-flag if inadequate, and check for new issues introduced by the revision.
code
Additional guidelines:
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids`: list flag IDs from prior iterations that the revised plan actually resolves (e.g., if the plan was revised to fix FLAG-001, and you confirm the fix is correct, include "FLAG-001"). Only include flags you've verified — don't guess.
- Verify that the plan follows the expected structure when validator warnings or the outline suggest drift.
- Additional flags may use these categories: correctness, security, completeness, performance, maintainability, other.
- Focus on concrete issues, not structural formatting.
“You are an independent reviewer. Critique the plan against the actual repository.….” Conversation with gpt-5.4, from the Peter O’Mallet DataClaw Conversations dataset. The Chat Archive, 2026. https://thechatarchive.com/c/01m80eq3g3w6kptv46k0m5n1ak
Dataset releases
Not yet included in a published release.
BREAKPOINT_TYPE: escalate | approve_execute
PLAN: <plan_name>
STATE: <current_state>
SUMMARY: <what happened — gate warnings, finalize output, etc.>
OPTIONS: <what the user can choose>
Resume protocol: after receiving a SendMessage with the user's decision, continue from where you stopped.
Completion: return a summary with plan name, final state, success criteria verdicts (if review ran), and any outstanding issues.
Breakpoint Handling section — instructions for the outer conversation:
If the agent returns with BREAKPOINT_TYPE:, present the summary and options to the user.
Relay the user's decision back via SendMessage to the agent.
If the agent returns without a breakpoint marker, it's the final completion — report the summary to the user.
Background execution note: for auto-approve mode, the outer conversation MAY use run_in_background: true on the Agent tool call since no breakpoints are expected.
BREAKPOINT_TYPE: escalate | approve_execute
PLAN: <plan_name>
STATE: <current_state>
SUMMARY: <what happened — gate warnings, finalize output, etc.>
OPTIONS: <what the user can choose>
Resume protocol: after receiving a SendMessage with the user's decision, continue from where you stopped.
Completion: return a summary with plan name, final state, success criteria verdicts (if review ran), and any outstanding issues.
Breakpoint Handling section — instructions for the outer conversation:
If the agent returns with BREAKPOINT_TYPE:, present the summary and options to the user.
Relay the user's decision back via SendMessage to the agent.
If the agent returns without a breakpoint marker, it's the final completion — report the summary to the user.
Background execution note: for auto-approve mode, the outer conversation MAY use run_in_background: true on the Agent tool call since no breakpoints are expected.
megaplan config set orchestration.mode subagent
megaplan config set orchestration.mode inline
code
Key sizing constraint: The appendix (including the agent prompt template) should be under ~250 lines. The agent prompt template reuses the same CLI commands and rules from instructions.md but reformulated as autonomous agent instructions rather than inline orchestrator instructions.