Find the desloppify task queue / plan files. Look for:
Any .desloppify/ directory with plan or task files (JSON, YAML, etc.)
Any TODO.md, TASKS.md, PLAN.md, or similar files in the project root
Any task queue or backlog files anywhere in the repo
Search thoroughly - check the project root, .desloppify/ directory, and any docs/ or planning/ directories. Read the contents of whatever you find so I can review them.
Assistant
I'll search thoroughly for task queue and plan files in the desloppify project.
Assistant
Let me check the .desloppify directory structure and look for current plan files:
Assistant
Great! I found the plan files. Let me also check for any markdown files in the project root:
Assistant
Now let me read the main plan.json file and query.json to understand the task structure:
Assistant
Let me get a better overview of the plan.json structure by checking its size and key sections:
Assistant
Let me check the structure and top-level keys of the plan:
Assistant
Now let me get a summary of the clusters and their task counts:
Assistant
Let me get more complete data on all clusters:
Assistant
Perfect! Now let me get summary statistics on the plan:
Assistant
Now let me check the queue order and current high-priority items:
Assistant
Excellent! Now let me check what the skipped and superseded items look like:
Assistant
Let me check the structure of those fields:
Assistant
Let me get a better view of these:
Assistant
Perfect! Now let me create a comprehensive summary document. Let me also check the triage_runs directory:
Assistant
Now let me compile a comprehensive summary. Based on my exploration, I have found the desloppify task queue and plan files. Here's my report:
Summary: Desloppify Task Queue and Plan Files
I found the complete task queue and plan system in the .desloppify/ directory. Here are the key files:
Total Clusters: 61 (20 auto-generated, 41 manual/strategic)
Total Issues: 2,059 tracked items
Queue Items: 46 prioritized tasks
Skipped Items: 47 issues
Superseded Items: 364 items (resolved/replaced)
Uncommitted Issues: 156 items
Top Priority Issues (from queue_order)
The highest priority tasks are triage stage operations (orchestrated flow):
triage::observe
triage::reflect
triage::organize
triage::enrich
triage::sense-check
triage::commit
Followed by holistic review findings (7 items):
Legacy public surfaces blur ownership
Prepared review packet not runtime canonical
Duplicate update skill facade
Duplicated enrich confirmation flow
Overinjected stage dependency bags
Repeated coaching prose blocks
Generic language dual configuration surface
Largest Issue Clusters (by count)
auto/security: 1,310 issues
auto/subjective_review: 391 issues
auto/private_imports: 124 issues
auto/smells-high_cyclomatic_complexity: 38 issues
auto/test_coverage: 27 issues
auto/stale_wontfix: 20 issues
auto/initial-review: 20 issues
Manual/Strategic Clusters (0 issues but active work items)
User
I need to write concrete action plans for 5 code cleanup items. For each, read the relevant source files and tell me EXACTLY what to do — specific files, function signatures, step-by-step changes. No vague "extract a helper" — tell me the module name, the function name, the parameters.
Item 1: lang_run_overrides_hidden_sentinel
Read the file containing LangRunOverrides (search for it)
Read _apply_lang_overrides() and _coerce_lang_override()
Tell me: what's the right way to model the tri-state? Specific type, specific field changes.
Tell me: what TypedDict shape matches the actual usage? List the fields and their types.
Item 9: policy_load_masks_corruption
Search for load_policy function
Read the file containing it
Tell me: what error type to use, which callers need updating, specific changes.
Item 20: duplicate_update_skill_facade
Read desloppify/app/commands/update_skill/__init__.py and the corresponding cmd.py or _cmd.py
Tell me: which file should be the source of truth? What should the other become?
Item 21: mixed_command_entrypoint_layout
Read desloppify/app/commands/registry.py
List which commands are flat modules vs package entrypoints
Tell me: which convention to standardize on and which specific files to move/rename.
For each item, give me a step-by-step action plan that a code monkey could follow without thinking.
Assistant
I'll systematically find and read these files to give you concrete action plans. Let me start by searching for the key files and functions.
Assistant
Good. Now let me read the relevant files and search for the specific functions.
Assistant
Now let me search for the cmd.py files and additional context for the remaining items.
User
I need to write concrete action plans for 4 code cleanup items. For each, read the relevant source files and tell me EXACTLY what to do — specific files, function signatures, step-by-step changes.
Tell me: what fields to rename? Where's the compat adapter boundary?
For each item, give me a step-by-step action plan that a code monkey could follow without thinking.
Assistant
I'll systematically read the relevant files and extract concrete action plans for each item.
Assistant
Now let me check the commands directory structure to understand the layout better.
Assistant
Perfect. Now let me search for where load_policy is actually called to understand error handling.
Assistant
Now I need to read the workflow_patterns file and look at the completion_policy file to see the cycle.
Assistant
Now let me read the policy_cmd file and check imports to understand the error handling.
User
I need to write concrete action plans for 4 code cleanup items. For each, read the relevant source files and tell me EXACTLY what to do — specific files, function signatures, step-by-step changes.
Item 14: duplicated_enrich_confirmation_flow
Search for confirm_enrich and confirm_sense_check functions
Read both files
Read _collect_enrich_level_confirmation_checks
Tell me: what does the shared renderer look like? What parameters differ between the two? Where does it live?
Identify which wrappers are pure pass-through (just forward to an import)
Tell me: which specific functions to inline, and where their call sites are.
Item 18: treesitter_dual_namespace_surface
List all files in desloppify/languages/_framework/treesitter/ at the root level (the compat bridges)
Read 2-3 of them to confirm they're pure bridges
List what imports them (callers)
Tell me: which bridge files to delete, which callers to update, in what order.
For each item, give me a step-by-step action plan that a code monkey could follow without thinking.
Assistant
Now let me check the cycle in core.py and completion_stages.py more carefully:
Assistant
I'll systematically explore each item to understand the structure and provide exact action plans.
Assistant
Perfect. Now let me check the reconcile_plan_after_scan function to understand the plan object shape.
Assistant
Now let me search for the confirm functions and read the relevant files:
Assistant
Perfect. Now let me check the legacy epic compat and also look at which part of plan_triage imports what:
Assistant
Now let me read the reconcile.py file and check the plan schema:
Assistant
Good! Now let me read the key files for each item:
Assistant
Let me look at the prompt.py file in the triage folder (not core.py, but prompt.py):
User
I need to write concrete action plans for 4 code cleanup items. For each, read the relevant source files and tell me EXACTLY what to do — specific files, function signatures, step-by-step changes.
Find configure_subjective_dimension_providers and PROVIDER_STATE
Find what imports this module (callers)
Tell me: where should the bootstrap call move to? What's the specific change?
For each item, give me a step-by-step action plan that a code monkey could follow without thinking.
Assistant
Let me read the actual schema.py file:
Assistant
Now let me check the orchestrator and validation files for Item 15 and 16:
Assistant
Good, I already read that one. Now let me trace the completion_policy imports more carefully to find the cycle:
Assistant
I'll read through these files systematically to understand the current structure and provide concrete action plans.
Assistant
Let me search for the PlanModel definition:
Assistant
Now check if completion_policy and completion_stages import each other:
Assistant
Now let me search for call sites of explode_to_single_dimension and gather more context on the other items.
Assistant
Now let me check the treesitter bridge files:
Assistant
Let me search for PlanModel definition:
Assistant
Good - no mutual imports. Let me look at what the actual pattern/namespace hierarchy is:
Assistant
Good! Now let me read the schema/init.py:
Assistant
Now let me verify: the cycle is core.py imports both completion_policy and completion_stages, and completion_stages imports from core.py. Let me check:
Assistant
Now let me search for callers of these bridge files:
Assistant
Perfect! Now let me check command layout more carefully to complete item 21:
Assistant
Aha! There's a local import already to break the cycle. Let me look at that in context:
Assistant
Let me read those test files to see how the bridges are imported:
Assistant
Now let me find where else configure_subjective_dimension_providers is imported:
Assistant
Let me check the test file that imports the bridge and read the validation/core module:
Assistant
Let me check where configure_subjective_dimension_providers is being called at runtime:
Assistant
Now let me read the validation files to understand the structure:
Assistant
Perfect. Now let me gather comprehensive summary on the batch orchestrator's responsibilities:
Assistant
Now let me check which specific bridge files exist and list all imports to them:
Assistant
Perfect. Now let me check what's in the core.py validation file:
Assistant
Now let me check what modules currently exist in the batch directory and look at the execution module more closely:
Assistant
Perfect! Now let me read the enrich_checks.py to understand the validation structure fully:
Assistant
Perfect. Now let me create a comprehensive report with action plans for each item. Let me read the execution.py file to understand the current structure:
Assistant
Perfect. Now I have enough data. Let me compile the comprehensive action plans for all four items.
CONCRETE ACTION PLANS FOR CODE CLEANUP ITEMS
Item 7: public_route_rule_mismatch
Current State:
_PUBLIC_ROUTE_RE pattern lives in /Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/context_signals/auth.py (line 24-27)
_looks_like_edge_handler() and _handler_has_auth_check() in /Users/user_c042661f/Documents/desloppify/desloppify/languages/typescript/detectors/security/file_checks.py (lines 50-87)
Both need to identify public routes but use different regex patterns/logic
Action Plan:
Create new module: desloppify/languages/base/security_patterns.py
Extract shared function signature:
python
def is_public_route(content: str) -> bool:
"""Check if content has public route annotation/decorator.
Looks for: allow_anonymous, allowanonymous, permit_all,
public_route, public_endpoint, @public patterns.
"""
Problem:LangRunOverrides uses a module-level sentinel object _UNSET to represent "not specified" tri-state for nullable fields. The sentinel is checked against using identity (is _UNSET), which is hidden/implicit.
Concrete Solution: Use a TypedDict + Literal union for explicit tri-state modeling
Step-by-step changes:
Replace the sentinel pattern with Literal types:
Line 19: Delete _UNSET = object()
Line 40-53: Change LangRunOverrides dataclass to use NotRequired (TypedDict style) or add an explicit set field
Recommended approach: Convert LangRunOverrides from a dataclass to a TypedDict with NotRequired fields and add a "__unset__" literal to distinguish "not provided" from None.
python
# OLD (dataclass with sentinel):
@dataclass
class LangRunOverrides:
zone_map: FileZoneMap | None = _UNSET
# NEW (TypedDict with NotRequired):
class LangRunOverridesDict(TypedDict, total=False):
zone_map: FileZoneMap | None
dep_graph: dict[str, dict[str, Any]] | None
# ... etc
# But since you need to check "was this field explicitly set?", better approach:
# Use a helper class that wraps a dict and tracks which keys were set:
@dataclass
class LangRunOverrides:
zone_map: FileZoneMap | None | Literal["__unset__"] = "__unset__"
dep_graph: dict[str, dict[str, Any]] | None | Literal["__unset__"] = "__unset__"
# ... etc (replace all _UNSET with "__unset__")
Assistant
Excellent! Now I have enough information. Let me compile the action plans. Let me create a comprehensive summary:
CONCRETE ACTION PLANS FOR CODE CLEANUP
Based on my analysis of the source files, here are the exact step-by-step cleanup plans for each item:
ITEM 14: duplicated_enrich_confirmation_flow
What's the problem:
confirm_enrich() and confirm_sense_check() in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/confirmations/enrich.py (lines 129-305) are nearly identical
Both call _collect_enrich_level_confirmation_checks() (lines 45-126) with identical signatures
They share identical rendering logic for failures/warnings but display them differently
The shared renderer is the report object: _ConfirmationCheckReport dataclass (lines 27-42) with .failure() and .warning() methods
What differs:
Stage name/labels (line 147 vs 249)
Attestation context - enrich includes stale issue ref check (include_stale_issue_ref_warning=True line 144 vs False line 246)
Output verbosity - enrich prints full fix instructions; sense-check is terse (lines 156-197 vs 253-280)
The shared renderer is the dataclass: _ConfirmationCheckReport (lines 27-42)
Validation checkers live in: /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/validation/core.py and enrich_checks.py
ACTION PLAN:
Create new function _render_enrich_checks() that takes (checks: _ConfirmationCheckReport, stage: str, repo_root: Path, attestation_callback: Callable) and returns a tuple of (render_ok, error_message)
Assistant
Excellent. Now I have enough information to write comprehensive action plans. Let me compile the report:
explode_to_single_dimension() (26 lines) lives in desloppify/app/commands/review/prompt_sections.py but is imported by:
orchestrator.py line 31
execution_phases.py line 19
external.py
prompt_template.py
test_review_batch_execution_phases_direct.py
What Moves:
Move _load_or_prepare_packet(), _build_prepared_packet_contract(), _try_load_prepared_packet() and helpers from orchestrator.py → packet/build.py
User
I need to understand how wontfix issues are presented to the LLM reviewer during a holistic review. Specifically:
Search for where holistic review prompts are built — look for functions that build/prepare review packets or prompts, especially in desloppify/intelligence/review/ and desloppify/app/commands/review/
Find where issue status (open, wontfix, fixed, etc.) is included in review context
Find where wontfix notes/attestations are included or excluded from review prompts
Check if the reviewer sees the wontfix reason/note when re-assessing a dimension
Key questions to answer:
Does the reviewer see wontfixed issues at all?
If yes, does it see the wontfix reason/note?
Does the reviewer know it should treat wontfix differently from open?
Is there any prompt text that tells the reviewer how to handle wontfix items?
Search thoroughly in the review context builders, prompt templates, and holistic review preparation code.
Assistant
I'll search for how wontfix issues are presented to the LLM reviewer during holistic review. Let me start by exploring the review and intelligence packages.
Assistant
Let me search for key files that build review prompts and context:
Assistant
Let me check the selection.py file where wontfix was found, and also look at issue history and payload building:
Assistant
Now let me search for where issue status is checked when building prompts, and look at the batch templates:
Assistant
Let me look at the prompt_sections file to see what context is rendered:
Assistant
Perfect! I found the key location. Now let me search for more context on how issues are filtered or displayed in the holistic context preparation, and look at what the context_builder does with issues:
Assistant
Let me now look specifically at how issues are passed into the holistic context and what happens to wontfix issues in the holistic context building:
Assistant
Now let me check the mechanical evidence gathering to see if it includes wontfix issues:
Assistant
Perfect! I can see the critical issue on line 69: if issue.get("status") != "open":. Let me now check what happens with the historical issue context to understand how issues are presented:
Assistant
Excellent! Now let me also verify if there's any filtering of wontfix in the review context builder and check the _prepare/helpers.py for any additional context:
Assistant
Now let me verify the context_builder.py again for the existing_issues section to see the complete picture:
Assistant
Let me also check the test files to understand the wontfix behavior better:
Assistant
Perfect! Now let me check what the render_historical_focus function actually shows to verify how it displays wontfix status:
Assistant
Perfect! Now let me create a comprehensive summary document with all the findings. Let me check one more thing - how the holistic context gets serialized into the payload:
Assistant
Now let me check the context.py to see the serialization:
Assistant
Let me see the serialization function:
Assistant
Let me get the full serialize function:
Assistant
Perfect! Now I have enough information. Let me create a comprehensive summary of my findings:
Summary: How Wontfix Issues Are Presented to the LLM Reviewer During Holistic Review
I've thoroughly searched the codebase and found clear answers to all four key questions. Here's what I discovered:
1. Does the reviewer see wontfixed issues at all?
YES, but with significant filtering:
In mechanical holistic context: Wontfix issues are COMPLETELY EXCLUDED. In desloppify/intelligence/review/context_holistic/mechanical.py:69, there's a hard filter:
python
if issue.get("status") != "open":
continue
This means wontfix issues never appear in the scan_evidence sections (complexity_hotspots, error_hotspots, boundary_violations, etc.).
In per-file existing issues context: Wontfix issues are COMPLETELY EXCLUDED. In desloppify/intelligence/review/context_builder.py:103, the same filter applies:
python
if issue.get("status") != "open":
continue
This populates the existing_issues dict shown to reviewers.
In historical issue context: Wontfix issues ARE INCLUDED. They appear in the historical review issues list built by desloppify/intelligence/review/_prepare/issue_history.py:116-175, specifically in build_issue_history_context(). This includes issues with status "open", "fixed", "wontfix", "auto_resolved", etc.
2. If yes, does it see the wontfix reason/note?
YES, for historical issues only. The wontfix note is preserved and displayed:
In _shape_issue() (line 100-113 of issue_history.py), the note is extracted via _meaningful_note()
In render_historical_focus() (line 95-134 of prompt_sections.py), each historical issue is rendered as:
code
- [status] summary (note: reason_if_present)
For example, a wontfix issue in the historical section would appear as:
code
Major architectural refactoring tracks with documented objectives:
triage-stage-flow-consolidation: Consolidate staged triage command flow (7 related findings)
base-contract-and-name-honesty: Align public contracts and helper names (6 related findings)
language-and-command-surface-unification: Unify language command location (6 related findings)
runtime-global-state-boundaries: Replace process-global registration (4 related findings)
auth-and-plugin-error-signals: Align error classification (4 related findings)
treesitter-canonicalization: Complete tree-sitter migration (4 related findings)
And 35+ additional strategic work streams with 0 issues (foundational/phase-gating work)
Related Files
/Users/user_c042661f/Documents/desloppify/.desloppify/query.json (55 KB) - Current output from next command with item details
There are no TODO.md, TASKS.md, PLAN.md, or similar markdown files in the project root or docs directories. The entire task management system is implemented via the JSON plan format in .desloppify/plan.json.
In _file_level_security_issues() where you want to add public-route awareness, call is_public_route(content)
Item 11: triage_validation_core_cycle
Current State:
Cycle exists: core.py (line 31) imports from completion_stages.py, but completion_stages.py (line 47) imports _auto_confirm_stage from core.py inside a function
Function: resolve_workflow_patterns() in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/override_resolve_workflow.py (lines 115-299)
Problem: Mixes pure evaluator logic with CLI output formatting and side effects
Returns: WorkflowResolveOutcome (lines 39-42) dataclass with status and remaining_patterns
Action Plan - SEPARATE PURE LOGIC FROM CLI:
Create new module: desloppify/app/commands/plan/override_workflow_policy.py (pure evaluator)
Move to new module:
python
@dataclass(frozen=True)
class WorkflowBlockReason:
"""Pure evaluation result: why a workflow ID is blocked."""
synthetic_id: str
reason: str # "triage_incomplete" | "scan_not_run" | "stage_dependency"
blocking_deps: list[str] = field(default_factory=list)
@dataclass(frozen=True)
class WorkflowResolutionDecision:
"""Pure evaluator output: what to do with workflow patterns."""
can_proceed: bool
blocked_reasons: list[WorkflowBlockReason] # empty if can_proceed=True
remaining_patterns: list[str]
def evaluate_workflow_resolution(
plan: dict,
args: argparse.Namespace,
synthetic_ids: list[str],
real_patterns: list[str],
) -> WorkflowResolutionDecision:
"""Pure logic: determine what blocks each workflow ID, return decision."""
# Move lines 126-203 logic here (all the actual evaluation)
# Return WorkflowResolutionDecision with reasons
In override_resolve_workflow.py, refactor resolve_workflow_patterns():
python
def resolve_workflow_patterns(
args: argparse.Namespace,
*,
synthetic_ids: list[str],
real_patterns: list[str],
note: str | None,
) -> WorkflowResolveOutcome:
"""CLI wrapper: call evaluator, print messages, execute side effects."""
decision = evaluate_workflow_resolution(plan, args, synthetic_ids, real_patterns)
# Print blocking reasons based on decision.blocked_reasons
for reason in decision.blocked_reasons:
if reason.reason == "triage_incomplete":
_print_stage_runner_guidance(...)
_print_stage_coaching(...)
elif reason.reason == "scan_not_run":
print(colorize("...scan requirement message...", "red"))
# etc.
if not decision.can_proceed and not force:
return WorkflowResolveOutcome(status="blocked", remaining_patterns=[])
# Continue with actual resolution (purge_ids, auto_complete_steps, etc.)
...
Update imports in override_resolve_cmd.py:
Keep existing import of resolve_workflow_patterns
No change needed (CLI layer remains the same)
Item 13: legacy_epics_contract_still_live
Current State:
Field to rename: existing_epics → existing_clusters (legacy name → current name)
Defined in /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/triage/prompt.py (line 23): existing_epics: dict[str, Cluster]
Already HAS a property alias (lines 32-35): existing_clusters property that returns self.existing_epics
Used in collect_triage_input() (line 139): returns dict(epics) in TriageInput(existing_epics=...)
Referenced in build_triage_prompt() (line 219): iterates si.existing_epics
Real usage: Low-level prompt building in engine/_plan/triage/prompt.py; apps layer uses TriageInput via engine/plan_triage.py facade
Action Plan - GRADUAL RENAME WITH COMPAT:
In /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/triage/prompt.py:
Keep the property alias (lines 32-35) as forward compat for 2 cycles
Add a deprecation note in the alias docstring:
python
@property
def existing_clusters(self) -> dict[str, Cluster]:
"""Canonical alias for ``existing_epics`` used by staged triage docs.
DEPRECATED: existing_epics field will be renamed to existing_clusters in v0.10.0.
Use existing_clusters property (or direct attribute access) instead.
"""
return self.existing_epics
Rename the actual field:
python
@dataclass
class TriageInput:
"""All data needed to produce/update triage clusters (legacy schema)."""
open_issues: dict[str, dict]
mechanical_issues: dict[str, dict]
existing_clusters: dict[str, Cluster] # RENAMED from existing_epics
# ... rest unchanged
Update collect_triage_input() (line 136-147):
Change line 139: existing_clusters=dict(epics), (already correct, just use new name)
Update build_triage_prompt() (lines 214-231):
Change line 219: if si.existing_clusters: (use property)
Change line 221: for name, epic in sorted(si.existing_clusters.items()):
Data migration code in engine/plan_state.py (if it exists):
Add a compat function to handle old .desloppify/state-*.json files that might have the old field name
No action needed if no persistence of TriageInput itself (it's compute-time only)
Update all import paths in app layer (app/commands/plan/triage/services.py, etc.):
No changes needed—they import TriageInput from engine.plan_triage and use the property/field transparently
Boundary: The rename is internal to the triage module. The app layer continues to work via TriageInput dataclass and the property alias, so NO breaking changes for callers.
Change the sentinel check: if value == "__unset__": continue
This makes the tri-state explicit in the type annotations
Update _apply_lang_overrides() (line 162-171):
Line 166: Change if value is _UNSET: → if value == "__unset__":
Update imports:
Remove any Literal imports if not present
Add Literal to the type imports at the top of the file
Why this works: The sentinel becomes a named, typed constant ("__unset__" string literal), making it searchable and explicit. Type checkers understand Literal["__unset__"] better than a mystery _UNSET object.
Problem: Throughout plan_reconcile.py, plan is passed around as dict[str, object], which masks the actual TypedDict shape. Callers and maintainers don't know what keys are expected.
Concrete Solution: Use the canonical PlanModel TypedDict
Step-by-step changes:
Add import at the top (after line 6):
python
from desloppify.engine._plan.schema import PlanModel
Replace all dict[str, object] signatures with PlanModel:
Problem:load_policy() (lines 18-29) silently swallows errors. If the JSON file is corrupted or the directory is inaccessible, it returns {"rules": []} instead of signaling an error. Callers can't distinguish "file doesn't exist" from "file is corrupted."
Concrete Solution: Raise CommandError on corruption; let missing file be silent
Step-by-step changes:
Add import at the top (after line 7):
python
from desloppify.base.exception_sets import CommandError
Rewrite load_policy() function (lines 18-29):
python
def load_policy(path: Path | None = None) -> dict[str, Any]:
p = path or _default_policy_path()
if not p.exists():
return {"rules": []}
try:
data = json.loads(p.read_text())
except json.JSONDecodeError as e:
raise CommandError(
f"Project policy file is corrupted ({p}): {e}",
exit_code=1,
)
except UnicodeDecodeError as e:
raise CommandError(
f"Project policy file has encoding errors ({p}): {e}",
exit_code=1,
)
except OSError as e:
raise CommandError(
f"Cannot read project policy file ({p}): {e}",
exit_code=1,
)
if not isinstance(data, dict):
raise CommandError(
f"Project policy must be a JSON object, got {type(data).__name__}",
exit_code=1,
)
data.setdefault("rules", [])
return data
Update all callers:
Files that call load_policy():
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/policy_cmd.py (lines 33, 40, 62): Wrap calls in try/except to catch CommandError if needed, OR let it propagate (preferred).
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/runner/orchestrator_codex_sense.py: Check if error handling is needed.
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/external.py: Wrap in try/except if user-facing.
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/batch/orchestrator.py: Wrap in try/except if user-facing.
Specific caller updates:
policy_cmd.py (lines 33, 40, 62): No change needed if CommandError is acceptable. If you want graceful degradation:
python
# Example: _cmd_policy_add
def _cmd_policy_add(args: argparse.Namespace) -> None:
text = getattr(args, "rule_text", "")
if not text or not text.strip():
print(colorize(" Rule text is required.", "red"))
return
try:
policy = load_policy()
except CommandError as e:
print(colorize(f" {e.message}", "red"))
return
# ... rest of function
orchestrator_codex_sense.py: Search for usage and decide if it's acceptable to let CommandError propagate (preferred for CLI errors).
Why this works:
Missing files are OK (silent default)
Corruption is caught early and reported with context
Callers can decide whether to handle or propagate the error
User sees a clear error message, not silent degradation
ITEM 20: duplicate_update_skill_facade
Files:
Source of truth: /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/update_skill/cmd.py
Problem: Mixed conventions. Some commands are flat modules (e.g., config.py), others are packages (e.g., autofix/cmd.py). This inconsistency makes it hard to know where to add new code.
Concrete Solution: Standardize on package + cmd.py pattern
Step-by-step changes:
Option A (RECOMMENDED): Migrate flat modules to packages
For each flat module (config.py, detect.py, dev.py, exclude.py, suppress.py, viz.py, zone.py):
"""config command package."""
from __future__ import annotations
from desloppify.app.commands.config.cmd import cmd_config
__all__ = ["cmd_config"]
d. Update registry.py (line 14):
python
# OLD: from desloppify.app.commands.config import cmd_config
# NEW: from desloppify.app.commands.config.cmd import cmd_config
Repeat for all 7 flat modules:
detect → detect/cmd.py
dev → dev/cmd.py
exclude → exclude/cmd.py
suppress → suppress/cmd.py
viz → viz/cmd.py (move cmd_tree, cmd_viz)
zone → zone/cmd.py
Update registry.py imports (lines 14-30):
python
from desloppify.app.commands.config.cmd import cmd_config
from desloppify.app.commands.detect.cmd import cmd_detect
from desloppify.app.commands.dev.cmd import cmd_dev
from desloppify.app.commands.exclude.cmd import cmd_exclude
from desloppify.app.commands.autofix.cmd import cmd_autofix
from desloppify.app.commands.langs.cmd import cmd_langs
from desloppify.app.commands.move.cmd import cmd_move
from desloppify.app.commands.next.cmd import cmd_next
from desloppify.app.commands.plan.cmd import cmd_plan
from desloppify.app.commands.suppress.cmd import cmd_suppress
from desloppify.app.commands.review.cmd import cmd_review
from desloppify.app.commands.scan.cmd import cmd_scan
from desloppify.app.commands.show.cmd import cmd_show
from desloppify.app.commands.status.cmd import cmd_status
from desloppify.app.commands.update_skill.cmd import cmd_update_skill
from desloppify.app.commands.viz.cmd import cmd_tree, cmd_viz
from desloppify.app.commands.zone.cmd import cmd_zone
ALL have an __init__.py for re-exports (optional but recommended)
Registry imports all from .cmd submodules
Result: Consistent, discoverable structure. New developers know to add code to <command>/cmd.py or create helper modules in the package.
SUMMARY TABLE
Item
File(s)
Change Type
Specific Action
1
runtime.py
Type Model
Replace _UNSET sentinel with Literal["__unset__"]; update checks in _coerce_lang_override() and _apply_lang_overrides()
6
plan_reconcile.py
Type Annotation
Import PlanModel; replace all dict[str, object] parameters with PlanModel
9
project.py
Error Handling
Add CommandError import; rewrite load_policy() to raise on JSON/encoding errors instead of silencing them
20
update_skill/__init__.py + cmd.py
Deduplication
Delete all re-exports from __init__.py; make it minimal (just import + __all__); keep cmd.py as source of truth
21
registry.py
Standardization
Convert 7 flat command modules to packages with cmd.py submodules; update registry imports; all commands follow <command>/cmd.py pattern
(bool, str)
Move the inline rendering logic from both functions into _render_enrich_checks() — use stage in ("enrich", "sense-check") to vary output verbosity
Extract MinConfirmationAttestationRequest dataclass with stage, command_hint, validation_kwargs, etc. from both functions
Refactor both functions to: call _collect_enrich_level_confirmation_checks() once → call _render_enrich_checks() → call finalize_stage_confirmation() with the shared request
Lines to refactor: confirm_enrich() lines 142-223 and confirm_sense_check() lines 244-301
ITEM 15: triage_readiness_rules_fragmented
What's the problem:
Validation is split across 3 locations with overlapping rules:
Helpers imported from: /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/validation/core.py (the _underspecified_steps, _steps_with_bad_paths, etc. functions)
ACTION PLAN:
In /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/runner/stage_validation.py, the run_enrich_quality_checks() function (lines 40-123) is already the canonical evaluator — keep it as-is
In stage_flow_enrich.py lines 127-196, replace all inline checks with:
python
failures = run_enrich_quality_checks(plan, repo_root, phase_label="enrich")
if failures:
for f in failures:
print(colorize(f.message, color_based_on_code(f.code)))
return
Import: from ..runner.stage_validation import run_enrich_quality_checks
In stage_flow_sense_check.py lines 78-107, replace inline checks with:
python
failures = run_enrich_quality_checks(plan, repo_root, phase_label="sense-check")
if failures:
problem_strs = [f.message for f in failures]
problems.extend(problem_strs)
Delete duplicate validation functions from validation/enrich_checks.py if they're not used elsewhere (but verify imports first)
Update line 344: validate_and_confirm_stage_impl(...)
Delete lines 246-248 (_build_completion_strategy)
Update line 392: build_completion_strategy_impl(stages_data)
Delete lines 251-266 (_complete_pipeline)
Update line 422: complete_pipeline_impl(...)
Imports to add:
All _impl functions should be imported at the top from their respective modules.
ITEM 18: treesitter_dual_namespace_surface
Root-level bridge files (compat shims):
code
/Users/user_c042661f/Documents/desloppify/desloppify/languages/_framework/treesitter/
├── _normalize.py → imports from treesitter.imports.normalize
├── _specs.py → imports from treesitter.specs.specs
├── _extractors.py → imports from treesitter.analysis.extractors
├── _import_cache.py → imports from treesitter.imports.cache
├── _import_graph.py → imports from treesitter.imports.graph
├── _import_resolvers_backend.py → imports from treesitter.imports.resolvers_backend
├── _import_resolvers_functional.py → imports from treesitter.imports.resolvers_functional
├── _import_resolvers_scripts.py → imports from treesitter.imports.resolvers_scripts
├── _complexity_callbacks.py → imports from treesitter.analysis.complexity_callbacks
├── _complexity_function_metrics.py → imports from treesitter.analysis.complexity_function_metrics
├── _complexity_nesting.py → imports from treesitter.analysis.complexity_nesting
├── _complexity_shared.py → imports from treesitter.analysis.complexity_shared
├── _smells.py → imports from treesitter.analysis.smells
├── _specs_compiled.py → imports from treesitter.specs.specs_compiled
├── _specs_compiled_native.py → imports from treesitter.specs.specs_compiled_native
├── _specs_functional.py → imports from treesitter.specs.specs_functional
├── _specs_scripting.py → imports from treesitter.specs.specs_scripting
└── _unused_imports.py → imports from treesitter.analysis.unused_imports
All use the same pattern:
python
from importlib import import_module
_IMPL = import_module("desloppify.languages._framework.treesitter.{real.path}")
_EXPORTS = [name for name in dir(_IMPL) if not name.startswith("__")]
globals().update({name: getattr(_IMPL, name) for name in _EXPORTS})
/Users/user_c042661f/Documents/desloppify/desloppify/tests/lang/common/test_treesitter.py — imports from _extractors, _specs_compiled
/Users/user_c042661f/Documents/desloppify/desloppify/tests/lang/common/test_framework_registration_and_commands_split_direct.py — imports _specs as treesitter_specs_legacy_mod
ACTION PLAN (delete bridges, update imports in reverse dependency order):
Phase 1: Update test file imports
In test_treesitter_complexity_and_integration.py, replace all occurrences of:
from desloppify.languages._framework.treesitter._extractors import → from desloppify.languages._framework.treesitter.analysis.extractors import
from desloppify.languages._framework.treesitter._specs_compiled import → from desloppify.languages._framework.treesitter.specs.specs_compiled import
from desloppify.languages._framework.treesitter._specs_functional import → from desloppify.languages._framework.treesitter.specs.specs_functional import
from desloppify.languages._framework.treesitter._specs_scripting import → from desloppify.languages._framework.treesitter.specs.specs_scripting import
from desloppify.languages._framework.treesitter._complexity_nesting import → from desloppify.languages._framework.treesitter.analysis.complexity_nesting import
from desloppify.languages._framework.treesitter._complexity_function_metrics import → from desloppify.languages._framework.treesitter.analysis.complexity_function_metrics import
from desloppify.languages._framework.treesitter._smells import → from desloppify.languages._framework.treesitter.analysis.smells import
from desloppify.languages._framework.treesitter._unused_imports import → from desloppify.languages._framework.treesitter.analysis.unused_imports import
In test_treesitter.py, replace:
from desloppify.languages._framework.treesitter._extractors import → from desloppify.languages._framework.treesitter.analysis.extractors import
from desloppify.languages._framework.treesitter._specs_compiled import → from desloppify.languages._framework.treesitter.specs.specs_compiled import
In test_framework_registration_and_commands_split_direct.py, line 28:
import desloppify.languages._framework.treesitter._specs as treesitter_specs_legacy_mod → import desloppify.languages._framework.treesitter.specs.specs as treesitter_specs_legacy_mod
Update variable name if test logic relies on it: treesitter_specs_legacy_mod → treesitter_specs_mod (verify test assertions)
Phase 2: Delete bridge files
Delete these 19 files (after Phase 1 is complete and tests pass):
New module: desloppify/app/commands/review/batch/orchestration/__init__.py
python
"""Batch orchestration facades for live and re-import runs."""
from .import_run import do_import_run, validate_run_dir
from .live_run import do_run_batches
__all__ = [
"do_import_run",
"do_run_batches",
"validate_run_dir",
]
result = normalize_batch_result(payload, dims, max_batch_issues=..., abstraction_sub_axes=...)
assessments, issues, notes, judgment, quality = result
To:
python
result = normalize_batch_result(payload, dims, max_batch_issues=..., abstraction_sub_axes=...)
assessments = result.assessments
issues = result.issues
# ... etc or use result directly
Step-by-Step:
In core_models.py (append to end before __all__):
python
@dataclass(frozen=True)
class NormalizedBatchPayload:
"""Result of normalizing a single batch payload."""
assessments: dict[str, float]
issues: list[BatchIssuePayload]
dimension_notes: dict[str, BatchDimensionNotePayload]
dimension_judgment: dict[str, BatchDimensionJudgmentPayload]
quality: BatchQualityPayload
In core_normalize.py:
Add import: from .core_models import NormalizedBatchPayload
Extract assessments validation loop into new helper:
When either of those files imports from intelligence.review.dimensions.metadata, global provider state gets wired up as a side-effect.
This is implicit, order-dependent, and pollutes the module namespace with initialization logic.
Solution:
Move the bootstrap call to a single canonical location that is explicitly invoked by the CLI entry point, NOT by quiet imports.
Action Plan:
Create desloppify/base/subjective_dimensions_bootstrap.py (new file):
python
"""Bootstrap entrypoint for subjective dimension providers.
Call once at CLI startup to wire up dimension metadata loaders.
"""
from __future__ import annotations
from desloppify.base.subjective_dimensions import (
configure_subjective_dimension_providers,
)
from desloppify.intelligence.review.dimensions.data import (
load_dimensions as _default_load_dimensions,
)
from desloppify.intelligence.review.dimensions.data import (
load_dimensions_for_lang as _default_load_dimensions_for_lang,
)
from desloppify.languages import available_langs as _available_langs
def bootstrap_subjective_dimensions() -> None:
"""Configure subjective dimension providers at CLI startup."""
def _available_languages() -> list[str]:
try:
return list(_available_langs())
except (ImportError, ValueError, TypeError, RuntimeError):
return []
def _load_dimensions_payload():
return _default_load_dimensions()
def _load_dimensions_payload_for_lang(lang_name: str):
return _default_load_dimensions_for_lang(lang_name)
configure_subjective_dimension_providers(
available_languages_provider=_available_languages,
load_dimensions_payload_provider=_load_dimensions_payload,
load_dimensions_payload_for_lang_provider=_load_dimensions_payload_for_lang,
)
__all__ = ["bootstrap_subjective_dimensions"]
Remove the bootstrap call from /Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/dimensions/metadata.py:
Delete lines 54-58 (the configure_subjective_dimension_providers(...) call)
Keep all the imports and re-exports
File becomes purely a compatibility shim (no side effects)
Add bootstrap call to CLI entry point (desloppify/cli.py):
At the very start of main() function, after argparse setup but before command dispatch:
python
from desloppify.base.subjective_dimensions_bootstrap import (
bootstrap_subjective_dimensions,
)
def main():
# ... setup ...
bootstrap_subjective_dimensions() # ← Wire up metadata providers once
# ... command dispatch ...
Document in code:
Add docstring to desloppify/intelligence/review/dimensions/metadata.py:
python
"""Compatibility layer for subjective-dimension metadata helpers.
Historically this module maintained its own metadata-building logic. The
canonical implementation now lives in ``desloppify.base.subjective_dimensions``.
Keep this module as a stable import surface for existing callers.
NOTE: Provider wiring (configure_subjective_dimension_providers) happens
at CLI startup via bootstrap_subjective_dimensions() in base.subjective_dimensions_bootstrap.
"""
3. Does the reviewer know it should treat wontfix differently from open?
YES, explicitly told via prompt guidance (lines 115-121 of prompt_sections.py):
code
Previously flagged issues — navigation aid, not scoring evidence:
Check whether each issue still exists in the current code. Do not re-report
issues that have been fixed or marked wontfix — focus on what remains or
what is new. If several past issues share a root cause, call that out.
This guidance is explicit in the batch prompt that:
Previously flagged issues are "navigation aid, not scoring evidence"
Wontfix issues should NOT be re-reported
The reviewer should focus on what remains or what is new
4. Is there any prompt text that tells the reviewer how to handle wontfix items?
YES. The key guidance is in render_historical_focus() output which:
Lists all historical review issues with their status visible: [open], [fixed], [wontfix], etc.
Includes the wontfix reason/note if one exists
Instructs the reviewer not to re-report wontfix items
Tells the reviewer to focus on NEW issues or issues where the wontfix has become invalid
Key Architecture Insight
The design implements a two-tier approach:
Mechanical evidence (scan_evidence): Strictly filtered to OPEN issues only. Wontfix doesn't appear in hotspots, signal density, or other mechanical clusters.
Historical context: Includes ALL resolution statuses (open/fixed/wontfix/auto_resolved) with explicit instructions that wontfix should not be re-reported.
This creates an asymmetry: the reviewer sees wontfix historical issues as reference context but is explicitly told to treat them differently from open issues. The mechanical evidence never includes wontfix, ensuring the analysis is fresh and focuses on current open problems.
Files containing this logic:
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/context_holistic/mechanical.py - Filters to open only (line 69)
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/context_builder.py - Filters to open only (line 103)
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/_prepare/issue_history.py - Includes all statuses with note extraction (lines 100-113, 116-175)
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/prompt_sections.py - Renders historical context with status and note (lines 95-134)
/Users/user_c042661f/Documents/desloppify/desloppify/tests/review/context/test_issue_history_context.py - Tests showing wontfix with notes (lines 70-111)