Skip to content

Commit 13edd43

Browse files
JuanCS-Devclaude
andcommitted
feat(planner): v6.1 Multi-Plan + CLI Integration
Planner v6.1 Features: - Multi-Plan Generation with 3 strategies (STANDARD, ACCELERATOR, LATERAL) - Verbalized Sampling (Zhang et al. 2025) with risk/reward probabilities - Clarifying Questions mode (Cursor 2.1 pattern) - Exploration Mode (read-only analysis) - plan.md artifact generation CLI Integration: - New commands: /plan multi, /plan clarify, /plan explore - AgentRouter patterns for intent detection (PT-BR + EN) - AgentManager v6.1 methods - Bridge v6.1 wrappers with governance Bug Fixes: - Fixed /plan-mode command (bridge method name mismatch) - Updated edge case tests for Planner v5/v6 behavior Tests: 143 critical tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fad72da commit 13edd43

File tree

7 files changed

+3358
-5174
lines changed

7 files changed

+3358
-5174
lines changed

qwen_cli/app.py

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@
121121
[bold cyan]│[/bold cyan] [bold white]Agentes Especializados[/bold white] [bold cyan]│[/bold cyan]
122122
[bold cyan]╰─────────────────────────────────────────────────────────────╯[/bold cyan]
123123
124-
[bold yellow]Planejamento[/bold yellow]
124+
[bold yellow]Planejamento (v6.1)[/bold yellow]
125125
[cyan]/plan[/cyan] [white]<objetivo>[/white] [dim]......[/dim] GOAP planning, decompõe tarefas
126+
[cyan]/plan multi[/cyan] [white]<obj>[/white] [dim]....[/dim] Gera 3 planos alternativos (risk/reward)
127+
[cyan]/plan clarify[/cyan] [white]<obj>[/white] [dim]..[/dim] Faz perguntas antes de planejar
128+
[cyan]/plan explore[/cyan] [white]<obj>[/white] [dim]..[/dim] Análise read-only (sem modificar)
126129
[cyan]/architect[/cyan] [white]<spec>[/white] [dim]....[/dim] Análise de arquitetura
127130
128131
[bold yellow]Código[/bold yellow]
@@ -1268,8 +1271,30 @@ async def _handle_command(
12681271
view.add_success("Conversation context cleared.")
12691272

12701273
# Agent commands - map to agents
1274+
# =====================================================================
1275+
# PLANNER v6.1 COMMANDS (multi, clarify, explore)
1276+
# =====================================================================
12711277
elif command == "/plan":
1272-
await self._invoke_agent("planner", args or "Create a plan", view)
1278+
# Check for v6.1 sub-commands
1279+
if args:
1280+
args_lower = args.lower().strip()
1281+
if args_lower.startswith("multi ") or args_lower == "multi":
1282+
# Multi-Plan Generation
1283+
task = args[6:].strip() if args_lower.startswith("multi ") else ""
1284+
await self._invoke_planner_v61("multi", task or "Generate multiple plans", view)
1285+
elif args_lower.startswith("clarify ") or args_lower == "clarify":
1286+
# Clarification Mode
1287+
task = args[8:].strip() if args_lower.startswith("clarify ") else ""
1288+
await self._invoke_planner_v61("clarify", task or "Clarify requirements", view)
1289+
elif args_lower.startswith("explore ") or args_lower == "explore":
1290+
# Exploration Mode (read-only)
1291+
task = args[8:].strip() if args_lower.startswith("explore ") else ""
1292+
await self._invoke_planner_v61("explore", task or "Explore codebase", view)
1293+
else:
1294+
# Regular planning
1295+
await self._invoke_agent("planner", args, view)
1296+
else:
1297+
await self._invoke_agent("planner", "Create a plan", view)
12731298

12741299
elif command == "/execute":
12751300
await self._invoke_agent("executor", args or "Execute task", view)
@@ -2681,6 +2706,59 @@ async def _invoke_agent(
26812706
status.mode = "READY"
26822707
view.end_thinking()
26832708

2709+
async def _invoke_planner_v61(
2710+
self,
2711+
mode: str,
2712+
task: str,
2713+
view: ResponseView
2714+
) -> None:
2715+
"""
2716+
Invoke Planner v6.1 with specific mode.
2717+
2718+
Modes:
2719+
- multi: Generate 3 alternative plans with risk/reward
2720+
- clarify: Ask clarifying questions before planning
2721+
- explore: Read-only analysis mode
2722+
"""
2723+
self.is_processing = True
2724+
view.start_thinking()
2725+
2726+
status = self.query_one(StatusBar)
2727+
mode_labels = {
2728+
"multi": "MULTI-PLAN",
2729+
"clarify": "CLARIFY",
2730+
"explore": "EXPLORE"
2731+
}
2732+
status.mode = f"🎯 PLANNER:{mode_labels.get(mode, mode.upper())}"
2733+
2734+
try:
2735+
if mode == "multi":
2736+
async for chunk in self.bridge.invoke_planner_multi(task):
2737+
view.append_chunk(chunk)
2738+
await asyncio.sleep(0)
2739+
elif mode == "clarify":
2740+
async for chunk in self.bridge.invoke_planner_clarify(task):
2741+
view.append_chunk(chunk)
2742+
await asyncio.sleep(0)
2743+
elif mode == "explore":
2744+
async for chunk in self.bridge.invoke_planner_explore(task):
2745+
view.append_chunk(chunk)
2746+
await asyncio.sleep(0)
2747+
else:
2748+
view.add_error(f"Unknown planner mode: {mode}")
2749+
return
2750+
2751+
view.add_success(f"✓ Planner v6.1 ({mode}) complete")
2752+
status.governance_status = self.bridge.governance.get_status_emoji()
2753+
2754+
except Exception as e:
2755+
view.add_error(f"Planner v6.1 error: {e}")
2756+
status.errors += 1
2757+
finally:
2758+
self.is_processing = False
2759+
status.mode = "READY"
2760+
view.end_thinking()
2761+
26842762
async def _execute_bash(
26852763
self,
26862764
command: str,

0 commit comments

Comments
 (0)