Skip to content

Feature: Adding Auto-Accept and Plan Mode #26

@will-lamerton

Description

@will-lamerton

Adding Auto-Accept and Plan Mode to Nanocoder

Description

This document outlines the proposal for adding two new operational modes to Nanocoder: Auto-Accept Mode and Plan Mode. These modes aim to enhance user control over tool execution and improve the AI's reasoning capabilities by separating planning and action phases.

Auto-Accept Mode

Overview

Auto-accept mode allows Nanocoder to automatically accept and execute all tool calls without user intervention. This is useful for batch operations or when the user trusts the AI to perform a series of actions autonomously.

Features

  • Automatic approval of all function calls
  • Configurable confirmation for high-risk operations (optional)
  • Logging of all actions taken for transparency
  • Ability to pause or disable the mode at any time

Use Case

  • Processing multiple files in bulk
  • Automated data migration tasks
  • When working in a trusted development environment

Plan Mode

Overview

Plan mode initiates a pure reasoning phase where Nanocoder cannot execute any tool calls. During this mode, the AI focuses exclusively on analysis, planning, and strategy without performing actions. This helps in creating detailed execution plans before actual implementation.

Features

  • Complete suppression of tool calls
  • Enhanced reasoning capabilities for complex problems
  • Output structured plans in markdown format
  • Transition to execution mode when plan is finalized

Use Case

  • Complex refactoring tasks requiring detailed planning
  • Multi-step feature implementations
  • Strategic code review and analysis

Implementation Details

Code Changes Required

Core Modifications

  1. State Management: Add mode tracking to the Nanocoder state management system
  2. Tool Call Handling: Modify tool execution pipeline to respect mode restrictions
  3. UI/UX Updates: Add CLI commands to enable/disable modes and visual indicators

Files to Modify

  • src/core/agent.ts - Add mode management logic
  • src/cli/commands.ts - Add mode switching commands
  • src/tools/executor.ts - Implement tool call gating based on mode

Step-by-Step Development Workflow

  1. Create a feature branch:

    git checkout -b feature/auto-accept-plan-modes
  2. Implement mode state management:

    • Define mode types (normal, auto-accept, plan)
    • Add mode persistence/configuration
    • Implement mode switching logic
  3. Modify tool execution:

    • Add pre-execution checks for plan mode
    • Implement automatic approval for auto-accept mode
    • Add logging for transparency
  4. Update CLI interface:

    • Implement Shift+Tab key binding for cycling through modes (Normal -> Auto-Accept -> Plan -> Normal)
    • Display current mode in prompt
    • Add mode status indicators
    • Ensure key binding works at any time during interaction
  5. Remove mode commands (deprecated):

    • Instead of dedicated commands, rely on the key binding for seamless mode switching

Testing

Manual Testing Scenarios

  1. Auto-Accept Mode Testing:

    • Test batch file operations
    • Verify logging of actions
    • Test pause/disable functionality
    • Confirm safety measures for risky operations
  2. Plan Mode Testing:

    • Verify no tool calls are allowed
    • Test plan generation and output
    • Check transition between modes
    • Ensure reasoning quality improvements
  3. Edge Cases:

    • Mode conflicts
    • Error handling during mode switches
    • Recovery from interrupted operations

Integration Testing

  • Test with different AI providers (Ollama, OpenRouter, OpenAI-compatible)
  • MCP server integration with modes enabled
  • Cross-platform compatibility

Coding Standards Compliance

  • Follow existing TypeScript guidelines with strict typing
  • Use conventional commit messages (feat: add auto-accept mode)
  • Maintain consistent code style and file organization
  • Add comprehensive error handling

Pull Request Checklist

  • Mode state management implemented
  • Tool call gating working correctly
  • CLI commands added and tested
  • Manual testing completed for both modes
  • Documentation updated (README, CLI help)
  • No breaking changes introduced
  • Existing tests pass

Benefits

  1. Enhanced Productivity: Auto-accept mode speeds up repetitive tasks
  2. Improved Planning: Plan mode enables better problem-solving before execution
  3. User Control: Users can choose the right mode for their workflow
  4. Safety: Modes prevent unintended actions while providing flexibility

Risk Assessment

  • Low Risk: Both modes are additive features that don't affect default behavior
  • Mitigation: Include safety nets, logging, and easy mode switching
  • Backward Compatibility: Default mode remains "normal" operation

Future Enhancements

  • Hybrid mode combining elements of both
  • User-configurable exceptions in auto-accept mode
  • Integration with debugging tools in plan mode
  • API endpoints for mode management

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions