Find how the structural detector assigns confidence levels to its findings. Search for the structural detector implementation — it likely checks file size (LOC) and assigns confidence based on thresholds. Check files in desloppify/languages/ and desloppify/engine/detectors/ or similar paths. I need to understand: what makes a structural finding "high" confidence vs "medium" or "low"?
Assistant
I'll help you find how the structural detector assigns confidence levels. Let me search for the structural detector implementation across the codebase.
Assistant
Let me examine the key structural detector implementation files:
Assistant
Perfect! Now let me also check the make_issue function to understand the complete picture:
Assistant
Excellent! Now I have a complete picture. Let me search for any tests that demonstrate this confidence assignment to provide additional context:
Assistant
Let me check the test file to see concrete examples:
Assistant
Perfect! Now I have all the information needed. Let me create a summary of my findings:
Summary: How the structural Detector Assigns Confidence Levels
The structural detector assigns confidence levels based on the number of signals (complexity issues) detected in a file. Here's exactly how it works:
Confidence Assignment Logic
Located in /Users/user_c042661f/Documents/desloppify/desloppify/languages/_framework/base/structural.py (lines 59-61):
3+ signals → HIGH confidence (Tier 4) — "needs decomposition"
1-2 signals → MEDIUM confidence (Tier 3) — "needs refactoring"
What Counts as a Signal?
Signals are accumulated from multiple detectors via the add_structural_signal() function. The structural phase combines:
Large files — from detect_large_files() (LOC exceeds language threshold, typically 100+ lines)
Complexity issues — from detect_complexity(), which evaluates:
TODOs/FIXMEs (weight 2)
Nesting depth > 4 (weight 3)
Long functions > 80 LOC (weight 3)
Cyclomatic complexity > 15 (weight 2)
Functions with > 7 parameters (weight 2)
Callback nesting depth > 3 (weight 2)
God classes — from detect_gods() (classes with 15+ methods, 500+ LOC, or 10+ attributes)
Additional Filter: Complexity-Only Suppression
Files with only complexity signals (no "large" or "god" signals) have a secondary threshold: they're suppressed if their complexity_score < 50 (line 55). This prevents flagging normal small files with minor complexity issues.
Full Workflow
The merge_structural_signals() function (lines 25-80 in /Users/user_c042661f/Documents/desloppify/desloppify/languages/_framework/base/structural.py) orchestrates this:
Collects all signals per file
Suppresses complexity-only files below threshold
Assigns tier/confidence based on signal count
Creates a single "Large file" issue with summary like: "Large file: large (200 LOC) / complexity score 21 / god class (500 LOC)"
Example
A file with large size + complexity issue + god class methods = 3 signals = HIGH confidence, Tier 4
A file with just complexity issue = 1 signal = MEDIUM confidence, Tier 3 (unless suppressed if score < 50)
User
I need to understand how the holistic review process works end-to-end, specifically:
How does the review prompt get built? Look at desloppify/intelligence/review/context_holistic/orchestrator.py and trace how mechanical evidence gets formatted into the prompt the reviewer LLM sees.
What tools/capabilities does the reviewer LLM currently have access to? Check the review prompt construction — does it get tool_use, function calling, or just a text prompt? Look for any tool definitions passed to the LLM during review.
How does gather_mechanical_evidence() format its output for the reviewer? I already know it produces dict clusters — but how are those presented in the actual prompt text?
How are review results imported back? Look at desloppify/intelligence/review/importing/ — specifically how concern_verdict works and how confirmed/dismissed concerns flow back into state.
Focus on the presentation layer — what does the reviewer actually see and what can it do?
Assistant
I'll trace the holistic review process end-to-end, focusing on the presentation layer and reviewer capabilities. Let me start with the orchestrator and prompt construction.
Assistant
Now let me read the orchestrator to understand the flow:
User
I need to understand the existing suppression and wontfix mechanisms in the desloppify codebase:
How does issue suppression work? Search for suppressed, suppress, wontfix, won't fix, dismiss across the codebase. What mechanisms exist for permanently marking an issue as not-a-problem?
Look at state["issues"] — what fields control whether an issue is shown/hidden? Is there a suppressed flag? A status of wontfix?
How does stale_wontfix detector work? This seems related.
Are there any existing "dismiss" flows in the review process? I saw dismissed_concerns in the holistic issue flow — how does that work? Does it persist dismissals?
Check if there's any fingerprinting/dedup that prevents dismissed issues from recurring on re-scan.
Focus on: what already exists for "mark this as not-a-problem permanently" and what gaps exist.
Assistant
Now let me look for where the LLM prompt is actually constructed and what tools are passed:
Assistant
Let me look at the prompt sections and template:
Assistant
I'll conduct a comprehensive search of the desloppify codebase to understand the suppression and wontfix mechanisms. Let me start with broad searches across the codebase.
Assistant
Now let me find where the actual LLM call happens and check for tool definitions:
Assistant
Now let me read the key files to understand the suppression mechanisms:
User
I need to understand the structure of judgment-required findings and how they could be presented as an explorable checklist:
Look at the _build_* functions in desloppify/intelligence/review/context_holistic/_clusters_*.py — what structure do they produce? How granular is the data? Is it per-file, per-finding, or aggregated?
Check a few specific detector outputs in state to understand what a typical finding looks like:
structural findings (detail dict structure)
smells findings (detail dict, smell_id)
coupling findings
naming findings
Look at desloppify/engine/_state/filtering.py for make_issue — what's the canonical issue shape?
Check desloppify show <detector> command — is there already a way to view findings by detector? Look in desloppify/app/commands/ for a show command.
Check if there's a desloppify backlog command and what it shows.
I want to understand: if we wanted to present individual findings as a checklist for the reviewer to investigate one-by-one, is the data granular enough? What would we need to add?
Assistant
Let me search more broadly for the actual LLM invocation:
Assistant
Let me use correct absolute paths:
Assistant
I'll systematically explore the structure of judgment-required findings, detector outputs, and existing viewing commands. Let me start with parallel searches.
Assistant
Let me look for where the orchestrator calls the LLM:
Assistant
Let me check the actual directory structure:
Assistant
Now let me read the cluster files and filtering code to understand the data structures:
Assistant
Let me search for the actual external LLM call point:
Assistant
Now let me search for the files more carefully:
Assistant
Now let me look at the Issue schema to understand the full structure:
Assistant
Good! Now let me read these files:
Assistant
Let me look for how concerns are formed and validated:
Assistant
Now let me search for more related code on statuses, issue states, and how dismissed/wontfix/suppressed issues are handled:
Assistant
Let me check the contracts to see what's being passed back:
Assistant
Let me read the Issue schema and check the next/resolve commands:
Assistant
Now let me look at how issues with suppressed flag are handled:
Assistant
Now let me check detector output examples and the cluster builders more comprehensively:
Assistant
Now let me check one of the cluster builders to see how evidence is formatted:
Assistant
Now let me look at the merge issues and filtering code:
Assistant
Now let me look for where the holistic context model is defined and how it appears in the final output/prompt:
Assistant
Now let me check the consistency and security clusters:
Assistant
Now let me check the holistic issue flow and dismissed concerns:
Assistant
Now let me check what commands are available and look at how issues are currently rendered:
Assistant
Let me find the models for HolisticContext:
Assistant
Let me read the holistic issue flow file:
Assistant
Great! Let me check the show and backlog commands:
Assistant
Let me check for how dismissed concerns persist and what fields they use:
Assistant
Now let me look for where the context and packet get serialized and sent to the LLM:
Assistant
Perfect! Now let me read these commands:
Assistant
Now let me look at concerns and how they relate to dismissals:
Assistant
Now let me check the payload.py to see what's being included in the show output:
Assistant
Let me check the concerns generators file for the full details:
Assistant
Let me look at the prepare_holistic_review function to see the full packet structure:
Assistant
Now let me look at an example state file to see the raw issue structure in practice:
Assistant
Let me read the schema types file to see ConcernDismissal definition:
Assistant
Let me read a sample of that state file to see actual finding structures:
Assistant
Let me read the review schema types file for ConcernDismissal definition:
Assistant
Let me continue reading prepare.py to find the holistic review function:
Assistant
Now let me search for how state filtering works with suppressed issues:
Assistant
Let me check if issues exist in the state:
Assistant
Excellent! Now let me look at scoring to see how suppressed issues are excluded:
Assistant
Now let me check the full prepare_holistic_review_payload function:
Assistant
I see—it uses "findings" not "issues". Let me check:
Assistant
Let me read the scoring detection file:
Assistant
Perfect. Now let me check the runner_packets to see how the holistic_context and batches are serialized into JSON sent to the LLM:
Assistant
Perfect! Now let me look at the state integration scoring to see _count_issues:
Assistant
Perfect! Now I have a comprehensive understanding. Let me search for information about tool_use in the batch execution to see if the LLM gets any tool definitions:
Assistant
Excellent! Now let me check what test files reveal about suppression behavior:
Assistant
Let me look at the external.py more carefully to see what the LLM actually receives:
Assistant
Let me check the tests to find a richer state file with more findings:
Assistant
Perfect! Now let me check what fingerprinting and dedup mechanisms exist:
Assistant
Let me look at the schema to see what fields findings/issues can have more comprehensively:
Assistant
Let me look at the concerns utils file:
Assistant
Excellent! Now let me look at review context for more detail on how judgment findings are structured:
Assistant
Now let me check what review-related detectors generate:
Assistant
Perfect. Now let me get the actual list of judgment detectors:
Assistant
Let me check the registry file directly:
Assistant
Let me check the catalog file:
Assistant
Let me get the names:
Assistant
Let me read the catalog entries file:
Assistant
Let me continue reading to see all judgment detectors:
Assistant
Let me get a better regex:
Assistant
Let me read more of the file directly:
Assistant
Good! Now I have enough information. Let me create a comprehensive report. Let me also check how execution queue items work:
Assistant
Perfect! Now I have all the information I need. Let me compile my findings into a comprehensive report.
Based on my thorough end-to-end tracing of the holistic review process, here's what I found:
1. Review Prompt Construction
The review prompt gets built through a multi-stage serialization pipeline:
Stage 1: Holistic Context Building (desloppify/intelligence/review/context_holistic/orchestrator.py)
build_holistic_context_model() orchestrates gathering of codebase-wide context
What it is: A manual resolution status marking an issue as "we've decided not to fix this."
Status enum values (in base/enums.py):
OPEN = "open"
FIXED = "fixed"
Assistant
Perfect! Now I have a comprehensive understanding. Let me create a detailed summary report:
Finding Structure & Explorable Checklist Analysis
Based on my thorough exploration, here's what I found about judgment-required findings and how they could be presented as an explorable checklist:
1. Cluster Builders & Data Granularity
The _build_* functions in desloppify/intelligence/review/context_holistic/_clusters_*.py produce aggregated, file-level or pattern-level evidence clusters, NOT individual findings. Examples:
_build_complexity_hotspots() → Top 20 files with composite complexity scores (file-level, aggregated metrics)
_build_error_hotspots() → Files with 3+ exception handling issues, grouped by smell_id (file + aggregation)
Key insight: These clusters are detective summaries meant for holistic review context, not individual findings. They lose individual issue granularity by design.
The Issue TypedDict shows the canonical structure:
python
class Issue(TypedDict):
id: str # detector::file::name or detector::file
detector: str # "smells", "structural", "coupling", etc.
file: str # relative path
tier: int # 1-5 priority level
confidence: str # "high", "medium", "low"
summary: str # human-readable summary
detail: dict[str, Any] # Detector-specific payload
status: Status # "open", "fixed", "wontfix", etc.
note: str | None # User annotation
first_seen: str # ISO timestamp
last_seen: str # ISO timestamp
resolved_at: str | None # ISO timestamp
reopen_count: int
suppressed: bool # optional
zone: str # optional: production/test/config/vendor/etc
User
I need to understand how the triage/organize step provides tools to the LLM agent. Specifically:
Look at desloppify/app/commands/plan/triage/ — how does the triage orchestrator work? What tools does it give the LLM?
Search for tool definitions, function calling setup, or MCP tool configurations in the triage flow
How does the triage LLM investigate code? Can it read files, search, etc.?
Look at desloppify/app/commands/plan/triage/stages/organize.py — what happens in the organize stage?
Look for any tools= or tool_choice= or tool definition patterns in the triage/plan commands
How does the triage prompt tell the LLM what tools it has available?
I want to understand the pattern so we can replicate it for the review step — giving the reviewer LLM the ability to explore findings interactively rather than just getting a static context blob.
Assistant
I'll systematically explore the triage/organize flow to understand how it provides tools to the LLM agent. Let me start by examining the key files.
Assistant
Now let me read the key files to understand the orchestrator and tool patterns:
Assistant
Now let me look at the codex batch runner and prompt building to understand how tools are provided:
Assistant
Let me examine the stage prompts to see how tools are defined:
Assistant
Now let me check the instruction blocks to see how tools are described in the prompts:
Assistant
Let me check the instruction shared module to see the full pattern:
Assistant
Now let me search for how the review command uses tools and how it differs from triage:
Assistant
Let me search more specifically for how review prompts are built and look for any mention of interactive tools:
Assistant
Now let me search for how the external review works (with Claude Launch) to see if it uses tools:
Assistant
Now let me check the external.py file to see how Claude Launch (external) review works and whether it uses tools:
Assistant
Perfect! Now I have enough information. Let me search for any mention of MCP (Model Context Protocol) or tools in the codebase to understand the architecture better:
Assistant
Now let me create a comprehensive summary document for the user based on my findings:
Summary: Tool Pattern Analysis for Triage vs Review
Based on my thorough exploration of the codebase, here's how desloppify provides tools to LLM agents and why the current review approach is fundamentally different from triage:
How Tools Are "Provided" (from /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/triage/runner/stage_prompts_instruction_shared.py):
code
Use the desloppify CLI to record your work. Every command you run mutates plan.json directly.
The orchestrator will review your work and confirm the stage after you record it.
Use the exact CLI command prefix shown in the CLI Command Reference: `{cli_command}`.
Available commands embedded in prompt text:
desloppify plan cluster create <name>
desloppify plan cluster add <name>
desloppify plan cluster update <name> --add-step/--update-step
desloppify plan skip --permanent
desloppify plan triage --stage <name> --report "..."
Execution Model (codex_runner.py, orchestrator_codex_sense.py):
Agent runs commands directly; stdout becomes the output
Orchestrator parses stdout for validation
Two Prompt Modes:
self_record: Agent has CLI access; it runs commands and mutates plan.json
User
Design a plan for giving the holistic review subagent the ability to explore and adjudicate judgment-required detector findings during the review process.
Current State
The problem
Judgment-required findings (from 21 detectors like smells, structural, coupling, naming, etc.) are currently presented to the reviewer as aggregated evidence blobs — e.g., "4 files with complexity hotspots." The reviewer sees this as navigation context but has no structured way to:
See the individual findings
Investigate each one
Record a verdict (promote to concern, dismiss, skip)
How review currently works
Review runs via codex exec with workspace-write permissions (desloppify/app/commands/runner/codex_batch.py)
The reviewer gets a text prompt with: dimension rubrics, seed files, up to 8 mechanical concern signals, scan evidence (aggregated), historical issues
Output is JSON: assessments, dimension_notes, dimension_judgment, issues[], retrospective
The issues[] array is where the reviewer reports defects — each with dimension, summary, related_files, evidence, suggestion, confidence
When an issue has concern_verdict: "confirmed", it becomes a concerns:: issue (detector="concerns", needs_judgment=False) which auto-clusters and flows to triage
When concern_verdict: "dismissed", a fingerprinted dismissal is stored in state["concern_dismissals"]
How triage gives tools (the pattern to follow)
Triage runs via codex exec with workspace-write. The prompt includes:
A preamble: "You are a triage subagent with full codebase access and the desloppify CLI"
A CLI Command Reference section listing exact commands to run
Commands like desloppify plan cluster create/add/show, desloppify plan skip --permanent
The agent runs these commands, which mutate plan.json directly
I'll start by exploring the current codebase to understand the existing patterns and mechanisms before designing the plan.
Assistant
Now let me look at the existing CLI commands to understand what's already available for querying findings, and the review import flow.
Assistant
Now let me look at what the show command currently does, the existing CLI parser, and how resolve/suppress work.
Assistant
Now let me look at the existing resolve command and how the show command handles JSON output, plus how batches get assembled with concerns.
Assistant
Let me look at how the concern signals get attached to batches and the existing output format, plus check how resolve --status wontfix actually marks issues.
Assistant
Now let me check the concern types, how the suppress command works, and the --output flag on show to understand JSON output for the agent.
Assistant
Now let me look at how show handles JSON output and the --output flag, and check the codex execution for the reviewer to understand the runner setup.
Assistant
Now let me check what show looks like with --output for JSON, and how the show command is registered in the parser to understand the existing pattern argument.
Assistant
Now I have a solid understanding of the codebase. Let me check one more thing -- how the existing show concerns view works and what the findings concept looks like from the judgment detectors' perspective.
Assistant
I now have a thorough understanding of the codebase. Let me synthesize the plan.
Implementation Plan: Reviewer Finding Exploration and Adjudication
Key Design Decision: Extend the Output JSON, Not CLI Commands
After exploring the codebase, the simplest approach is a hybrid:
Use the existing desloppify show command for the reviewer to query findings on-demand (it already supports detector-based filtering, JSON output, and file-scoped queries).
Extend the review output JSON to include per-finding verdicts alongside the existing issues[] array.
Use the existing concern_dismissals mechanism for persistence, extended slightly to handle raw finding dismissals (not just generated concern dismissals).
This avoids adding new CLI commands entirely. The reviewer already has workspace-write access and can run desloppify show smells --output /tmp/smells.json to get structured JSON for any detector.
Architecture Overview
The flow becomes:
Prompt tells reviewer about judgment findings and the CLI commands to explore them
Reviewer queries individual detectors via desloppify show <detector> --output /tmp/findings.json and reads actual source code
Reviewer records verdicts in a new finding_verdicts[] array in the output JSON
Repository files: Can freely explore; no tools or special access
Output template JSON: Pre-filled session/dimension stubs; reviewer fills in JSON by hand
No tool use: The reviewer is purely a text/JSON interface. They receive structured data, read code, and return structured decisions. The system is designed for blind, unbiased scoring with explicit scope controls (exclusions, suppress lists, zone overrides).
The mechanical evidence acts as a navigation aid—starting points for where to look—but all scoring is qualitative based on the reviewer's code reading and the dimension rubrics.
_is_dismissed() checks: was this fingerprint dismissed AND source issue set hasn't changed?
If source issues changed, concern is not re-suppressed (can surface again)
cleanup_stale_dismissals() removes dismissals when all source issues disappear
Key difference from suppression: Dismissals prevent concerns (synthesized patterns), not individual issues. The underlying mechanical issues can still appear.
Aggregate findings by pattern (e.g., "this coupling issue shows a real pattern")
8. Existing Facilities
next command: Already shows execution queue items one-at-a-time with context
show <detector> command: Can filter to specific detectors
Query output: Written to .desloppify/query.json for external tools
Living plan: Tracks judgment issues in queue order + clusters
resolve command: Already marks findings with judgments (fixed, wontfix, false_positive)
The execution queue in the living plan (engine/_plan/) actually tracks judgment issues in prioritized order with cluster groupings—this is the closest existing structure to a "reviewer's judgment checklist."
"2. Start from the seed files, then freely explore the repository to build your understanding.",
"...complete `dimension_judgment` for your dimension...",
"...Do not edit repository files.",
"...Return ONLY valid JSON..."
Notably: "Do not edit repository files" — the review subagent is explicitly read-only.
External Review Mode (Claude Launch):
Manual copy/paste of prompt into isolated Claude session
Reviewer has codebase access (can read files)
No CLI, no tools defined
Outputs JSON to a file path that orchestrator imports
Why Triage Has Tools, Review Doesn't
Triage's task requires mutation:
Create clusters, add issues, update steps, record decisions
These are plan-building actions
The CLI is the tool that persists state
Multiple sequential stages need to coordinate (organize → enrich → sense-check)
Review's task is analysis-only:
Assess codebase health against dimensions
Identify defects and patterns
Return structured findings
No need to mutate anything
Each batch is independent
The Pattern You Can Replicate for Interactive Review
If you want reviewers to investigate interactively (like triage does), here's the pattern:
Has dismissal fingerprinting and cleanup of stale dismissals
Existing suppression/dismissal mechanisms
suppressed flag on issues (via desloppify suppress <pattern>) — hides from scoring entirely
status: "wontfix" (via desloppify resolve <pattern> --status wontfix) — keeps in scoring, out of queue
concern_dismissals in state — fingerprinted, prevents re-surfacing of dismissed concerns
Triage plan skip --permanent — plan-scoped only
Requirements
Individual findings should be explorable: The reviewer should be able to list all judgment-required findings, filter by detector, and see individual details
Verdicts per finding: The reviewer should be able to mark individual findings as:
Confirm → becomes a concerns:: issue (existing flow)
Dismiss → permanently suppressed (survives re-scan as long as the issue exists)
Skip → no action this review pass (can be re-evaluated next time)
Use existing tools: The reviewer already has codebase access via codex exec. We should give them CLI commands to query findings, similar to how triage gets cluster commands.
Dismissals should persist: When a finding is dismissed during review, it should not keep resurfacing in future reviews. The existing concern_dismissals mechanism handles this for generated concerns — we need something similar for raw findings.
Existing flows unchanged: The current concern generation, scoring, and review import pipelines should continue working.
Design Constraints
The reviewer agent already runs via codex exec with full codebase + CLI access
The prompt is built in desloppify/app/commands/review/batch/prompt_template.py and prompt_sections.py
Output JSON schema is in prompt_template.py::_render_output_schema
Review results are imported via desloppify/intelligence/review/importing/holistic_issue_flow.py
The concern generator (_concerns/generators.py) already has fingerprinting and dismissal checking
Key questions to address in the plan
Should we add new CLI commands for the reviewer to query findings? (e.g., desloppify show structural --json) — or does desloppify show <detector> already work?
How should dismissals work? Options:
a. Use the existing desloppify resolve <id> --status wontfix
b. Use desloppify suppress
c. Add a new review-dismiss mechanism that ties into the concern_dismissals system
d. Extend the review output JSON to include per-finding verdicts
How should the prompt be extended to tell the reviewer about these tools?
Should findings be presented as a checklist in the prompt, or should the reviewer query them on-demand via CLI?
Please design the simplest approach that achieves the goals. Prefer reusing existing mechanisms over building new ones.
desloppify show smells --output /tmp/smells.json --no-budget
desloppify show structural --output /tmp/structural.json --no-budget
desloppify show naming --output /tmp/naming.json --no-budget
Explain the verdict protocol: for each finding you investigate, record a verdict in finding_verdicts[]
The --no-budget flag is important -- it disables the noise budget that normally caps how many findings per detector are shown, so the reviewer sees them all.
Wire render_judgment_findings_instructions() into render_batch_prompt(), inserted after render_mechanical_concern_signals(batch). Only render this section when the batch includes dimensions that benefit from finding-level adjudication (design_coherence, convention_outlier, etc.).
Step 2: Extend the output JSON schema to include finding_verdicts
In _render_output_schema(), add a new top-level array after issues[]:
code
"finding_verdicts": [{
"finding_id": "structural::src/big_file.py",
"verdict": "confirm|dismiss|skip",
"reasoning": "brief explanation of judgment",
"promoted_dimension": "design_coherence" // required when verdict=confirm
}]
This is separate from issues[] because verdicts adjudicate existing mechanical findings, while issues[] reports newly-discovered defects. The reviewer can still use issues[] with concern_verdict: "confirmed" for generated concerns -- the two mechanisms are complementary.
Step 3: Add finding_verdicts to the import contracts
class FindingVerdictPayload(TypedDict, total=False):
finding_id: str # stable issue ID from state
verdict: str # "confirm" | "dismiss" | "skip"
reasoning: str
promoted_dimension: str # which dimension this promotes to (for confirm)
Look up the finding by finding_id in state["issues"]
Build a concerns:: issue (reuse the existing make_issue pattern from validate_and_build_issues at line 144)
The new concern issue gets detector="concerns", detail.concern_verdict="confirmed", etc.
Return it as part of the review_issues list so it goes through the normal merge pipeline
For "dismiss" verdicts:
Compute a fingerprint from the finding_id using the existing _fingerprint() utility from desloppify/engine/_concerns/utils.py
Store in state["concern_dismissals"] with the finding_id as a source_issue_id
This means if the same finding re-appears after rescan, the dismissal fingerprint (keyed on the stable issue ID components) will suppress it from being surfaced again in future reviews
The existing cleanup_stale_dismissals() already handles removing dismissals when their source issues disappear, so this gets lifecycle management for free
For "skip" verdicts:
No action needed -- the finding stays as-is and will be re-presented in the next review
Step 5: Wire finding verdicts into the holistic import orchestrator
In import_holistic_review(), after processing dismissed_concerns (around line 99), add a block to extract and process finding_verdicts from the review payload. Call process_finding_verdicts() and merge the resulting confirmed issues into review_issues, and store the resulting dismissals into state["concern_dismissals"].
Step 6: Populate finding summaries in batch preparation
In batch_concerns() (line 100), extend the batch dict to include a judgment_finding_summary key containing per-detector counts and a sample of finding IDs. This data is used by the prompt renderer (Step 1) to tell the reviewer what's available without embedding every finding in the prompt.
Alternatively, this data can be computed at prompt-render time from state, which is simpler -- the prompt renderer already has access to the holistic context which includes scan evidence.
Key Design Decisions Explained
Why not new CLI commands? The existing desloppify show <detector> already does exactly what the reviewer needs -- it filters issues by detector, shows details, and supports --output for JSON. Adding a dedicated desloppify review adjudicate command would be more API surface for marginal benefit.
Why finding_verdicts[] separate from issues[]? Separation of concerns:
issues[] is for new observations the reviewer makes
finding_verdicts[] is for adjudicating existing mechanical findings
The import pipeline processes them differently (verdict -> lookup existing issue vs. issue -> create new)
This also means existing reviewers that don't produce finding_verdicts continue working with zero changes
Why reuse concern_dismissals for persistence? The mechanism already:
Uses stable fingerprints
Stores source_issue_ids for lifecycle tracking
Has cleanup_stale_dismissals() for garbage collection
Is checked by generate_concerns() before surfacing concerns
Survives rescans
The only extension needed is that generate_concerns() (and the prompt builder) should also check dismissals keyed on raw finding IDs, not just aggregated concern fingerprints. This is a small change: when building concern signals for the prompt, filter out findings whose IDs appear as source_issue_ids in any dismissal entry.
Why not resolve --status wontfix? That mechanism sets status: "wontfix" on the issue itself in state, which means it stays in scoring and is visible in the issue inventory. A finding dismissal is more like "this is intentional / not a real problem" -- it should prevent the finding from being surfaced as a concern signal in future reviews, but the mechanical finding should remain in state for scoring purposes. The concern_dismissals mechanism handles exactly this distinction.
Prompt Template Design
The new prompt section would look approximately like:
code
JUDGMENT FINDINGS — explore and adjudicate:
The mechanical scan found findings from judgment-required detectors that need human review.
These detectors identify patterns that MAY be problems but require understanding of intent.
Available findings:
- smells: 12 findings
- structural: 4 findings
- naming: 8 findings
To explore these findings, run:
desloppify show smells --output /tmp/smells.json --no-budget
desloppify show structural --output /tmp/structural.json --no-budget
desloppify show <detector> --output /tmp/<detector>.json --no-budget
For each finding you investigate, read the actual source code and record a verdict in
your output's finding_verdicts[] array:
- "confirm": This is a real problem → promoted to a concern issue
- "dismiss": This is intentional/acceptable → suppressed from future reviews
- "skip": Not enough information / defer to next review pass
You do not need to adjudicate every finding. Focus on findings in your batch's seed files
and findings that relate to your assigned dimension.
Sequencing and Dependencies
Steps 3-4 (contracts + import processing) can be built and tested first with unit tests
Steps 1-2 (prompt changes) depend on step 6 (batch data) conceptually but can be developed in parallel
Step 5 (orchestrator wiring) depends on steps 3-4
End-to-end integration testing needs all steps
Potential Challenges
Finding ID stability: Issue IDs like structural::src/big_file.py are stable across rescans as long as the file and detector are the same. The ID format is <detector>::<file>::<detail_suffix>. Dismissed findings that get a new ID after rescan (e.g., file renamed) will not be suppressed -- this is acceptable behavior since the code actually changed.
Prompt length: Adding finding exploration instructions adds to an already substantial prompt. Mitigate by only including this section for batches that include design_coherence or other finding-heavy dimensions, and keeping the instruction block brief.
Reviewer compliance: The reviewer may not produce finding_verdicts at all if it ignores that part of the schema. This is fine -- the array is optional and empty by default. The existing concern signal flow continues working.
Dismissal fingerprint collisions: Using _fingerprint("finding_dismiss", finding_id, ()) should produce unique fingerprints since finding IDs themselves are unique. No collision risk with concern-level fingerprints since those use different type strings.
Critical Files for Implementation
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/prompt_sections.py - Add render_judgment_findings_instructions() and wire into prompt assembly
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/batch/prompt_template.py - Extend output schema with finding_verdicts[], add to render_batch_prompt()
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/importing/holistic_issue_flow.py - Add process_finding_verdicts() for confirm/dismiss/skip logic
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/importing/holistic.py - Wire verdict processing into the import orchestrator
/Users/user_c042661f/Documents/desloppify/desloppify/intelligence/review/importing/contracts_validation.py - Add validate_finding_verdict_payload() following existing validation patterns