Skip to content

feat: Add predefined suggestions after finishing the planning session#459

Open
alex-alecu wants to merge 11 commits intodevfrom
feat/suggestions-after-plan-end
Open

feat: Add predefined suggestions after finishing the planning session#459
alex-alecu wants to merge 11 commits intodevfrom
feat/suggestions-after-plan-end

Conversation

@alex-alecu
Copy link
Contributor

@alex-alecu alex-alecu commented Feb 19, 2026

Context

Following the example from Claude Code after a planning session:

Screenshot 2026-02-19 at 10 27 48

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

Added plan follow-up flow in plan-followup.ts (line 25).

  • Added plan follow-up flow in /Users/alex/Documents/code/kilo-code/kilo/packages/opencode/src/kilocode/plan-followup.ts:25.

    • Asks Ready to implement?
    • Handles Start new session, Continue here, and custom text
    • Injects synthetic user messages using the same pattern as plan tools
    • Publishes TuiEvent.SessionSelect and starts the new session loop for the new-session path
  • Wired it into the existing loop break point in /Users/alex/Documents/code/kilo-code/kilo/packages/opencode/src/session/prompt.ts:335 with kilocode_change markers.

    • If plan agent just finished, it now calls PlanFollowup.ask(...)
    • continue re-enters the loop when needed; otherwise it exits as before
  • Added tests in /Users/alex/Documents/code/kilo-code/kilo/packages/opencode/test/kilocode/plan-followup.test.ts:95.

    • Covered dismissed, continue here, custom text, start new session, empty assistant text, aborted signal, and blank custom answer

Screenshots

Screenshot 2026-02-19 at 10 39 06

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.

@alex-alecu alex-alecu self-assigned this Feb 19, 2026
@vercel
Copy link

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kilo-ui-storybook Ready Ready Preview, Comment Feb 19, 2026 0:10am

Request Review

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Feb 19, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The PR introduces a plan follow-up feature that prompts users after the plan agent completes, offering options to start a new session, continue in the current session, or provide custom follow-up text. The implementation is clean and well-structured:

  • Abort handling is properly implemented via Question.reject + RejectedError catch pattern, with correct cleanup of event listeners.
  • Circular dependency between prompt.ts and plan-followup.ts is avoided via dynamic import() in startNew.
  • Context extraction (extractContext) correctly deduplicates file reads, strips <task_result> tags, and truncates at the character limit with clean line-boundary truncation.
  • Type narrowing in isTool guard properly narrows ToolPart to the completed state variant.
  • Test coverage is comprehensive with 14 tests covering all code paths: dismiss, continue, custom text, new session, empty text, abort (pre and mid-question), blank answers, and all extractContext edge cases.

All existing review comments have been addressed by the author.

Files Reviewed (3 files)
  • packages/opencode/src/kilocode/plan-followup.ts - New file, 204 lines. Core plan follow-up logic.
  • packages/opencode/src/session/prompt.ts - 10-line integration point in the session loop.
  • packages/opencode/test/kilocode/plan-followup.test.ts - New file, 555 lines. Comprehensive test suite.

…ummary of what was explored and which files were read so the AI doesn't have to re-search the codebase.
Comment on lines +66 to +74
const sections = [] as string[]
if (tasks.length) {
sections.push("### Explored\n\n" + tasks.join("\n\n"))
}
if (files.length) {
sections.push("### Files read\n\n" + files.join("\n"))
}

const full = "\n\n## Context from planning research\n\n" + sections.join("\n\n")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not really sure what this is doing? Is this user output we need to later localize?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we start a new session just with the plan, the coding agent will do some research first to make sure it understands the plan.

By providing a small amount of research context from the planning agent we reduce drastically the research the new coding agent needs to make.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What if the beginning of the research for the plan wasn't valuable? What CC actually does instead they reference the most important files that are relevant on compaction instead. I would question if the first 10k characters have always high entropy.

@vercel vercel bot temporarily deployed to Preview – kilo-ui-storybook February 19, 2026 11:30 Inactive
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.

2 participants

Comments