-
Notifications
You must be signed in to change notification settings - Fork 6.9k
feat(plan): 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?
feat(plan): plan review #8105
Conversation
|
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 |
63a744e to
ca7e3cb
Compare
ca7e3cb to
d85561c
Compare
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
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.
Use our exit_plan_mode (ExitPlanModeTool) with PlanReview dialog instead of upstream's simpler plan_exit tool. Keep plan_enter from upstream for entering plan mode.
- Move plan review content into chat history (scrollable) - Keep approve/reject controls docked at bottom - Add markdown syntax highlighting for plan content - Fix Solid.js reactivity for plan review state updates - Handle plan→build agent transition correctly - Skip tool parts in messages when tool isn't available
71914d7 to
a7245a2
Compare
|
@rekram1-node had to make several changes since some parts of this PR was implemented by someone else aswell which got merged. Made several recent changes and believe It's in a ready-enough state again to be reviewed |
|
incredibly messy git history, sorry about that, was struggling with rebasing upstream back into my repo so force-pushed and then it became a whole mess. Hopefully won't be an issue |
What does this PR do?
This PR adds two one new feature: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.* Iterative Planning was added by Dax shortly after this PR, so for that reason I'm adopting those features but with some additional improvements
This PR includes an improved plan reviewing flow where when exit plan mode is called it'll show you the full plan file in the chat and gives you some quick key binds to approve/reject it with an optional comment.
This PR initially included an iterative planning mode but I adopted the new planning tools by @thdxr. Due to this, the PR has a lot of commits adding / removing those features.
How did you verify your code works?
Basic tests in plan mode via TUI and Web interface by planning new features, smaller changes and more in real projects