I need to understand how the desloppify next command renders its output, specifically:
How does it distinguish between the top actionable finding and any "optional notes" or nudges (like "meta-plan synthesis is pending -- run desloppify plan synthesize")?
Where does the plan synthesis nudge get injected into the output?
Is there a visual/structural distinction in the output between the actual next work item and informational nudges?
Look at:
desloppify/app/commands/next_parts/render.py
desloppify/app/commands/plan/queue_render.py
Any related files that control what next displays
Be thorough - read the full render files.
Assistant
I'll analyze how the next command renders its output, particularly focusing on the distinction between actionable findings and informational nudges.
Assistant
Now let me examine the next command's main entry point to see how these rendering functions are orchestrated:
Assistant
Let me check the main next command:
Assistant
Perfect! Now let me check the stale_dimensions module to understand how the synthesis pending item is created:
Assistant
Now let me check the work queue core to see how synthesis_needed items are built:
Assistant
Let me get the full context of the synthesis_needed builder function:
Assistant
Excellent! Now let me check the core.py to see how items are selected and ordered:
Assistant
Perfect! Now let me check the ranking module to see how items are sorted:
Assistant
Excellent! Now I have all the pieces. Let me trace through the actual rendering logic one more time to confirm the flow:
Assistant
Perfect! Now I have everything I need. Let me compile a comprehensive report.
Comprehensive Analysis: How desloppify next Renders Output with Plan Synthesis Nudges
I've thoroughly analyzed the codebase, and here's exactly how the next command distinguishes between actionable findings and informational nudges:
1. SEPARATION ARCHITECTURE
The next command uses a three-stage rendering pipeline that separates the actionable item(s) from supplementary information:
Stage 1: Main Items Rendering (render_terminal_items)
Responsibility: Renders the actual queue items — the work you should do
Key Logic (lines 508-512):
python
# When synthesis is pending, only show the planning card — don't leak
# implementation tasks that would tempt agents to skip the planning step.
if items and items[0].get("kind") == "synthesis_needed":
_render_synthesis_item(items[0])
return
This is the critical gate: If synthesis is needed, it renders ONLY that card and exits—preventing other findings from appearing and distracting from the planning step.
Stage 2: Single-Item Resolution Hint (render_single_item_resolution_hint)
The synthesis pending item is built synthetically with:
python
{
"id": "synthesis::pending",
"kind": "synthesis_needed", # ← Special kind, not a regular finding
"tier": 1,
"effective_tier": 1,
"confidence": "high",
"detector": "synthesis",
"summary": f"Meta-plan update: {total} review findings need integration into epics",
"primary_command": "desloppify plan synthesize",
"detail": {
"total_review_findings": total,
"new_since_last": new_since_last,
"resolved_since_last": resolved_since_last,
"trigger": trigger,
...
}
}
Injection Points (Three stages)
Into queue_order via sync_synthesis_needed() in /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/stale_dimensions.py:215-243:
Inserted at position 0 (front of queue) when review findings change
Removed when findings are stable
Built and added to items via build_synthesis_item() in /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/helpers.py:299-361
Injected into work queue via _inject_synthesis_and_epic_items() in /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/core.py:251-273:
python
synthesis_item = build_synthesis_item(plan, state)
if synthesis_item and synthesis_item["id"] not in existing_ids:
if scope_matches(synthesis_item, scope):
all_items.append(synthesis_item)
The _render_synthesis_item() function provides a completely different visual presentation:
python
def _render_synthesis_item(item: dict) -> None:
"""Render the synthesis::pending card."""
print(colorize(" PLAN — do not proceed until complete", "bold"))
print(colorize(" " + "─" * 60, "dim"))
print(f" {total} review findings need integration into the meta-plan.")
print(f" Trigger: {trigger}")
print()
print(colorize("This is a planning step. Do NOT start fixing code until this is done.", "yellow"))
print()
print(" Steps:")
print(" 1. Run `desloppify plan synthesize` to see all review findings")
print(" 2. Analyze findings — group by root cause into clusters")
print(" 3. Create clusters, set priorities, focus on first arc")
print(' 4. Mark complete: `desloppify plan done synthesis::pending --note "..." --attest "..."`')
print(" 5. THEN run `desloppify next` for implementation tasks")
Key differences from regular items:
No code snippet (regular items show lines of code)
No dimension score information
Bold "PLAN" header with strong warning language
Step-by-step instructions not typical of regular findings
The return statement prevents all other items from rendering
When a cluster is focused but synthesis is pending, a secondary nudge appears as a yellow note:
python
# Nudge about pending synthesis hidden by focus
from desloppify.engine._plan.stale_dimensions import SYNTHESIS_ID
if SYNTHESIS_ID in plan.get("queue_order", []):
if not any(it.get("kind") == "synthesis_needed" for it in items):
print(colorize(
" Note: meta-plan synthesis is pending -- run "
"`desloppify plan synthesize` when ready.",
"yellow",
))
This appears even when synthesis::pending isn't in the current item list (e.g., when a cluster focus hides it).
4. THE COMPLETE FLOW
When you run desloppify next:
Queue is built (build_work_queue() in /Users/user_c042661f/Documents/desloppify/desloppify/engine/_work_queue/core.py:374-494)
Synthesis item is injected if needed
All items sorted (synthesis to top via item_sort_key)
Plan order applied (_apply_plan_order())
synthesis::pending at position [0] in queue
Terminal rendering starts (cmd_next() in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/next.py:61-198)
If kind == "synthesis_needed": calls _render_synthesis_item() and returns immediately
Otherwise: renders normally
Followup nudges appear last — optional coaching about dimension health, not actionable work
5. CONDITIONAL DISPLAY LOGIC
The synthesis card appears only when:
SYNTHESIS_ID ("synthesis::pending") is in plan.queue_order
Review/concerns findings have changed (hash mismatch detected by sync_synthesis_needed())
Removal happens when:
Synthesis is completed via desloppify plan done synthesis::pending
Finding snapshot hash matches the stored hash in epic_synthesis_meta
Summary Table
Component
Purpose
Location
Styling
Blocking
Synthesis item
Meta-plan card when findings change
_render_synthesis_item()
Bold header, yellow warning
YES — returns early, prevents all other items
Regular items
Actionable findings
_render_item()
Default (yellow summary, dim details)
No — rendered in sequence
Resolution hint
"Fix with:" or "Resolve with:" commands
render_single_item_resolution_hint()
Dim
No — supplementary
Followup nudges
Dimension health, coaching, "North star"
render_followup_nudges()
Cyan/dim
No — informational
Focused synthesis note
Synthesis reminder when cluster focused
render_terminal_items() lines 498-506
Yellow
No — secondary nudge
This design ensures that when synthesis is needed, it completely dominates the output and prevents users from proceeding to implementation work without first integrating review findings into the meta-plan.