Add Pro Plan model routing for plan-first changes#1865
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces 'Pro Plan' mode, a model-routing workflow that utilizes deepseek-v4-pro for planning and review phases and deepseek-v4-flash for implementation. It includes a new ProPlanRouter state machine to manage phase transitions and updates the TUI and engine to enforce plan confirmation, handle automatic model switching, and provide phase-specific status updates. Feedback identifies the use of unstable Rust 'let chains' which could cause compilation errors on stable toolchains. Additionally, several new user-facing strings and labels are hardcoded in English and should be moved to the localization system to maintain internationalization standards.
| if let Some(router) = app.pro_plan_router.as_mut() | ||
| && router.phase() == crate::tui::pro_plan::ProPlanPhase::Done |
There was a problem hiding this comment.
The use of 'let chains' (if let ... && ...) is an unstable Rust feature (see RFC 2497). Unless this repository explicitly requires a nightly toolchain via a rust-toolchain.toml file, this will cause compilation errors on stable Rust. Please refactor these to use nested if let statements or matches!. This pattern also appears on lines 1582, 1633, and 5590.
| crate::tui::pro_plan::ProPlanFollowUp::ReviewImplementation => { | ||
| "Review the implementation against the accepted plan. Do not edit files during review. If it is correct, include `<pro_plan review=\"approved\">`; if changes are needed, include `<pro_plan review=\"changes_requested\">` and list the fixes." | ||
| } | ||
| crate::tui::pro_plan::ProPlanFollowUp::AddressReviewFeedback => { | ||
| "Address the review feedback using the accepted plan, then summarize the changes and include `<pro_plan execute_complete=\"true\">`." | ||
| } |
There was a problem hiding this comment.
These follow-up messages and status labels are hardcoded in English. To maintain consistency with the project's internationalization (i18n) standards, these strings should be moved to MessageId in crates/tui/src/localization.rs and retrieved using the tr() function. This applies to several new user-facing strings in this file, including:
- Phase labels (lines 1654-1657)
- System messages (lines 5532, 5566, 5601)
- Tool blocking status (line 1976)
| ("Accept plan", "Start implementation with approvals"), | ||
| ( | ||
| "Accept plan (YOLO)", | ||
| "Start implementation in YOLO mode (auto-approve)", | ||
| "Start implementation with auto-approval", | ||
| ), | ||
| ("Revise plan", "Ask follow-ups or request plan changes"), | ||
| ( | ||
| "Exit Plan mode", | ||
| "Exit to Agent", | ||
| "Return to Agent mode without implementation", | ||
| ), |
# Conflicts: # crates/tui/src/tui/ui.rs
|
Addressed the current review pass in e915c79/e5efe93:
Local validation:
|
|
Polished this for reviewability in 872691c:
The PR is now marked ready for review. |
Summary
deepseek-v4-pro, executes withdeepseek-v4-flash, and keeps the existing Plan Confirmation gate.update_planbefore implementation, including engine-level blocking for non-update_plantools until the plan is recorded./mode, mode picker, footer/header/composer UI, localization strings, README, and mode docs.Why this helps
Claude Code now exposes the same public workflow pattern through
/model opusplan: use the strongest model in Plan mode, then switch to a faster model for execution. Anthropic's docs frame the motivation around large coding tasks: planning before broad edits avoids expensive wrong diffs, and the stronger model has the most leverage on architecture and hard reasoning while implementation is usually more mechanical.Pro Plan brings that pattern to DeepSeek TUI with DeepSeek-native models and the existing Plan Confirmation gate:
deepseek-v4-proonly where it has the most leverage, planning and review, while lettingdeepseek-v4-flashhandle the implementation pass. This is not meant to make tiny edits cheaper; it is meant to reduce expensive-model usage and rework on larger, riskier tasks.update_planbefore write-capable tools can run.Prior-art references:
opusplanuses Opus during plan mode and switches to Sonnet for execution.Safety / Reviewability
AppMode::ProPlanfails closed to Plan-mode tools, read-only sandboxing, and Never approval if any path bypasses phase resolution.Validation
cargo fmtcargo check -p deepseek-tuicargo test -p deepseek-tui pro_plan --quietcargo test -p deepseek-tui --quiet/mode pro-plan: an implementation-style Chinese planning request attemptedread_file, was blocked by the plan guard, then calledupdate_planand opened Plan Confirmation. I exited via option 4 to avoid applying the smoke-test README edit.