-
Notifications
You must be signed in to change notification settings - Fork 32
🤖 feat: refactor Plan Mode with external file change detection #977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
This seems like a lot of complexity... are you not able to get steering with the system prompt? |
What steering are you referring to? |
|
Seems like you're trying to fix the issue where the agent makes edits via bash when in plan mode, which is primarily the case with non-Anthropic models? |
No, not at all. This approach is somewhat inspired by the planning system in Claude Code, which also writes to a Markdown file. Essentially, it's a way to reduce output tokens and achieve a faster, more consistent iterative planning loop with the LLM, since the propose_plan tool call doesn’t need to reprint the entire plan each time, and more efficient file editing operations. Additionally, the file will be useful in a follow-up PR, as we’ll be able to "attach" the plan to the workspace. After compaction, the plan can be included verbatim, supporting a more reliable and longer-running agentic loop. |
|
Additionally, sharing the plan with others will become easier, enabling a future where a PR could include the plan file, making it accessible and helping developers achieve alignment more quickly. |
|
Ah ok, understood. I misinterpreted the PR title. |
Add Plan Mode - a deliberate workflow where agents propose plans before implementation. ## Core Features **Plan Mode Workflow** - Toggle between Plan and Exec modes with Cmd+Shift+M / Ctrl+Shift+M - In Plan mode, file edits are restricted to ~/.mux/plans/<workspace-id>.md - Agent writes plan via file_edit tools, then calls propose_plan to present for review - Users can edit plans externally (in their preferred editor) before approval - Start CLI sessions in plan mode with `mux run --mode plan` **External File Change Detection** - Timestamp-based polling detects when users edit plan files externally - Computes unified diff of changes and injects as synthetic user message - Agent automatically sees external modifications without manual notification - Preserves prompt cache by injecting as user message, not system message mutation **ProposePlan Tool UI** - Renders proposed plans with markdown formatting - Edit button opens plan in native terminal editor ($EDITOR) - Fresh content refetches on window focus for external edit workflow - "Start Here" button replaces chat context with plan (for long sessions) - Show Text/Markdown toggle for raw vs rendered views ## Infrastructure **File Edit Tool Refactoring** - Extracted common execution pipeline (executeFileEditOperation) - Shared validation utilities (isPlanFileAccess, validatePathInCwd) - Custom diff utility (computeDiff) replaces external dependency - Runtime-aware path resolution for SSH compatibility **Test Coverage** - Unit tests for change detection algorithm and diff computation - Integration tests for file change notifications via IPC - Plan mode enforcement tests for file_edit_* tools - Tests for both local and SSH runtime scenarios ## Documentation - New docs/plan-mode.mdx with comprehensive usage guide - Updated docs/cli.mdx with --mode flag documentation - Navigation updated in docs.json fix: use local filesystem for plan files in SSH workspaces Plan files are local artifacts that should always be stored on the local machine, not on remote SSH hosts. Previously, plan mode would use the workspace runtime for file operations, causing plan files to be written to/read from the remote host when using SSH workspaces. Add localRuntime option to tool config that bypasses SSH for plan file I/O. The AI service now creates a LocalRuntime instance when in plan mode, and file edit tools select the appropriate runtime based on whether the operation targets a plan file.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
~/.mux/plans/<workspace-id>.md. Agent proposes plans viapropose_plantool for user review before implementation.Test plan
Generated with
mux