Skip to content

Plan Mode

Plan Mode helps you break down complex tasks into manageable steps before writing code.

What is Plan Mode?

Plan Mode is MyDeskBot's feature that helps you think through complex coding tasks before implementation. It acts as a planning assistant, suggesting structured approaches, identifying potential issues, and creating step-by-step plans.

How Plan Mode Works

1. Task Analysis

MyDeskBot analyzes your task:

You: Create a REST API for user management with authentication

MyDeskBot breaks this down:
1. Understand requirements
2. Identify dependencies
3. Plan architecture
4. Define API endpoints
5. Plan data models
6. Design authentication
7. Create implementation steps
8. Plan testing strategy

2. Step-by-Step Planning

Creates a detailed plan:

Plan for User Management API:

Phase 1: Setup
├─ Initialize project
├─ Set up database
└─ Configure framework

Phase 2: Data Models
├─ Create User model
├─ Define schemas
└─ Set up migrations

Phase 3: Authentication
├─ Implement JWT auth
├─ Create auth middleware
└─ Add login/register endpoints

Phase 4: CRUD Endpoints
├─ GET /users
├─ GET /users/:id
├─ POST /users
├─ PUT /users/:id
└─ DELETE /users/:id

Phase 5: Testing
├─ Unit tests
├─ Integration tests
└─ API tests

3. Risk Assessment

Identifies potential issues:

Potential Issues:
1. Security: Password storage needs hashing
2. Performance: Pagination needed for GET /users
3. Validation: Input validation required
4. Error Handling: Consistent error responses
5. Documentation: API documentation needed

Activating Plan Mode

Method 1: Command Palette

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
  2. Type "MyDeskBot: Plan Mode"
  3. Select the command
  4. Describe your task

Method 2: Keyboard Shortcut

Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) to open Plan Mode.

Method 3: Right-Click

Right-click in the editor → "Plan with MyDeskBot"

Using Plan Mode

Example 1: Building a Feature

You: Plan a shopping cart feature

MyDeskBot creates a plan:

Shopping Cart Feature Plan

1. Requirements Analysis
   • Add items to cart
   • Update quantities
   • Remove items
   • Calculate totals
   • Persist cart state

2. Data Model
   • Cart entity
   • CartItem entity
   • Product reference

3. API Endpoints
   • GET /cart - Get current cart
   • POST /cart/items - Add item
   • PUT /cart/items/:id - Update quantity
   • DELETE /cart/items/:id - Remove item
   • POST /cart/checkout - Checkout

4. Implementation Order
   1. Create data models
   2. Implement cart service
   3. Create API endpoints
   4. Add validation
   5. Implement checkout
   6. Add tests

5. Testing Strategy
   • Unit tests for cart logic
   • Integration tests for API
   • End-to-end tests for checkout

Ready to start implementation?

Example 2: Refactoring

You: Plan refactoring the user service

MyDeskBot creates a plan:

Refactoring Plan: UserService

Current Issues:
1. Large function (500+ lines)
2. Mixed responsibilities
3. Hard to test
4. Poor error handling

Refactoring Steps:

Phase 1: Analysis
├─ Identify responsibilities
├─ Map dependencies
└─ Document current behavior

Phase 2: Extract
├─ Extract validation logic
├─ Extract data access
├─ Extract email sending
└─ Extract logging

Phase 3: Simplify
├─ Apply Single Responsibility
├─ Reduce complexity
└─ Improve naming

Phase 4: Test
├─ Add unit tests
├─ Ensure compatibility
└─ Performance check

Phase 5: Deploy
├─ Feature flag
├─ Monitor metrics
└─ Rollback plan

Estimated Time: 4-6 hours
Risk Level: Medium

Example 3: Debugging

You: Plan debugging the payment flow

MyDeskBot creates a plan:

Debug Plan: Payment Flow

Issue: Payments failing intermittently

Investigation Steps:

1. Gather Information
   ├─ Check error logs
   ├─ Identify failure patterns
   └─ Review recent changes

2. Reproduce Issue
   ├─ Test payment scenarios
   ├─ Capture exact errors
   └─ Note conditions

3. Hypothesis Generation
   ├─ Network timeout?
   ├─ API rate limit?
   ├─ Invalid data?
   └─ Race condition?

4. Testing Hypotheses
   ├─ Add logging
   ├─ Test with different conditions
   └─ Monitor in production

5. Fix Implementation
   ├─ Implement fix
   ├─ Add tests
   └─ Document change

6. Verification
   ├─ Test in staging
   ├─ Monitor production
   └─ Rollback if needed

Start with step 1: Gather Information

Plan Mode Features

1. Task Templates

Use pre-defined templates:

json
{
  "mydeskbot.planMode.templates": {
    "REST API": {
      "phases": ["Models", "API", "Auth", "Tests"]
    },
    "Refactoring": {
      "phases": ["Analyze", "Extract", "Simplify", "Test"]
    },
    "Bug Fix": {
      "phases": ["Investigate", "Hypothesize", "Fix", "Verify"]
    }
  }
}

2. Subtask Management

Break down tasks into subtasks:

Main Task: Create User API
├─ Create User Model
│  ├─ Define schema
│  ├─ Add validation
│  └─ Create migration
├─ Create User Service
│  ├─ CRUD operations
│  ├─ Business logic
│  └─ Error handling
└─ Create User Controller
   ├─ API endpoints
   └─ Request/response handling

3. Progress Tracking

Track your progress:

Shopping Cart Feature

[✅] Requirements Analysis
[✅] Data Model
[⏳] API Endpoints (2/5 done)
  [✅] GET /cart
  [✅] POST /cart/items
  [⏳] PUT /cart/items/:id
  [ ] DELETE /cart/items/:id
  [ ] POST /cart/checkout
[ ] Testing Strategy
[ ] Documentation

Progress: 40%

4. Alternative Approaches

Compare different approaches:

For cart persistence, you have options:

Option 1: Database
Pros:
• Persistent across sessions
• Works for all users
• Easy to query

Cons:
• Slower than memory
• Requires migrations
• More complex

Option 2: Redis
Pros:
• Fast
• Easy to use
• Built-in TTL

Cons:
• Data loss on restart
• Requires Redis server
• Additional cost

Option 3: Browser Storage
Pros:
• No server needed
• Instant access
• No cost

Cons:
• User-specific only
• Size limit
• Lost on clear cache

Recommendation: Option 2 (Redis) for performance + persistence balance

Configuration

Plan Mode Settings

json
{
  "mydeskbot.planMode": {
    "enabled": true,
    "autoSavePlans": true,
    "showProgress": true,
    "suggestAlternatives": true,
    "riskAssessment": true
  }
}

Custom Templates

Create your own templates:

json
{
  "mydeskbot.planMode.customTemplates": {
    "Microservice": {
      "phases": [
        "Design API",
        "Implement Service",
        "Add Database",
        "Create Tests",
        "Deploy"
      ]
    },
    "Feature Flag": {
      "phases": [
        "Add flag",
        "Implement feature",
        "Set percentage",
        "Monitor",
        "Clean up"
      ]
    }
  }
}

Best Practices

1. Be Specific

Provide clear requirements:

Good: Create a user API with JWT auth, rate limiting, and logging

Bad: Create user stuff

2. Review the Plan

Always review before implementing:

You: Plan the feature
[MyDeskBot creates plan]
You: Can you adjust step 3 to use caching?
[MyDeskBot updates plan]
You: OK, let's proceed

3. Iterate

Update the plan as you learn:

MyDeskBot: I discovered that we need email verification.
Should I add it to the plan?

You: Yes, add it after registration

4. Document Decisions

MyDeskBot documents your decisions:

Decision Log:
- Chose Redis for cart storage (performance vs complexity)
- Using JWT for auth (stateless, scalable)
- Rate limiting with Redis (already available)

Integration with Other Features

1. With Code Completion

Plan Mode: Creates the plan
Code Completion: Implements each step

2. With Code Review

Plan Mode: Designs the approach
Code Review: Validates implementation

3. With Continuous AI

Plan Mode: Sets the direction
Continuous AI: Helps execute

Keyboard Shortcuts

ActionShortcut
Open Plan ModeCtrl+Shift+P
Accept PlanEnter
Edit StepE
Delete StepD
Add SubtaskA
Show Next StepN

Exporting Plans

Export as Markdown

File → Export Plan → Markdown

Export as Checklist

File → Export Plan → Checklist

Share with Team

File → Export Plan → Share Link

See Also