Skip to content

Conversation

@KibbeWater
Copy link

@KibbeWater KibbeWater commented Jan 13, 2026

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.

image image

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

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

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.

@KibbeWater
Copy link
Author

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

@KibbeWater KibbeWater force-pushed the feat/iterative-planning branch from 63a744e to ca7e3cb Compare January 13, 2026 20:17
@KibbeWater KibbeWater marked this pull request as ready for review January 13, 2026 20:17
@adamdotdevin adamdotdevin requested review from rekram1-node and removed request for adamdotdevin January 14, 2026 15:05
@KibbeWater KibbeWater force-pushed the feat/iterative-planning branch from ca7e3cb to d85561c Compare January 16, 2026 19:41
@KibbeWater KibbeWater changed the title feat(plan): iterative planning & plan review feat(plan): plan review Jan 16, 2026
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
@KibbeWater KibbeWater force-pushed the feat/iterative-planning branch from 71914d7 to a7245a2 Compare January 16, 2026 22:44
@KibbeWater
Copy link
Author

@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

@KibbeWater
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant