-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat(plan): iterative planning & plan review #8105
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
base: dev
Are you sure you want to change the base?
Conversation
Add comprehensive plan mode improvements including:
- Plan state management with session-scoped storage at ~/.local/share/opencode/plan/
- ExitPlanMode tool that AI calls when plan is ready for review
- Plan review TUI component with approve/reject keybindings
- Session-scoped permissions using {sessionID} placeholder in patterns
- evaluateWithSession() for permission evaluation with session context
- Plan→build agent transition on approval with synthetic continuation
- Post-compaction reminder pointing AI to plan file location
- Server endpoints for plan approve/reject operations
…g instructions
- Update plan.txt prompt to include {PLAN_FILE_PATH} placeholder
- Make insertReminders async to get plan file path from Plan.getOrCreate
- Add clear instructions for writing to plan file early and often
- Emphasize incremental updates rather than waiting for complete plan
- Add planContent field to session revert info - Save plan file content before revert, delete the file - Restore plan file content on unrevert - Add Plan.deletePlan() and Plan.writeContent() functions
Previously, revert would delete the plan file and save its content for unrevert. This caused the plan to be lost if the user proceeded with the revert instead of undoing. Now we save the content for unrevert but leave the file intact during revert. This preserves the plan file regardless of whether the user proceeds or undoes.
- Add PlanPatchPart to track plan content changes (only stored when content changes) - Capture plan content at step-start, compare at step-finish, create PlanPatchPart if different - Restore plan content from collected PlanPatchParts during revert - Fix ExitPlanMode to throw RejectedError when dismissed (interrupts loop) vs return result when rejected with feedback (allows revision) - Filter plan-patch parts from share sync (internal state only)
- Add PlanReviewInline component for inline plan review UI - Add plan_review state and event handlers to global-sync - Add initial loading of pending plan reviews on bootstrap - Add /plan-review/:requestID/content endpoint to fetch plan content - Render plan review UI above prompt input when pending - Regenerate SDK to include new plan review content endpoint
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This existing PR implements a foundational piece of the functionality (exiting plan mode), while the current PR (#8105) adds the broader iterative planning and plan review features that build upon or extend that capability. All other search results are unrelated to the planning/plan review features. |
|
I'm publishing this now as a draft PR to get visibility and garner some feedback around the topic. It's a big PR with multiple different additions so I wanna make sure to get it right. Will be working further on it after I get to do some testing in the coming days |
Restore the permission-task.test.ts that was emptied during the
iterative plan mode feature implementation. Add new tests for the
evaluateWithSession function that handles {sessionID} placeholder
expansion in permission patterns.
What does this PR do?
This PR adds two new features:
Iterative Planning, something which for example Claude Code and I believe Cursor as well which will keep iterating on one and the same plan document instead of writing it to the conversation history, losing context between iteration, etc...
Plan Review / Summary, after iterating on the plan, it will request to exit planning mode. When it does this it'll let you approve/reject the plan, give an optional reason, or dismiss it entirely and interrupt the flow. Gives you an easy way of looking through the entire plan before executing on it.
How did you verify your code works?
Basic tests in plan mode via TUI and Web interface. Will be doing more extensive testing on real projects (hence it being a draft PR)