This repository was archived by the owner on Feb 25, 2026. It is now read-only.
feat: Add predefined suggestions after finishing the planning session#459
Merged
alex-alecu merged 19 commits intodevfrom Feb 20, 2026
Merged
feat: Add predefined suggestions after finishing the planning session#459alex-alecu merged 19 commits intodevfrom
alex-alecu merged 19 commits intodevfrom
Conversation
… to improve context management
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The PR introduces a well-structured plan follow-up feature that prompts users after a plan agent completes, offering three options: start a new session with handover context, continue in the current session, or provide custom follow-up text. Key observations (no blocking issues):
Files Reviewed (3 files)
|
…ummary of what was explored and which files were read so the AI doesn't have to re-search the codebase.
…/kilo into feat/suggestions-after-plan-end
marius-kilocode
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Following the example from Claude Code after a planning session:
The context management is the most important job of tools using AI models. By starting a fresh session with just the plan as the first message, we maximize the efficiency of the implementation.
It's also cheaper to start with a fresh context - the CLI will not send on every request all the context it took build the plan.
Implementation
Now I have a thorough understanding of both the branch changes and the existing context limiter system. Here's the answer:
What this branch does with the context limiter and why
This branch sidesteps the context limiter entirely by creating a fresh session when transitioning from planning to implementation — rather than relying on compaction to reclaim space in an increasingly bloated conversation.
The mechanism
When the plan agent finishes its turn (
packages/opencode/src/session/prompt.ts:339-347), the newPlanFollowup.ask()hook intercepts before the loop exits and presents the user with three choices:"Start new session" — Creates a brand-new session with a clean context window. Instead of carrying the entire planning conversation forward (which would eventually trigger compaction/pruning), it runs a one-shot LLM call (
generateHandover()inpackages/opencode/src/kilocode/plan-followup.ts:62-98) using the compaction agent to distill the planning conversation into a concise handover summary. The new session receives only:This message is injected as a non-synthetic user message addressed to the
codeagent, and the prompt loop starts immediately."Continue here" — Injects a synthetic "Implement the plan above." message in the current session (keeping the existing context, which will eventually hit compaction normally).
Custom text — Sends the user's text back to the
planagent for further iteration.Why this approach is better than relying on compaction
The existing compaction system has fundamental limitations for the plan-to-implementation transition:
Information loss is uncontrolled — Compaction produces a generic summary of the entire conversation. When the context overflows mid-implementation, the summary may lose critical planning details (architecture decisions, gotchas, file locations) because the compaction prompt isn't aware that this was a planning-then-implementing workflow.
Delayed context recovery — With the old approach, the plan conversation consumes a large portion of the context window before implementation even begins. The agent would explore code, produce a plan, and then start coding — but by the time it starts coding, much of the context is already consumed by planning exploration. Compaction only triggers after overflow, meaning the agent may hit the wall mid-implementation.
Targeted handover vs. generic compaction — The
HANDOVER_PROMPTin this branch (plan-followup.ts:20-40) is specifically designed to extract implementation-relevant information that supplements the plan — discoveries, relevant files, pitfalls — while explicitly avoiding repeating the plan itself. This is a much more efficient use of context than a generic compaction summary.Clean context budget — By starting a fresh session, the implementation agent gets the full context window for actual coding work. The injected message (plan + handover + todos) is compact and purpose-built, rather than a lossy compression of an entire exploration conversation.
Todo continuity — The todo list is copied to the new session (
Todo.updateatplan-followup.ts:196-198), preserving task tracking across the session boundary.In short: instead of letting the context limiter reactively compress a mixed planning+implementation conversation (losing fidelity), this branch proactively creates a clean boundary between planning and implementation, carrying forward only the high-value information in a structured format.
Screenshots
How to Test
Start a planning session and look for the suggestions at the end.
Get in Touch
We'd love to have a way to chat with you about your changes if necessary. If you're in the Kilo Code Discord, please share your handle here.