You are an independent reviewer. Critique the plan against the actual repository.
code
Project directory:
/Users/user_c042661f/Documents/desloppify
User intent summary:
Collapse the current 8-phase lifecycle (review_initial, assessment_postflight, review_postflight, workflow_postflight, triage_postflight, execute, scan, plus coarse aliases) into two modes: "plan" (covering all pre-execution review/workflow/triage work) and "execute" (draining the objective queue). Fix a specific bug where _resolve_reconcile_phase() in pipeline.py perpetually returns assessment_postflight because stale subjective items are re-injected into queue_order every reconcile cycle by sync_subjective_dimensions(), preventing the phase from ever advancing to execute. Additionally, move the stale subjective item synthesis (currently running every reconcile) so it only runs on plan-mode entry, preventing it from blocking the execute phase.
Original idea:
Redesign lifecycle phase system: simplify to plan/execute modes, fix phase transition bug where assessment_postflight never advances to execute, move stale subjective item synthesis to plan mode entry only
User notes and answers:
Q1: Plan mode keeps internal sequencing for coaching but NOT as separate persisted phases. Just plan and execute persisted. Q2: Fix both - stop re-injecting stale items during execute AND fix phase resolver. Q3: Plan mode entry on first scan, queue empty, or explicit user action. Stale items wait for plan mode. Q4: Remove coarse phase map entirely. Q5: Migrate old phases to plan or execute on first reconcile.
Replace the 8 fine-grained + 3 coarse lifecycle phases with exactly two persisted modes: plan and execute. Fix the assessment_postflight deadlock bug by gating stale subjective synthesis to plan-mode entry only.
Replace all 10 phase constants with two: LIFECYCLE_PHASE_PLAN = "plan" and LIFECYCLE_PHASE_EXECUTE = "execute" (execute already exists)
Remove COARSE_PHASE_MAP and coarse_lifecycle_phase() entirely
Update VALID_LIFECYCLE_PHASES to
Assistant
User
Assistant
frozenset({"plan", "execute"})
Add migration in current_lifecycle_phase(): if persisted value is any old phase name, map it to "plan" or "execute" (old execute → execute, everything else → plan)
Keep postflight_scan_pending(), mark_postflight_scan_completed(), clear_postflight_scan_completion(), subjective_review_completed_for_scan(), mark_subjective_review_completed() — these are orthogonal boundary markers
Validation: Tests in test_refresh_lifecycle.py pass after updating assertions to new phase names. current_lifecycle_phase() correctly migrates all old phase strings.
Step 2: Simplify Phase Resolution
File:engine/_plan/sync/pipeline.py
Rewrite _resolve_reconcile_phase():
python
def _resolve_reconcile_phase(plan, state, *, result, policy) -> str:
order = [item for item in plan.get("queue_order", []) if isinstance(item, str)]
has_plan_work = any(
item.startswith("subjective::") or item.startswith("workflow::") or item.startswith("triage::")
for item in order
)
if has_plan_work:
return LIFECYCLE_PHASE_PLAN
return LIFECYCLE_PHASE_EXECUTE
This directly fixes the bug: the resolver no longer returns assessment_postflight when stale items are present — it returns plan, and once plan work is drained it returns execute.
Validation: Existing test_reconcile_pipeline.py tests updated to assert "plan" or "execute" instead of fine-grained phases. Write a regression test: stale subjective items in queue → phase is plan, complete them → phase is execute.
Step 3: Gate Stale Subjective Synthesis to Plan-Mode Entry
Explicit user action (plan command triggers reconcile with force_rescan=True)
Validation: Write test: mid-cycle execute phase with stale dimensions → stale items NOT injected. Cycle boundary → stale items injected, phase becomes plan.
Step 4: Simplify Phase Cleanup
File:engine/_plan/sync/phase_cleanup.py
Update _phase_prefixes():
LIFECYCLE_PHASE_PLAN: prune nothing (plan mode needs all synthetic items)
LIFECYCLE_PHASE_EXECUTE: prune workflow:: and triage:: prefixes (unchanged behavior)
Validation:test_phase_cleanup.py updated with new phase names, same behavioral assertions.
Step 5: Update Work Queue Snapshot
File:engine/_work_queue/snapshot.py
Remove aliased PHASE_* constants for old phases, replace with PHASE_PLAN and PHASE_EXECUTE
Remove _FINE_GRAINED_ITEM_MAP — no longer needed for phase validation
Update _phase_for_snapshot() to work with two phases
Keep QueueSnapshot partition fields (all_initial_review_items, all_postflight_assessment_items, etc.) — these are display partitions, not phase gates. The coaching system uses them to know what KIND of plan work is queued without needing separate phases.
Validation:work_queue_cases.py tests updated; phase field always "plan" or "execute".
Step 6: Update Queue Policy Display
File:engine/_work_queue/policy.py
Update _PHASE_LABELS to two entries: plan → "plan", execute → "execute"
Update explain_queue() branches: collapse the review_initial/assessment/workflow/triage explanations into a single plan branch that describes what plan work remains (using snapshot partition counts for detail)
Validation: Manual check that explain_queue() output is coherent.
Step 7: Update Progression Events
File:engine/_state/progression.py
Replace _PLANNING_PHASES frozenset with a single check: phase == "plan"
Update maybe_append_entered_planning() to check for "plan" instead of membership in a set
Validation:test_transition_messages.py updated. Existing user configs with old phase keys (e.g., "triage") will stop matching — document this as a breaking change in release notes.
Step 10: Update Directives
File:app/commands/directives.py
Simplify _PHASES from 5 entries to 3: execute, plan, scan
plan encompasses the old postflight/triage/review descriptions
scan stays as-is
Update validation to accept new phase names
Old directive configs with "triage", "review", "postflight" keys become inert (user must re-set them)
Validation: Manual check of desloppify directives show output.
Step 11: Update Synthetic Item Builders
File:engine/_work_queue/synthetic.py
Replace imports of LIFECYCLE_PHASE_REVIEW_INITIAL, LIFECYCLE_PHASE_TRIAGE, etc. with LIFECYCLE_PHASE_PLAN
Update phase checks in build_subjective_items() and build_triage_stage_items() to check == "plan" instead of individual phases
Validation: Grep for all old phase constant imports; zero remaining references.
Step 13: Update Tests
Update all ~16 test files that reference phase constants or strings. The changes are mechanical: replace old phase names with "plan" or "execute". Key files:
test_reconcile_pipeline.py — most assertions change
test_phase_cleanup.py — reduce to two phase branches
work_queue_cases.py — update phase field expectations
Add new regression test:test_stale_not_injected_during_execute — verifies that stale dimensions don't re-inject while in execute mode mid-cycle.
Validation: Full test suite passes: python -m pytest desloppify/tests/ -q
Execution Order
Steps 1-3 are the core changes (constants, resolver, synthesis gating). Steps 4-12 are mechanical consumer updates. Step 13 is test alignment.
Recommended batching:
Steps 1-3 together — the bug fix and phase model change. Run tests to identify all breakage.
Steps 4-12 — fix all consumers. Most are import/string replacements.
Step 13 — update test assertions. Full suite green.
Data Migration
Old .desloppify/ state files with lifecycle_phase set to any old value are handled by the migration logic in current_lifecycle_phase() (Step 1). No separate migration script needed — the code auto-migrates on first read.
Note: "scan" maps to "plan" because scan was a transient phase between cycles and plan-mode entry is the natural next state after scan.
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-22T23:20:35Z",
"hash": "sha256:4410592d2da891647dc52696d116dfbec112d8844c6e71896112e82c14b0aced",
"questions": [
"Should scan remain as a third phase, or truly fold into plan? Currently scan is used by score_display_mode() to show LIVE scores and by clear_postflight_scan_completion() as a transient reset. Making it a sub-state of plan is cleaner but means we lose the ability to show LIVE scores specifically during scanning \u2014 is that acceptable?",
"For transition_messages config: should we add a one-time migration that renames old keys (triage\u2192plan, review\u2192plan, postflight\u2192plan) in the user's config.json, or just let them break and document?",
"The QueueSnapshot dataclass has 7 partition tuple fields (initial_review, postflight_assessment, etc.). After this change they're purely display partitions with no phase-gating role. Should we consolidate them into fewer fields (e.g., plan_items and execute_items) or keep the granularity for coaching detail?"
],
"success_criteria": [
"Full test suite passes: python -m pytest desloppify/tests/ -q \u2014 0 failures",
"VALID_LIFECYCLE_PHASES contains exactly {"plan", "execute"}",
"grep -r 'assessment_postflight\|review_initial\|review_postflight\|workflow_postflight\|triage_postflight\|COARSE_PHASE_MAP\|coarse_lifecycle_phase' desloppify/ returns zero matches (excluding test history comments)",
"Regression test: create plan with stale subjective items in queue_order during execute mid-cycle \u2192 reconcile does NOT re-inject them \u2192 phase stays execute",
"Regression test: queue empties \u2192 postflight scan \u2192 reconcile injects stale items \u2192 phase becomes plan",
"Regression test: complete all plan work \u2192 reconcile \u2192 phase transitions to execute",
"Old plan data with lifecycle_phase='assessment_postflight' loads correctly and migrates to 'plan' on first reconcile",
"Self-scan works: python -m desloppify --lang python scan --path desloppify completes without error",
"explain_queue() output for plan phase is human-readable and describes what plan work remains"
],
"assumptions": [
"The scan phase was always transient (set briefly, then overwritten on reconcile) \u2014 mapping it to plan is safe",
"No external tools or scripts depend on the exact phase string values persisted in .desloppify/ state files (internal tool, not a library)",
"The QueueSnapshot partition fields (all_initial_review_items, all_postflight_assessment_items, etc.) remain useful for coaching display even without corresponding lifecycle phases \u2014 they partition by item type, not by phase gate",
"User-configured transition_messages and directives with old phase keys (e.g., 'triage', 'review') becoming inert is acceptable \u2014 users re-set them for 'plan'",
"The postflight boundary markers (postflight_scan_pending, subjective_review_completed_for_scan, etc.) are orthogonal to the phase model and remain useful for gating within plan mode",
"Hermes model switching config with old phase keys will need user reconfiguration \u2014 no automatic migration for config.json keys"
]
}
code
Existing flags:
[]
Requirements:
- Consider whether the plan is at the right level of abstraction. If it
patches multiple systems for one goal, it may be too low — flag whether
a simpler design would eliminate the problem class. If it redesigns
architecture for a simple bug, it may be too high. Push the plan up or
down the abstraction ladder as needed.
- Reuse existing flag IDs when the same concern is still open.
- verified_flag_ids should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent (above), not just internal plan quality.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern so the orchestrator can surface it.
- Do not rubber-stamp the plan.
- Assign severity_hint carefully: "likely-significant" for issues that would
cause real product or implementation problems. "likely-minor" for cosmetic,
nice-to-have, issues already covered elsewhere, or implementation details
the executor will naturally resolve by reading the actual code (e.g. exact
line numbers, missing boilerplate, export lists).
{"flags":[{"id":"scope-creep-snapshot-collapse","concern":"Scope creep: the plan collapses the entire queue/snapshot/UI model to two phases, but the user only asked for two persisted lifecycle modes while keeping internal sequencing for coaching. In this repo, fine-grained sequencing already lives in QueueSnapshot/queue policy rather than just in persisted phase strings, so rewriting snapshot, policy, directives, and synthetic builders is a much larger redesign than the stated goal.","category":"maintainability","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/snapshot.py:66-108 keeps separate partitions for initial review, assessment, review, scan, workflow, and triage; /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/policy.py:3-13,69-120 says visibility is re-resolved from items each build and explains each fine-grained phase from the snapshot."},{"id":"missing-plan-mode-selection-semantics","concern":"The two-phase rewrite is underspecified for what desloppify next should actually surface. Today visibility is selected by fine-grained phase, and the proposed Step 5 only says '_phase_for_snapshot() works with two phases' without replacing the selection logic. That risks either hiding plan work or surfacing objective work too early.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/snapshot.py:500-533 chooses visible items separately for review_initial, scan, assessment_postflight, review_postflight, workflow_postflight, triage_postflight, and execute. build_queue_snapshot() then uses that phase at /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/snapshot.py:705-730. The proposed _resolve_reconcile_phase() pseudocode also drops the existing review-backlog fallback at /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/sync/pipeline.py:122-136."},{"id":"explicit-plan-entry-not-implemented","concern":"The plan says plan mode should also start on explicit user action, but the implementation steps do not add any actual entrypoint for that. In the current repo, force_rescan is only threaded through post-scan reconciliation; desloppify plan commands do not call reconcile at all.","category":"completeness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/scan/plan_reconcile.py:353-364 is where force_rescan reaches reconcile_plan(). By contrast, plan command dispatch in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/cmd.py:57-120 just renders output, and rg under app/commands/plan only finds reconcile_plan() in workflow resolution, not on generic plan entry."},{"id":"flattening-plan-phase-breaks-subjective-builder-rules","concern":"Step 11 is likely wrong as written: replacing fine-grained phase checks in build_subjective_items() with phase == \"plan\" would change behavior, not just rename states. That code currently distinguishes workflow/triage from initial review, and broadening it to all plan contexts would suppress or trigger subjective refreshes at the wrong times.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/synthetic.py:261-279 suppresses same-cycle stale refresh only during workflow/triage phases, and /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/synthetic.py:314-322 treats review_initial specially for below-target review work. There is already a regression test for the workflow-only suppression at /Users/user_c042661f/Documents/desloppify/desloppify/tests/engine/test_sync_split_modules_direct.py:1062-1098."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
code
Project directory:
/Users/user_c042661f/Documents/desloppify
User intent summary:
Collapse the current 8-phase lifecycle (review_initial, assessment_postflight, review_postflight, workflow_postflight, triage_postflight, execute, scan, plus coarse aliases) into two modes: "plan" (covering all pre-execution review/workflow/triage work) and "execute" (draining the objective queue). Fix a specific bug where _resolve_reconcile_phase() in pipeline.py perpetually returns assessment_postflight because stale subjective items are re-injected into queue_order every reconcile cycle by sync_subjective_dimensions(), preventing the phase from ever advancing to execute. Additionally, move the stale subjective item synthesis (currently running every reconcile) so it only runs on plan-mode entry, preventing it from blocking the execute phase.
Original idea:
Redesign lifecycle phase system: simplify to plan/execute modes, fix phase transition bug where assessment_postflight never advances to execute, move stale subjective item synthesis to plan mode entry only
User notes and answers:
Q1: Plan mode keeps internal sequencing for coaching but NOT as separate persisted phases. Just plan and execute persisted. Q2: Fix both - stop re-injecting stale items during execute AND fix phase resolver. Q3: Plan mode entry on first scan, queue empty, or explicit user action. Stale items wait for plan mode. Q4: Remove coarse phase map entirely. Q5: Migrate old phases to plan or execute on first reconcile.
Replace the 8 persisted lifecycle phases with exactly two persisted modes: plan and execute. Fix the assessment_postflight deadlock bug by gating stale subjective synthesis to plan-mode entry only.
Key design principle: The persisted lifecycle phase (what mode the system is in) simplifies to plan/execute. The snapshot display phase (what items desloppify next shows) continues to derive fine-grained item-type selection from partition contents — this is the "internal sequencing for coaching" the user asked to preserve. These are already separate code paths.
Remove COARSE_PHASE_MAP and coarse_lifecycle_phase()
Keep all old fine-grained constants temporarily (they're still imported by snapshot.py for display, see Step 5). Mark them with a comment: # Display-only — not used as persisted phases
Update VALID_LIFECYCLE_PHASES to frozenset({"plan", "execute"})
Add migration in current_lifecycle_phase(): if persisted value is any old phase name, map to "plan" or "execute" ("execute" → "execute", everything else → "plan")
Keep all boundary marker functions unchanged (postflight_scan_pending(), mark_postflight_scan_completed(), etc.)
Validation:test_refresh_lifecycle.py passes after updating assertions. current_lifecycle_phase() correctly migrates all old phase strings.
Step 2: Simplify Persisted Phase Resolution
File:engine/_plan/sync/pipeline.py
Rewrite _resolve_reconcile_phase() to return only plan or execute:
python
def _resolve_reconcile_phase(plan, state, *, result, policy) -> str:
order = [item for item in plan.get("queue_order", []) if isinstance(item, str)]
has_plan_work = any(
item.startswith("subjective::") or item.startswith("workflow::") or item.startswith("triage::")
for item in order
)
if has_plan_work:
return LIFECYCLE_PHASE_PLAN
# Preserve the existing review-backlog fallback: if triage ran, no triage
# items remain, triage isn't stale, and open review issues exist → plan mode.
triage_snapshot = build_triage_snapshot(plan, state)
if (
triage_snapshot.triage_has_run
and not triage_snapshot.has_triage_in_queue
and not triage_snapshot.is_triage_stale
and bool(triage_snapshot.live_open_ids)
):
return LIFECYCLE_PHASE_PLAN
persisted = current_lifecycle_phase(plan)
if persisted:
return persisted
if open_review_ids(state):
return LIFECYCLE_PHASE_PLAN
return LIFECYCLE_PHASE_EXECUTE
This fixes the bug: stale subjective items in queue → plan (not assessment_postflight). Once plan work drains → execute. The review-backlog fallback from the original resolver (lines 122-136) is preserved.
Validation: Update test_reconcile_pipeline.py assertions to "plan" or "execute". Add regression test: stale subjective items in queue → plan, complete them → execute.
Step 3: Gate Stale Subjective Synthesis to Plan-Mode Entry
Prune pass still runs — if stale items were previously in queue_order and the phase is now execute, they get pruned out by the existing _prune_subjective_ids() with reduced keep_ids
Plan-mode entry triggers (unchanged from current cycle-boundary logic):
force_rescan=True resets plan_start_scores → not mid-cycle
Validation: Write test: mid-cycle execute phase with stale dimensions → stale items NOT injected → phase stays execute. Cycle boundary → stale items injected → phase becomes plan.
Step 4: Simplify Phase Cleanup
File:engine/_plan/sync/phase_cleanup.py
Update _phase_prefixes() to accept "plan" and "execute":
"plan": prune nothing (plan mode needs all synthetic items)
"execute": prune workflow:: and triage:: prefixes (unchanged behavior)
Keep old fine-grained phase handling as dead-code defense (if somehow an old phase leaks in)
Validation:test_phase_cleanup.py updated to test "plan" and "execute" inputs.
Step 5: Leave Snapshot Display Phase Intact
File:engine/_work_queue/snapshot.py — minimal changes only
The snapshot system (_phase_for_snapshot(), _execution_items_for_phase(), _sticky_postflight_phase()) derives its own fine-grained display phase from item partition contents. This is the internal sequencing the user wants to preserve for coaching. Do not rewrite this logic.
Changes:
_phase_for_snapshot() currently reads current_lifecycle_phase(plan) and uses it for sticky-phase inference. After migration, this returns "plan" or "execute". Update _sticky_postflight_phase() to handle "plan" the same as the old coarse "review" phase (its existing else-branch already does this — just ensure "plan" falls through correctly).
Remove _COARSE_POSTFLIGHT_PHASES set — replace its membership check with persisted_phase == "plan"
Keep all PHASE_* aliases and _FINE_GRAINED_ITEM_MAP — they're used for display phase resolution, not persisted phase.
QueueSnapshot.phase continues to hold fine-grained display values like "assessment_postflight", "workflow_postflight", etc. These are snapshot-local, never persisted.
Validation:work_queue_cases.py tests pass with no assertion changes (snapshot phases are display-derived, not from persisted lifecycle).
Step 6: Update Queue Policy Display
File:engine/_work_queue/policy.py
Keep _PHASE_LABELS mapping fine-grained display phases (from snapshot) — these labels describe what desloppify next is showing, not the persisted lifecycle mode
explain_queue() branches on snapshot.phase which remains fine-grained — no changes needed
Validation: No changes, existing tests pass.
Step 7: Leave Synthetic Item Builders Intact
File:engine/_work_queue/synthetic.py — no changes
The _suppressed_same_cycle_refresh() function (line 264) checks current_phase against workflow/triage phases. The current_phase it reads comes from current_lifecycle_phase(plan), which after migration returns "plan" (not workflow/triage). This means:
In plan mode, the check current_phase not in {WORKFLOW, WORKFLOW_POSTFLIGHT, TRIAGE, TRIAGE_POSTFLIGHT} evaluates to True → suppression does NOT fire → stale refresh items are shown. This is correct: we want stale refreshes visible during plan mode.
The LIFECYCLE_PHASE_REVIEW_INITIAL check at line 320 (current_phase != LIFECYCLE_PHASE_REVIEW_INITIAL) also evaluates correctly: "plan" != "review_initial" is True, so below-target items are included. This is correct.
No behavioral change needed. The old phase constants remain importable for these comparisons but are never persisted.
Validation: Run test_sync_split_modules_direct.py — existing regression test at line 1062-1098 confirms workflow suppression behavior. Verify it still passes because the persisted phase is now "plan" (not workflow), which correctly disables suppression.
Step 8: Update Progression Events
File:engine/_state/progression.py
Replace _PLANNING_PHASES frozenset with frozenset({"plan"})
maybe_append_entered_planning(): phase_after == "plan" instead of set membership
Tests that assert on snapshot phases (work_queue_cases.py, test_sync_split_modules_direct.py) should NOT need changes — snapshot phases remain fine-grained.
Add regression test:test_stale_not_injected_during_execute — mid-cycle execute with stale dims → no injection → phase stays execute.
Validation: Full test suite passes: python -m pytest desloppify/tests/ -q
Execution Order
Steps 1-3 — core phase model + bug fix + synthesis gating. Run tests to identify breakage.
Does NOT rewrite snapshot display logic — _phase_for_snapshot(), _execution_items_for_phase(), _sticky_postflight_phase() keep their fine-grained item-type-based phase selection. desloppify next continues to show the right items for the right context.
Does NOT change synthetic item builders — build_subjective_items() keeps its phase-specific suppression logic. The persisted phase change from fine-grained to "plan" has correct behavioral effects (disables workflow/triage-specific suppression, which is right).
Does NOT add an explicit plan-entry command — the user's three triggers (first scan, queue empty, explicit user action) are already covered: first scan and queue-empty trigger reconcile at cycle boundaries. For "explicit user action", desloppify plan already renders plan output; if forced re-entry to plan mode is needed later, that's a separate feature, not part of this bug fix.
Data Migration
Old .desloppify/ state files with lifecycle_phase set to any old value are handled by current_lifecycle_phase() (Step 1). No separate migration script needed.
"version": 2,
"timestamp": "2026-03-22T23:27:04Z",
"hash": "sha256:91cdef54aeef5196b1f9a74af9dcac4e2396618cdf078aaf68a2172f374cd931",
"changes_summary": "Narrowed scope significantly based on all four flags:\n\n1. scope-creep-snapshot-collapse (FIXED): Snapshot display logic (_phase_for_snapshot, _execution_items_for_phase, _sticky_postflight_phase, QueueSnapshot.phase) is no longer rewritten. It keeps fine-grained display phases derived from item partitions. Only the persisted lifecycle phase simplifies to plan/execute. Steps 5 and 6 went from "rewrite" to "minimal compatibility fix" and "no changes" respectively.\n\n2. missing-plan-mode-selection-semantics (FIXED): desloppify next visibility is controlled by snapshot display phases, which remain fine-grained and item-derived. The plan now explicitly documents that QueueSnapshot.phase continues to hold values like \"assessment_postflight\" for display \u2014 these are snapshot-local, never persisted. Step 5 has concrete detail on how _sticky_postflight_phase() handles the new \"plan\" persisted value.\n\n3. explicit-plan-entry-not-implemented (FIXED): Removed the claim that explicit user action is a new trigger. The existing triggers (first scan = not mid-cycle, queue empty = not mid-cycle, force_rescan = resets plan_start_scores = not mid-cycle) already cover all three user-stated entry points. Added a "What This Plan Does NOT Do" section making this explicit.\n\n4. flattening-plan-phase-breaks-subjective-builder-rules (FIXED): Step 11 changed from "rewrite synthetic builders" to "no changes needed". Added detailed analysis of why the persisted phase changing from fine-grained to \"plan\" produces correct behavior in _suppressed_same_cycle_refresh() and the below-target review check. Old phase constants remain importable for comparison even though they're no longer persisted.\n\nThe review-backlog fallback (pipeline.py lines 122-136) is preserved in the new _resolve_reconcile_phase() \u2014 previous version dropped it.",
"flags_addressed": [
"scope-creep-snapshot-collapse",
"missing-plan-mode-selection-semantics",
"explicit-plan-entry-not-implemented",
"flattening-plan-phase-breaks-subjective-builder-rules"
],
"questions": [
"For transition_messages config: should we add a one-time migration that renames old keys (triage\u2192plan, review\u2192plan, postflight\u2192plan) in the user's config.json, or just let them be reachable via the 'postflight' fallback and document the change?"
],
"success_criteria": [
"Full test suite passes: python -m pytest desloppify/tests/ -q \u2014 0 failures",
"VALID_LIFECYCLE_PHASES contains exactly {"plan", "execute"}",
"current_lifecycle_phase() returns only "plan" or "execute" for any persisted value (including old phase names)",
"Regression test: mid-cycle execute with stale subjective items \u2192 reconcile does NOT re-inject them \u2192 phase stays execute",
"Regression test: cycle boundary \u2192 reconcile injects stale items \u2192 phase becomes plan",
"Regression test: complete all plan work \u2192 reconcile \u2192 phase transitions to execute",
"Old plan data with lifecycle_phase='assessment_postflight' loads and migrates to 'plan'",
"QueueSnapshot.phase still holds fine-grained display values (assessment_postflight, workflow_postflight, etc.) for item visibility \u2014 NOT collapsed to plan/execute",
"Self-scan works: completes without error",
"Synthetic builder regression test (test_sync_split_modules_direct.py:1062-1098) passes unchanged",
"COARSE_PHASE_MAP and coarse_lifecycle_phase() no longer exist in codebase"
],
"assumptions": [
"The persisted lifecycle phase and snapshot display phase are already separate concerns \u2014 persisted phase controls synthesis gating and progression events, snapshot phase controls item visibility in ",
"Snapshot's else-branch (coarse 'review' handling) works correctly for the new 'plan' persisted value \u2014 it already falls through to review-style sequencing",
"Old fine-grained phase constants remain importable as display-only constants even after they stop being valid persisted values",
"The behavioral change in (suppression no longer fires in plan mode because 'plan' != workflow/triage) is correct \u2014 we want stale refreshes visible during plan mode",
"No external tools depend on exact persisted phase string values (.desloppify/ state files are internal)",
"User-configured transition_messages with old phase keys are reachable via 'postflight' fallback",
"The three existing triggers (first scan, queue empty, force_rescan) cover the user's stated plan-mode entry points without needing a new command"
],
"delta_from_previous_percent": 70.88
}
code
Existing flags:
[
{
"id": "scope-creep-snapshot-collapse",
"concern": "Scope creep: the plan collapses the entire queue/snapshot/UI model to two phases, but the user only asked for two persisted lifecycle modes while keeping internal sequencing for coaching. In this repo, fine-grained sequencing already lives in QueueSnapshot/queue policy rather than just in persisted phase strings, so rewriting snapshot, policy, directives, and synthetic builders is a much larger redesign than the stated goal.",
"status": "addressed",
"severity": "significant"
},
{
"id": "missing-plan-mode-selection-semantics",
"concern": "The two-phase rewrite is underspecified for what desloppify next should actually surface. Today visibility is selected by fine-grained phase, and the proposed Step 5 only says '_phase_for_snapshot() works with two phases' without replacing the selection logic. That risks either hiding plan work or surfacing objective work too early.",
"status": "addressed",
"severity": "significant"
},
{
"id": "explicit-plan-entry-not-implemented",
"concern": "The plan says plan mode should also start on explicit user action, but the implementation steps do not add any actual entrypoint for that. In the current repo, force_rescan is only threaded through post-scan reconciliation; desloppify plan commands do not call reconcile at all.",
"status": "addressed",
"severity": "significant"
},
{
"id": "flattening-plan-phase-breaks-subjective-builder-rules",
"concern": "Step 11 is likely wrong as written: replacing fine-grained phase checks in build_subjective_items() with phase == \"plan\" would change behavior, not just rename states. That code currently distinguishes workflow/triage from initial review, and broadening it to all plan contexts would suppress or trigger subjective refreshes at the wrong times.",
"status": "addressed",
"severity": "significant"
}
]
code
Requirements:
- Consider whether the plan is at the right level of abstraction. If it
patches multiple systems for one goal, it may be too low — flag whether
a simpler design would eliminate the problem class. If it redesigns
architecture for a simple bug, it may be too high. Push the plan up or
down the abstraction ladder as needed.
- Reuse existing flag IDs when the same concern is still open.
- verified_flag_ids should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent (above), not just internal plan quality.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern so the orchestrator can surface it.
- Do not rubber-stamp the plan.
- Assign severity_hint carefully: "likely-significant" for issues that would
cause real product or implementation problems. "likely-minor" for cosmetic,
nice-to-have, issues already covered elsewhere, or implementation details
the executor will naturally resolve by reading the actual code (e.g. exact
line numbers, missing boilerplate, export lists).
{"flags":[{"id":"explicit-plan-entry-not-implemented","concern":"The plan still does not implement the user's explicit-entry requirement. It now redefines that requirement away by saying no explicit plan-entry command is needed, but in the actual repo desloppify plan does not trigger reconcile or mode switching, and force_rescan is only a scan path, not a generic user action for entering plan mode.","category":"completeness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/scan/plan_reconcile.py:353-364 is the only place force_rescan reaches reconcile_plan(). desloppify plan dispatch in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/cmd.py:57-120 renders/manipulates plan state but does not reconcile into plan mode. The earlier rg over app/commands/plan only found reconcile_plan() in workflow resolution, not on general plan entry."},{"id":"flattening-plan-phase-breaks-subjective-builder-rules","concern":"Leaving engine/_work_queue/synthetic.py unchanged is not safe once current_lifecycle_phase() only returns plan/execute. Those builders currently rely on fine-grained persisted phase values for behavior, so the migration silently changes semantics even without editing the file. In particular, same-cycle stale-refresh suppression during workflow/triage stops working, which contradicts current regression coverage.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/synthetic.py:261-279 suppresses stale refresh only when current_phase is one of the workflow/triage phases, and /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/synthetic.py:318-322 treats review_initial specially. After Step 1, current_lifecycle_phase() would map persisted workflow/triage to plan, so those comparisons no longer match. The repo already has a regression test expecting suppression during workflow at /Users/user_c042661f/Documents/desloppify/desloppify/tests/engine/test_sync_split_modules_direct.py:1062-1098."},{"id":"phase-gating-still-circular","concern":"The stale-injection fix is still circular. Step 3 gates stale synthesis on the current persisted phase being execute, but reconcile_plan() calls sync_subjective_dimensions() before _resolve_reconcile_phase(). On the reconcile pass that is supposed to move from plan back to execute, the persisted phase is still plan, so stale items can still be re-injected before the new phase is resolved.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/sync/pipeline.py:171-175 runs sync_subjective_dimensions() first, and only later /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/sync/pipeline.py:217-223 computes and persists the new lifecycle phase. A guard of 'skip stale injection when current_phase == execute' therefore cannot help on the transition reconcile where current_lifecycle_phase(plan) still reports the previous planning mode."}],"verified_flag_ids":["scope-creep-snapshot-collapse","missing-plan-mode-selection-semantics"],"disputed_flag_ids":[]}