Skip to content

Conversation

@Avtrkrb
Copy link
Member

@Avtrkrb Avtrkrb commented Jan 17, 2026

Description

This PR implements Plan Mode - a structured 5-phase planning workflow for thoughtful code changes, along with the Interactive Questions System that allows the AI to ask user questions through a keyboard-navigable terminal UI.

Key Features

1. Plan Mode (5-Phase Workflow)

  • Understanding Phase - Gather requirements and clarify scope
  • Design Phase - Explore approaches and identify relevant files
  • Review Phase - Consolidate findings and prepare final plan
  • Final Plan Phase - Create executable task list
  • Exit Phase - Complete planning and present for user approval

2. Interactive Questions System

  • ask_user_question tool with Claude Code-compatible schema
  • Supports 1-4 questions with 2-4 options each
  • Keyboard-navigable UI with progress indicators
  • Multi-select and custom input ("Other" option) support
  • Callback registry pattern for tool-to-UI communication

3. Mode Selection UI

  • Interactive prompt for selecting implementation mode after plan approval
  • Options: "Accept plan (Normal Mode)", "Accept plan (Auto-Accept Mode)", "Modify Plan"
  • Keyboard navigation with visual feedback

Technical Implementation

New Files Created:

  • source/components/interactive-question-prompt.tsx - UI for question prompt
  • source/components/mode-selection-prompt.tsx - UI for mode selection
  • source/components/plan-mode-indicator.tsx - Shows current plan phase
  • source/components/plan-review-prompt.tsx - UI for reviewing/modifying plans
  • source/tools/interactive/ask-user-question.tsx - Core tool implementation
  • source/tools/plan/enter-plan-mode.tsx - Tool to enter plan mode
  • source/tools/plan/exit-plan-mode.tsx - Tool to exit plan mode
  • source/utils/question-selection-registry.ts - Callback registry for questions
  • source/utils/mode-selection-registry.ts - Callback registry for mode selection
  • source/utils/plan/plan-prompt.ts - Phase-specific AI instructions
  • source/utils/plan/phase-transition-detector.ts - Detects phase transitions
  • source/utils/plan/slug-generator.ts - Generates plan IDs
  • source/utils/plan-review-registry.ts - Callback registry for plan review
  • source/services/plan-manager.ts - Manages plan file operations
  • source/context/mode-context.ts - Global mode context management

Modified Files:

  • source/app/App.tsx - Integrated all new modes and callbacks
  • source/hooks/useAppState.tsx - Added mode and prompt state
  • source/tools/index.ts - Registered new tools
  • source/tools/tool-manager.ts - Added plan mode tool restrictions
  • source/tools/execute-bash.tsx - Added plan mode checks
  • source/tools/string-replace.tsx - Added plan mode checks
  • source/tools/write-file.tsx - Added plan mode checks

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Note: Test coverage will be added in a follow-up PR. This PR focuses on feature implementation.

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Manual Testing Performed:

  1. Plan Mode workflow (all 5 phases complete automatically)
  2. ask_user_question tool with single and multiple questions
  3. Mode selection UI (Normal, Auto-Accept, Modify Plan)
  4. Phase transitions happen automatically without stopping
  5. Plan file creation at .nanocoder/plans/{planId}.md

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging

Documentation Note: Updates to AGENTS.md and user documentation will be added in a follow-up PR.


Closes: #96 (Interactive Questions System) & #205 (Enhanced Plan Mode)

Related: Plan Mode feature request

@Avtrkrb
Copy link
Member Author

Avtrkrb commented Jan 17, 2026

@will-lamerton This PR introduces enhancements to Plan mode proposed in #205 & #96

Prompt that I used to test:

Analyze the codebase. Currently when any text is copy pasted in the user chat input area, it is rendered/displayed in [] brackets & the actual content that was copy pasted is not displayed. Why is this behavior observed ?
Additionally pressing the "Home" & "End" keys in the keyboard does not take the cursor to either the start or end of the line respectively as is supposed to be the expected behavior. If you have any questions, always ask me

@Avtrkrb Avtrkrb marked this pull request as draft January 17, 2026 13:54
@Avtrkrb
Copy link
Member Author

Avtrkrb commented Jan 17, 2026

@will-lamerton I'm attempting to modify this so that we can add a bit of spec driven plans.

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.

2 participants