Add tier-based critique check filtering. Tag each CritiqueCheckSpec with a tier ('core' or 'extended'). Add checks_for_robustness(robustness) that returns: heavy=all 8 checks, standard=core checks only (~3-4), light=empty tuple (general review only, no structured checks). Update _render_critique_checks() and _render_critique_template() to accept a filtered checks list. Update _critique_prompt() to call checks_for_robustness() and adapt the prompt text: if no checks, just ask for general review via flags array; if checks, render them as today. Single code path, single data source — robustness just filters.
The critique system currently runs all 8 CritiqueCheckSpec checks at every robustness level. The only differentiation is a softer instruction tone for light. This change makes robustness structurally meaningful: heavy gets all 8 checks, standard gets ~3-4 core checks, and light skips structured checks entirely (general review via flags array only).
Rationale: core checks cover the highest-signal axes (did it address the ask? is it correct? right scope? verified?). Extended checks are valuable but lower-signal for standard work.
Add the checks_for_robustness() function:
python
def checks_for_robustness(robustness: str) -> tuple[CritiqueCheckSpec, ...]:
if robustness == "heavy":
return CRITIQUE_CHECKS # all 8
if robustness == "standard":
return tuple(c for c in CRITIQUE_CHECKS if c["tier"] == "core")
return () # light: no structured checks
Updatebuild_empty_template() to accept an optional checks parameter (defaulting to CRITIQUE_CHECKS for backward compat):
python
def build_empty_template(checks: tuple[CritiqueCheckSpec, ...] | None = None) -> list[dict[str, Any]]:
source = checks if checks is not None else CRITIQUE_CHECKS
return [{"id": c["id"], "question": c["question"], "findings": []} for c in source]
Updatevalidate_critique_checks() to accept an optional expected_ids parameter. When provided, validate against that set instead of all check IDs. When expected_ids is empty (light mode), skip check validation entirely and return [].
Update__all__ to export checks_for_robustness.
Step 2: Update prompt rendering to accept filtered checks (megaplan/prompts/critique.py)
Scope: Medium
Update_render_critique_checks() (critique.py:82-90) to accept a checks parameter:
Iterate over the passed checks instead of the global CRITIQUE_CHECKS.
Update_render_critique_template() (critique.py:93-168) to accept a checks parameter:
Pass it through to build_empty_template(checks) for iteration 1.
For iteration 2+, filter the prior findings to only include checks present in the current checks set (handles the case where robustness changed between iterations).
Also update the "Add any new checks" loop at line 144 to iterate over the filtered checks instead of CRITIQUE_CHECKS.
Update_critique_prompt() (critique.py:171-238):
Call checks_for_robustness(robustness) after line 179 to get the active checks.
If checks are non-empty: render them as today — pass the filtered checks to _render_critique_checks(active_checks) and _render_critique_template(plan_dir, state, active_checks). Update the count in the instruction text at line 220 to use len(active_checks) instead of len(CRITIQUE_CHECKS).
If checks are empty (light): omit the checks block and template entirely. Replace the instruction at line 220 with: "No structured checks for this robustness level. Perform a general review and add any concerns directly to the flags array." The flags, verified_flag_ids, and disputed_flag_ids fields still apply.
Step 3: Update validation in handler (megaplan/handlers.py:644-698)
Scope: Small
Inhandle_critique(), after loading robustness (line 661, move earlier to ~line 647), compute the expected check IDs:
python
robustness = configured_robustness(state)
active_checks = checks_for_robustness(robustness)
expected_ids = [c["id"] for c in active_checks]
Passexpected_ids to validate_critique_checks(worker.payload, expected_ids=expected_ids) at line 650.
For light mode (empty expected_ids), validation returns [] — no check validation, the payload just needs valid flags/verified_flag_ids/disputed_flag_ids.
Step 4: Verify and test (tests/)
Scope: Small
Run existing tests to confirm nothing breaks with the new tier field and default behavior.
Add unit tests for checks_for_robustness(): verify heavy returns 8, standard returns 4 core, light returns empty tuple.
Add test for validate_critique_checks() with expected_ids parameter — ensure it validates only the expected subset.
Add test for build_empty_template() with filtered checks — verify it only generates entries for passed checks.
Verify the prompt rendering paths: light produces no checks block, standard produces core-only, heavy produces all.
Execution Order
Step 1 first — establishes the data model and filtering function.
Step 2 next — updates prompt rendering to use filtered checks.
Step 3 — wires the handler to pass robustness context through validation.
Step 4 — verify everything works together.
Validation Order
Run existing test suite after Step 1 to confirm backward compat.
Run new unit tests after Step 4.
Optionally run a light/standard/heavy plan through the full pipeline to confirm prompt differences.
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-31T13:24:23Z",
"hash": "sha256:2adf1bbd8fc37a9b63a20080520d07e08f9b470558cecc764c4003666a322880",
"questions": [
"Which 3-4 checks should be 'core'? The plan proposes issue_hints, correctness, scope, verification (4 checks). An alternative is issue_hints, correctness, scope (3 checks) \u2014 dropping verification since it has default_severity='uncertain'. Does the proposed set of 4 match your intent?",
"For light mode: should the critique schema still require an empty checks: [] array, or should checks become optional in the schema? Requiring empty array is simpler for downstream consumers.",
"If robustness changes between iterations (e.g., iteration 1 at heavy, iteration 2 at standard), should the template show prior findings for all 8 checks or only the currently-active subset? The plan filters to the current subset, which means some prior findings would be hidden."
],
"success_criteria": [
{
"criterion": "CritiqueCheckSpec TypedDict includes a 'tier' field and all 8 checks are tagged",
"priority": "must"
},
{
"criterion": "checks_for_robustness('heavy') returns all 8 checks",
"priority": "must"
},
{
"criterion": "checks_for_robustness('standard') returns only core-tier checks (~4)",
"priority": "must"
},
{
"criterion": "checks_for_robustness('light') returns empty tuple",
"priority": "must"
},
{
"criterion": "_critique_prompt() for light mode omits the checks block and asks for general review via flags only",
"priority": "must"
},
{
"criterion": "_critique_prompt() for standard mode renders only core checks in the prompt",
"priority": "must"
},
{
"criterion": "validate_critique_checks() accepts expected_ids parameter and validates only those",
"priority": "must"
},
{
"criterion": "All existing tests pass without modification (backward compat preserved)",
"priority": "must"
},
{
"criterion": "Single code path: CRITIQUE_CHECKS remains the sole source of truth, checks_for_robustness just filters",
"priority": "must"
},
{
"criterion": "Unit tests cover checks_for_robustness, filtered validate_critique_checks, and filtered build_empty_template",
"priority": "should"
},
{
"criterion": "Prompt text for each robustness level reads naturally (no awkward 'Fill in ALL 0 checks' for light)",
"priority": "should"
},
{
"criterion": "No new files created \u2014 all changes in existing modules",
"priority": "should"
}
],
"assumptions": [
"Core checks are: issue_hints, correctness, scope, verification (4 checks). Extended: all_locations, callers, conventions, criteria_quality.",
"Light mode still requires the flags, verified_flag_ids, and disputed_flag_ids fields \u2014 only structured checks are skipped.",
"The tier field is a simple string ('core' | 'extended'), not an enum or separate type, to keep it lightweight.",
"validate_critique_checks returns [] (valid) when expected_ids is empty, allowing light mode payloads with no checks.",
"Robustness does not change between iterations within a single plan run, so the cross-iteration filtering edge case is theoretical."
],
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[]
Known accepted debt grouped by subsystem:
{
"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"
]
}
],
"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"
]
}
],
"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`.
Fill in ALL 8 checks below. For each, add at least one finding with "detail" (what you found) and "flagged" (true if it's a problem). {"detail": "No issue found", "flagged": false} is valid. You can add multiple findings per check.
1. id="issue_hints" — "Did the work fully address the issue hints, user notes, and approved plan requirements?"
Cross-check the result against explicit user notes, critique corrections, and watch items. Flag anything the implementation ignored, contradicted, or only partially covered.
2. id="correctness" — "Are the proposed changes technically correct?"
Look for logic errors, invalid assumptions, broken invariants, schema mismatches, or behavior that would fail at runtime. When the fix adds a conditional branch, check whether it handles all relevant cases — not just the one reported in the issue.
3. id="scope" — "Is the scope and scale of the change appropriate?"
Flag missing required work, out-of-scope edits, or changes that expand behavior without clear justification. Also ask: is a minimal patch the right scale, or does this issue need new code, new methods, or restructuring?
4. id="all_locations" — "Does the change touch all locations AND supporting infrastructure?"
Search for all instances of the symbol/pattern being changed. Also ask: does this feature require setup, registration, or integration code beyond the core logic? Missing glue code causes test failures even when the core fix is correct.
5. id="callers" — "Is the change in the right place, and would it break any callers?"
First ask: should this change be HERE, or in a caller, callee, or new method? Then check function signatures, return types, and any code that calls or depends on the changed function.
6. id="conventions" — "Does the approach match how the codebase solves similar problems?"
Check not just naming/style but how similar PROBLEMS are solved in this codebase. If the codebase adds new methods for similar cases, the plan should too. Do not spend findings on trivial stylistic preferences.
7. id="verification" — "Is there convincing verification for the change?"
Flag missing tests or weak validation. If verification tests exist, trace the test's execution path through your patch — does every branch it exercises produce the expected result? A patch can look correct but fail because it misses one code path the test covers. If you manually verify an edge case because existing tests don't cover it, also test the cases next to it.
8. id="criteria_quality" — "Are the success criteria well-prioritized and verifiable?"
Check that each `must` criterion has a clear yes/no answer verifiable from code, tests, or git diff. Subjective goals, numeric guidelines, and aspirational targets should be `should`, not `must`. Criteria requiring manual testing or human judgment should be `info`. Flag any `must` criterion that is ambiguous, subjective, or unverifiable in the review pipeline.
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.
Fill in this template with your findings:
[
{
"id": "issue_hints",
"question": "Did the work fully address the issue hints, user notes, and approved plan requirements?",
"findings": []
},
{
"id": "correctness",
"question": "Are the proposed changes technically correct?",
"findings": []
},
{
"id": "scope",
"question": "Is the scope and scale of the change appropriate?",
"findings": []
},
{
"id": "all_locations",
"question": "Does the change touch all locations AND supporting infrastructure?",
"findings": []
},
{
"id": "callers",
"question": "Is the change in the right place, and would it break any callers?",
"findings": []
},
{
"id": "conventions",
"question": "Does the approach match how the codebase solves similar problems?",
"findings": []
},
{
"id": "verification",
"question": "Is there convincing verification for the change?",
"findings": []
},
{
"id": "criteria_quality",
"question": "Are the success criteria well-prioritized and verifiable?",
"findings": []
}
]
code
Additional guidelines:
- Robustness level: light. Be pragmatic. Only flag issues that would cause real failures. Ignore style, minor edge cases, and issues the executor will naturally resolve.
- Over-engineering: prefer the simplest approach that fully solves the problem.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- 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":"The light-mode prompt step does not fully satisfy the requested behavior as written. It says to omit the checks block/template entirely, but this repo still requires a checks field in critique payloads (megaplan/schemas.py:198, megaplan/workers.py:220). To make light mode work reliably, the plan needs an explicit checks: [] contract rather than 'flags only' with no checks field guidance.","flagged":true}]},{"id":"correctness","question":"Are the proposed changes technically correct?","findings":[{"detail":"validate_critique_checks() should not blindly return [] when expected_ids is empty. In this repo, update_flags_after_critique() still iterates over critique.get(\"checks\", []) and turns flagged findings into registry flags (megaplan/flags.py:71). Skipping validation entirely would allow stray or unknown structured checks through in light mode instead of enforcing an empty list.","flagged":true}]},{"id":"scope","question":"Is the scope and scale of the change appropriate?","findings":[{"detail":"No issue found. Tier-tagging the existing registry and filtering it in the prompt/handler path is the right size for this feature; it does not need a larger redesign.","flagged":false}]},{"id":"all_locations","question":"Does the change touch all locations AND supporting infrastructure?","findings":[{"detail":"The plan misses supporting mock infrastructure. megaplan/workers.py:349 builds critique mock payloads from build_empty_template() unconditionally, so a correct light-mode implementation that expects checks: [] also needs the mock critique path updated.","flagged":true}]},{"id":"callers","question":"Is the change in the right place, and would it break any callers?","findings":[{"detail":"Changing handle_critique() to call validate_critique_checks(..., expected_ids=...) will break existing test callers that monkeypatch the function with a one-argument lambda in tests/test_megaplan.py:693 and tests/test_megaplan.py:704. The production call site is right, but the plan is incomplete about affected callers/tests.","flagged":true}]},{"id":"conventions","question":"Does the approach match how the codebase solves similar problems?","findings":[{"detail":"No issue found. Keeping CRITIQUE_CHECKS as the single registry and deriving robustness behavior by filtering that tuple matches the repo's current data-driven pattern.","flagged":false}]},{"id":"verification","question":"Is there convincing verification for the change?","findings":[{"detail":"The proposed tests do not cover the main light-mode failure case. This repo needs a test that light robustness still emits checks: [] and rejects non-empty or unknown structured checks, otherwise the permissive-validation bug can slip through.","flagged":true}]},{"id":"criteria_quality","question":"Are the success criteria well-prioritized and verifiable?","findings":[{"detail":"Two must criteria are weak as written: standard returns only core-tier checks (~4) is ambiguous while the plan still leaves 3-vs-4 core checks unresolved, and All existing tests pass without modification is not realistic against this repo because the changed handler call signature will require test updates.","flagged":true}]}],"flags":[],"verified_flag_ids":[],"disputed_flag_ids":[]}
“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/01m80eq0twppa92m5mf5j2j5np