Skip to content

feat: add plan mode#2822

Open
vadiminshakov wants to merge 39 commits into
charmbracelet:mainfrom
vadiminshakov:feat/1734-plan-mode
Open

feat: add plan mode#2822
vadiminshakov wants to merge 39 commits into
charmbracelet:mainfrom
vadiminshakov:feat/1734-plan-mode

Conversation

@vadiminshakov

Copy link
Copy Markdown
Contributor
  • [+] I have read CONTRIBUTING.md.
  • [+/-] I have created a discussion that was approved by a maintainer (for new features).

Resolve feature request #1734

Let's plan!

@charmcli

charmcli commented May 6, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vadiminshakov

Copy link
Copy Markdown
Contributor Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

@vadiminshakov

Copy link
Copy Markdown
Contributor Author

recheck

@vadiminshakov vadiminshakov force-pushed the feat/1734-plan-mode branch 2 times, most recently from ee64af4 to 17a5fe8 Compare May 9, 2026 21:07
@oiwn

oiwn commented May 13, 2026

Copy link
Copy Markdown

What's up? What's prevent this from merging?

6. once all required questions are answered and no further investigation is needed, ask the user to switch to code mode and confirm the plan.
</critical_rules>

<workflow>

@dcu dcu May 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a rule to present trade offs and risks?

present trade-offs, risks, and alternatives for non-trivial decisions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, added

Comment thread internal/ui/model/ui.go Outdated
t := m.com.Styles
if info.LineNumber == 0 {
if info.Focused {
return "[plan] > "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like much how this looks, any other alternatives?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can move it to the status bar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Снимок экрана 2026-05-20 в 18 19 54

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey my friend, recently yolo mode was introduced in master and it includes its own badge at the prompt, I think we should adopt it, maybe keep both

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure the plan needs a badge as well

Comment thread internal/agent/templates/plan.md.tpl Outdated
</critical_rules>

<workflow>
1. explore the codebase and gather relevant context.

@dcu dcu May 20, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about these guard rails:

  • Deeply analyze the repository to understand existing norms, structures and baseline conditions.
  • Pinpoint analogous functionalities and structural designs within the project.
  • Evaluate various potential solutions, weighing the pros and cons of each.
  • Assess potential risks, edge cases, and failure modes.

I'm testing them...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@vadiminshakov vadiminshakov force-pushed the feat/1734-plan-mode branch 4 times, most recently from 3b20f91 to ef9d769 Compare May 22, 2026 06:38
@dcu

dcu commented May 22, 2026

Copy link
Copy Markdown

hey Vadim, great work!

have you thought about having a tool to start the plan and, one to finish, present and ask for approval or feedback?

@vadiminshakov

Copy link
Copy Markdown
Contributor Author

@dcu yes, I mentioned this in the discussion: #2947

We do need a question tool so that the model can ask questions during planning when needed. But I saw that this tool had already been discussed earlier in the project, so I didn’t want to bundle two features into a single request.

If you think adding question is acceptable, I can hide plan behind an experimental flag in the current request and add question in a separate request. What do you think?

Comment thread internal/agent/templates/plan.md.tpl Outdated
</critical_rules>

<workflow>
1. deeply analyze the repository to understand existing norms, structures and baseline conditions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting much better results with these rules although it spends more tokens:

1. thoroughly explore the codebase using read-only tools
2. understand existing patterns and architecture
3. pinpoint analogous functionalities and structural designs within the project.
...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced

Comment thread internal/agent/templates/plan.md.tpl Outdated
</workflow>

<style>
- be concise and precise.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider these rules:

<style>
- Deliver exact, accurate technical details while ruthlessly eliminating filler words and unnecessary jargon.
- Ensure all technical mechanisms, dependencies, and edge cases are factual and thoroughly accounted for, without sacrificing readability.
- Avoid asking open-ended questions for information that can be verified directly from the code.
- If the code is ambiguous or lacks context, do not guess; state your technical inference as an explicit assumption for the user to validate.
- Explain the technical plan by deconstructing it into three distinct layers: the Purpose (Why), the Change (What), and the Impact (So What).
</style>

Ideally we need a tool to ask to the user...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced style guidelines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we need a tool to ask to the user...

I suggest adding the question tool separately, since it will involve a lot of UI work that will need to be discussed separately. I can contribute this tool very soon.

@vadiminshakov

vadiminshakov commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@dcu question PR is here now #2980

After the merge, we’ll be able to integrate this into plan mode easily (in this pr or another, I’ll pick it up)

@dcu

dcu commented May 22, 2026

Copy link
Copy Markdown

there's a bug I just noticed when you are writing something in the prompt and press shift + tab the cursor acts up

@vadiminshakov

Copy link
Copy Markdown
Contributor Author

there's a bug I just noticed when you are writing something in the prompt and press shift + tab the cursor acts up

fixed

@vadiminshakov vadiminshakov force-pushed the feat/1734-plan-mode branch 2 times, most recently from 3ca620e to ac58f55 Compare May 22, 2026 19:35
@dcu

dcu commented May 23, 2026

Copy link
Copy Markdown

I ran a test with both claude code and crush using the same model (kimi k2.6) and the results are pretty different, this is the verdict:

   ## Verdict

   Claude Code is stronger on user-facing API ergonomics, naming, documentation consistency, and example quality.
   It identified concrete bugs (MCP ordering, SetupAgents destructive behavior) and design friction points
   (pointer return, free functions vs methods).

   Crush is stronger on API boundary hygiene and internal dependency leaks. It correctly identified that several
   App  methods expose bubbletea/internal types, making them unusable from external code.

   They are complementary. Merge both lists: ~18 distinct issues total, with only the goroutine leak overlapping.

Claude identified more unique issues (13 vs 8). it also took more time exploring

@dcu

dcu commented May 24, 2026

Copy link
Copy Markdown

I ran a test with both claude code and crush using the same model (kimi k2.6) and the results are pretty different, this is the verdict:

   ## Verdict

   Claude Code is stronger on user-facing API ergonomics, naming, documentation consistency, and example quality.
   It identified concrete bugs (MCP ordering, SetupAgents destructive behavior) and design friction points
   (pointer return, free functions vs methods).

   Crush is stronger on API boundary hygiene and internal dependency leaks. It correctly identified that several
   App  methods expose bubbletea/internal types, making them unusable from external code.

   They are complementary. Merge both lists: ~18 distinct issues total, with only the goroutine leak overlapping.

Claude identified more unique issues (13 vs 8). it also took more time exploring

#2989 improves significantly the plan in my case if you want to test

@dcu

dcu commented May 24, 2026

Copy link
Copy Markdown

@vadiminshakov test this tpl when you can

You are Crush in plan mode — an expert architect, senior UX designer, and planning specialist with meticulous attention to detail.

Your job is to analyze the codebase and user intent, then produce a concrete, actionable implementation plan without modifying files or running state-changing commands.

<critical_rules>
These rules override everything else. Follow them strictly:

1. do not modify files, create files, delete files, or run write operations.
2. do not execute commands that can change system state.
3. delegation to sub-agents is allowed for deeper codebase exploration only.
4. provide the most complete analysis possible for the user's request before proposing implementation steps.
5. ask clarifying questions only when they are strictly necessary to produce a correct implementation plan.
6. once all required questions are answered and no further investigation is needed, ask the user to switch to code mode and confirm the plan.
</critical_rules>

<workflow>
1. decompose the request into independent exploration threads (e.g., architecture, analogous features, tests, config, documentation, user-facing touchpoints)
2. launch multiple `agent` tool calls in parallel for independent searches; use direct `glob`, `grep`, `ls`, and `view` only for simple, targeted lookups you can resolve in one or two calls
3. synthesize findings: existing patterns, analogous functionality, structural designs, and dependencies relevant to the request
4. critically review the synthesis — identify gaps, contradictions, unverified assumptions, and areas not yet explored; run additional targeted `agent` calls or direct reads to close gaps; repeat until confident nothing material is missing
5. assess potential risks, edge cases, failure modes, and pre-existing issues in touched areas; do not expand scope beyond what informs the plan
6. produce a concrete, actionable implementation plan
7. if needed, ask only clarifying questions required to unblock the plan
8. when the plan is ready and complete, explicitly request:
   - switch to code mode
   - confirmation to execute the plan
</workflow>

<style>
- Deliver exact, accurate technical details while ruthlessly eliminating filler words and unnecessary jargon.
- Ensure all technical mechanisms, dependencies, and edge cases are factual and thoroughly accounted for, without sacrificing readability.
- Avoid asking open-ended questions for information that can be verified directly from the code.
- If the code is ambiguous or lacks context, do not guess; ask the user.
- Explain the technical plan by deconstructing it into three distinct layers: the Purpose (Why), the Change (What), and the Impact (So What).
- Never ask the user what you could discover by reading the code, running tests, or checking documentation.
- When evaluating a public API, ask: "Could an external caller use this correctly without reading the source?"
- When you find a design choice (unclear ownership semantics, standalone function, exposed internal type), evaluate whether it was intentional or accidental.
- When the change touches user-facing behavior, describe the intended user flow, interaction states, and failure/empty states before listing implementation steps.
- When the change touches APIs or data models, evaluate ergonomics for callers and consumers: naming, defaults, error surfaces, and whether the design matches existing project patterns.
- After synthesizing exploration results, explicitly list what remains unknown or unverified before proceeding; do not draft the plan until those gaps are closed or stated as assumptions.
</style>

### Critical Files for Implementation
List 3-5 files most critical for implementing this plan:
- path/to/file1
- path/to/file2
- path/to/file3

@vadiminshakov

Copy link
Copy Markdown
Contributor Author

@dcu added your prompt. I think manual model benchmarks rely on subjectivity one way or another and are not deterministic. But I think this makes sense as part of unifying it with the changes you’re proposing in the other pull request

@vadiminshakov vadiminshakov force-pushed the feat/1734-plan-mode branch from 922ddfa to be65d67 Compare May 25, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants