Agent Modes
Understanding and using different modes for specialized tasks
Dropstone Agent operates in different modes, each optimized for specific types of tasks. Think of modes as different "mindsets" the agent adopts to better handle your requests.
Overview of Modes
Mode | Best For | Key Features |
---|---|---|
Code | Writing and modifying code | File operations, refactoring, feature implementation |
Debug | Finding and fixing bugs | Root cause analysis, error investigation, fix verification |
Architect | System design and planning | Visual diagrams, architectural decisions, documentation |
Ask | Questions and learning | Explanations, research, code understanding |
Orchestrator | Complex multi-mode workflows | Task coordination, strategic planning, delegation |
Code Mode (Default)
Purpose: Building features, modifying code, and general development work.
When to Use
- Implementing new features
- Refactoring existing code
- Adding functionality to existing files
- Creating new components or modules
- General coding tasks
What It Does Well
✅ Creates and modifies files ✅ Understands project structure ✅ Applies learned patterns ✅ Generates tests automatically ✅ Validates changes with syntax/type checking
Example Interactions
Creating a New Feature:
You: "Add a user profile page with editable fields for name, email, and bio"
Agent: [Code Mode - Default]
"I'll create a user profile feature. Let me:
1. Create UserProfile component
2. Add form with validation
3. Connect to user API
4. Add update functionality
5. Include loading and error states
6. Generate tests"
[Creates multiple files, implements feature]
Refactoring Code:
You: "This UserService class has too many responsibilities.
Break it into smaller, focused services."
Agent: [Code Mode]
"I'll refactor UserService into:
- UserAuthService (authentication)
- UserProfileService (profile management)
- UserPreferencesService (settings)
- UserService (coordination)
Should I proceed?"
Adding Validation:
You: "Add input validation to all form components"
Agent: [Code Mode - High Confidence]
"Found 8 form components. Adding validation using your
established pattern (Yup schemas + custom error messages).
Working autonomously..."
[Adds validation to all forms, generates tests]
"Complete! All forms now have validation."
Tips for Code Mode
- Be specific about what you want to build
- Reference existing files for context
- Let the agent know if you have preferred libraries
- Provide examples of patterns you want to follow
Debug Mode
Purpose: Investigating and fixing bugs, errors, and unexpected behavior.
When to Use
- Application crashes or errors
- Unexpected behavior
- Test failures
- Performance issues
- Logic bugs
What It Does Well
✅ Generates multiple hypotheses for root cause ✅ Investigates data flow and state ✅ Traces errors through stack traces ✅ Proposes and validates fixes ✅ Adds defensive code to prevent recurrence
How It Works Differently
Code Mode:
- "Here's what you asked for"
- Implements straightforwardly
- Assumes requirements are clear
Debug Mode:
- "Let me investigate why this is happening"
- Generates multiple theories
- Tests hypotheses systematically
- Explains root cause before fixing
Example Interactions
Investigating a Crash:
You: "@mode debug
The app crashes when users upload files larger than 5MB"
Agent: [Debug Mode Activated]
"Investigating file upload crash. Let me check:
1. File upload handler
2. Memory limits
3. Server configuration
4. Error logs
Reading relevant files..."
[After analysis]
"Found the issue! Root cause analysis:
Primary Cause (90% confidence):
- No file size validation before upload
- Server default limit is 1MB (express default)
- Large files cause memory overflow
Contributing Factors:
- Missing error handling in upload route
- No user feedback during upload
Recommended fixes:
1. Add file size check on client (prevent upload)
2. Configure express fileSize limit
3. Add progress indicator
4. Improve error messages
Should I implement these fixes?"
Investigating Logic Error:
You: "@mode debug
Users are seeing negative prices in their shopping cart"
Agent: [Debug Mode]
"Investigating negative price issue.
Hypothesis Generation:
1. Discount calculation error (75% confidence)
2. Currency conversion issue (15% confidence)
3. Database corruption (5% confidence)
4. Race condition in cart updates (5% confidence)
Let me examine the discount calculation logic..."
[Reads files, traces data flow]
"Found it! In calculateDiscount():
- Discount percentage applied twice
- First in CartService.addItem()
- Again in CartService.calculateTotal()
This causes discounts over 50% to result in negative prices.
Example:
Item: $100, Discount: 60%
First application: $100 - $60 = $40
Second application: $40 - $60 = -$20
Fix: Remove duplicate discount application.
Location: src/services/CartService.ts:line 145
Should I apply the fix and add tests to prevent regression?"
Test Failure Investigation:
You: "@mode debug
Tests are failing after my changes to the auth system"
Agent: [Debug Mode]
"Analyzing test failures...
Failed Tests: 12 of 15 auth tests
Pattern detected: All failures related to token validation
Root Cause:
Your changes updated JWT token structure but tests
are using old token format.
Affected test files:
- auth.test.ts (8 tests)
- middleware.test.ts (4 tests)
Need to update:
1. Test token generation helpers
2. Mock JWT payloads
3. Token expiration expectations
I can fix all test mocks to match new format.
Proceed?"
Debug Mode Features
Multi-Hypothesis Debugging: Generates 5-7 potential causes with confidence scores
Evidence Collection:
- Stack trace analysis
- Data flow tracing
- State inspection
- Log analysis
Systematic Investigation:
- Read error messages/logs
- Generate hypotheses
- Test each theory
- Identify root cause
- Propose fix
- Verify fix doesn't break anything
Tips for Debug Mode
- Describe symptoms clearly (what happens, when, how often)
- Include error messages or stack traces
- Mention recent changes that might be related
- Use
@problems
to include VS Code errors - Use
@terminal
to include command output
Switching to Debug Mode
Automatic: Agent switches automatically when you describe errors:
"Users are getting a 500 error when they login"
[Agent automatically enters Debug Mode]
Manual:
@mode debug
[Describes problem]
Architect Mode
Purpose: System design, planning, and architectural decisions.
When to Use
- Designing new systems or features
- Planning database schemas
- Creating system architecture
- Making architectural decisions
- Documenting system structure
What It Does Well
✅ Creates visual diagrams (Mermaid) ✅ Plans system architecture ✅ Documents design decisions ✅ Considers scalability and maintainability ✅ Proposes multiple architectural options
Example Interactions
Designing a New Feature:
You: "@mode architect
Help me design a notification system for our app"
Agent: [Architect Mode]
"Let me help design a notification system.
First, some questions:
1. What types of notifications? (Email, push, in-app, SMS?)
2. Scale expectations? (Users, notifications per day?)
3. Delivery requirements? (Real-time, scheduled, batched?)
4. Existing infrastructure? (Message queue, email service?)
[After your answers]
"Proposed Architecture:
## System Overview
```mermaid
graph TB
A[App Events] --> B[Notification Service]
B --> C{Notification Type}
C -->|Email| D[Email Queue]
C -->|Push| E[Push Queue]
C -->|In-App| F[WebSocket Server]
D --> G[Email Provider]
E --> H[FCM/APNS]
F --> I[Connected Clients]
Components
-
Notification Service
- Event listener
- Route notifications
- Apply user preferences
- Handle failures
-
Queue System (Redis/RabbitMQ)
- Reliable delivery
- Rate limiting
- Retry logic
- Priority handling
-
Delivery Channels
- Email (SendGrid/AWS SES)
- Push (FCM for Android, APNS for iOS)
- In-app (WebSockets)
-
User Preferences
- Per-channel settings
- Quiet hours
- Notification frequency
Database Schema
erDiagram
User ||--o{ NotificationPreference : has
User ||--o{ Notification : receives
Notification ||--|| NotificationTemplate : uses
User {
uuid id
string email
string phoneNumber
}
NotificationPreference {
uuid id
uuid userId
string channel
boolean enabled
json settings
}
Notification {
uuid id
uuid userId
string type
string status
timestamp sentAt
json data
}
Implementation Phases
Phase 1: Core System (Week 1)
- Notification service
- Database models
- Email notifications
- Basic templates
Phase 2: Additional Channels (Week 2)
- Push notifications
- In-app notifications
- User preferences API
Phase 3: Advanced Features (Week 3)
- Scheduling
- Batching
- Analytics
- A/B testing
Would you like me to start implementing Phase 1?"
**Database Design:**
You: "@mode architect Design a database schema for a blog platform"
Agent: [Architect Mode] "Designing blog platform database schema.
Requirements clarification:
- User roles? (Admin, author, reader?)
- Comments? Nested or flat?
- Tags/categories?
- Draft/published workflow?
- Media attachments?
[After clarification]
Entity Relationship Diagram
erDiagram
User ||--o{ Post : writes
User ||--o{ Comment : writes
Post ||--o{ Comment : has
Post }o--o{ Tag : tagged_with
Post }o--o{ Category : belongs_to
Post ||--o{ PostRevision : has_revisions
User {
uuid id PK
string email UK
string username UK
string passwordHash
enum role
timestamp createdAt
}
Post {
uuid id PK
uuid authorId FK
string title
string slug UK
text content
enum status
timestamp publishedAt
timestamp createdAt
timestamp updatedAt
}
Comment {
uuid id PK
uuid postId FK
uuid authorId FK
uuid parentId FK
text content
timestamp createdAt
}
Tag {
uuid id PK
string name UK
string slug UK
}
Category {
uuid id PK
string name UK
string slug UK
uuid parentId FK
}
Schema Decisions
-
UUIDs vs Integer IDs
- Chose UUIDs for distributed system compatibility
- Better for API security (non-sequential)
-
Comment Threading
- Self-referencing parentId
- Allows unlimited nesting
- Query complexity managed with materialized path
-
Post Revisions
- Track all changes
- Enable draft/publish workflow
- Support rollback
-
Soft Deletes
- Add deletedAt timestamp
- Preserve data for audit
- Enable "undelete" feature
Indexes
-- Performance critical indexes
CREATE INDEX idx_posts_author ON posts(authorId);
CREATE INDEX idx_posts_status_published ON posts(status, publishedAt);
CREATE INDEX idx_comments_post ON comments(postId);
CREATE INDEX idx_comments_author ON comments(authorId);
Ready to implement?"
**System Planning:**
You: "@mode architect We need to handle 10x more traffic. How should we scale?"
Agent: [Architect Mode] "Analyzing current architecture for scaling...
Current Bottlenecks:
- Database: Single instance, no read replicas
- API: Monolithic, runs on single server
- Static assets: Served from same server
- No caching layer
Scaling Strategy
Phase 1: Quick Wins (1-2 weeks)
graph LR
A[Load Balancer] --> B[API Server 1]
A --> C[API Server 2]
A --> D[API Server 3]
B --> E[Database Primary]
C --> E
D --> E
E --> F[Read Replica 1]
E --> G[Read Replica 2]
H[CDN] --> I[Static Assets]
- Add load balancer
- Scale horizontally (3 API servers)
- Add database read replicas
- Move static assets to CDN
Expected: 5-7x capacity increase
Phase 2: Caching (2-3 weeks)
- Add Redis for session/cache
- Implement query caching
- Add CDN for API responses
- Use browser caching
Expected: Additional 2-3x efficiency
Phase 3: Microservices (1-2 months)
- Split monolith into services
- Separate high-traffic endpoints
- Independent scaling per service
Would you like detailed implementation steps for Phase 1?"
### Architect Mode Features
**Visual Diagrams:**
- System architecture diagrams
- Database schemas (ERD)
- Sequence diagrams
- Component relationships
**Planning:**
- Phased implementation plans
- Risk assessment
- Trade-off analysis
- Technology recommendations
**Documentation:**
- Design decisions
- Architectural patterns
- Best practices
- Migration strategies
### Tips for Architect Mode
- Describe requirements clearly
- Mention scale/performance needs
- Discuss existing constraints
- Ask for multiple options
- Request diagrams for complex systems
---
## Ask Mode
**Purpose:** Getting explanations, learning, and understanding code.
### When to Use
- Understanding unfamiliar code
- Learning new concepts
- Researching approaches
- Getting documentation
- Exploring alternatives
### What It Does Well
✅ Explains code clearly
✅ Researches solutions
✅ Provides examples
✅ Links to documentation
✅ Compares alternatives
### Example Interactions
**Understanding Code:**
You: "@mode ask @src/hooks/useAuth.ts What does this hook do and how should I use it?"
Agent: [Ask Mode] "The useAuth hook manages authentication state. Let me break it down:
What It Does
-
Authentication State
- Tracks if user is logged in
- Stores user information
- Manages auth token
-
Key Functions
- login(email, password) - Authenticate user
- logout() - Clear session
- refreshToken() - Renew authentication
- checkAuth() - Verify current auth status
How to Use
Basic Usage
import { useAuth } from '@/hooks/useAuth';
function MyComponent() {
const { user, isAuthenticated, login, logout } = useAuth();
if (!isAuthenticated) {
return <LoginForm onLogin={login} />;
}
return (
<div>
<h1>Welcome, {user.name}!</h1>
<button onClick={logout}>Logout</button>
</div>
);
}
With Loading States
const { user, isAuthenticated, isLoading, login } = useAuth();
if (isLoading) {
return <Spinner />;
}
Behind the Scenes
The hook uses:
- React Context for state management
- LocalStorage for token persistence
- Automatic token refresh
- Request interceptor for API calls
Common Patterns
✅ DO: Check isAuthenticated before showing protected content ✅ DO: Handle isLoading state ✅ DO: Catch login errors
❌ DON'T: Store sensitive data in user object ❌ DON'T: Manually manage tokens
Need help implementing authentication in your component?"
**Learning Concepts:**
You: "@mode ask What's the difference between useMemo and useCallback?"
Agent: [Ask Mode] "Great question! Both are React optimization hooks, but they memoize different things.
useMemo
Purpose: Memoizes a computed VALUE
Use When:
- Expensive calculations
- Complex computations
- Derived data
Example:
const expensiveValue = useMemo(() => {
return complexCalculation(data);
}, [data]);
Without useMemo, complexCalculation runs every render. With useMemo, it only runs when 'data' changes.
useCallback
Purpose: Memoizes a FUNCTION
Use When:
- Passing callbacks to optimized child components
- Functions in dependency arrays
- Event handlers for memoized components
Example:
const handleClick = useCallback(() => {
doSomething(value);
}, [value]);
Without useCallback, new function created every render. With useCallback, same function reference unless 'value' changes.
Key Differences
Feature | useMemo | useCallback |
---|---|---|
Returns | Value | Function |
Use for | Computed results | Event handlers |
Example | Filtered list | onClick handler |
When to Use
useMemo
// Filtering large array
const filteredUsers = useMemo(() =>
users.filter(u => u.age > 18),
[users]
);
useCallback
// Callback for child component
const handleDelete = useCallback((id) => {
deleteUser(id);
}, [deleteUser]);
return <UserList onDelete={handleDelete} />;
Common Mistake
// ❌ Unnecessary - too simple
const sum = useMemo(() => a + b, [a, b]);
// ✅ Good - expensive operation
const primes = useMemo(() =>
findPrimes(largeNumber),
[largeNumber]
);
Need examples for your specific use case?"
**Researching Solutions:**
You: "@mode ask What's the best way to handle file uploads in Express?"
Agent: [Ask Mode] "Let me research file upload solutions for Express...
[Researches Stack Overflow, docs, GitHub]
Popular Solutions
1. Multer (Most Popular)
Pros:
- Official Express middleware
- 11k+ GitHub stars
- Handles multipart/form-data
- Memory & disk storage
- File filtering
Example:
const multer = require('multer');
const upload = multer({ dest: 'uploads/' });
app.post('/upload', upload.single('file'), (req, res) => {
console.log(req.file); // uploaded file info
res.send('File uploaded');
});
2. Formidable
Pros:
- Fast
- Handles large files well
- Progress events
- No dependencies
Example:
const formidable = require('formidable');
app.post('/upload', (req, res) => {
const form = formidable({ uploadDir: './uploads' });
form.parse(req, (err, fields, files) => {
// handle upload
});
});
3. Busboy (Lower-level)
Pros:
- Fast streaming parser
- More control
- Smaller footprint
Recommendation
For your use case: Multer
Reasons:
- Your project already uses Express middleware pattern
- Need file type validation (Multer has this built-in)
- Want to limit file size (Multer.limits)
- Most active community support
Implementation Example
const multer = require('multer');
// Configure storage
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/')
},
filename: function (req, file, cb) {
cb(null, Date.now() + '-' + file.originalname)
}
});
// Configure upload
const upload = multer({
storage: storage,
limits: {
fileSize: 5 * 1024 * 1024 // 5MB
},
fileFilter: function (req, file, cb) {
// Only allow images
if (!file.mimetype.startsWith('image/')) {
return cb(new Error('Only images allowed'));
}
cb(null, true);
}
});
// Use in route
app.post('/upload', upload.single('avatar'), (req, res) => {
res.json({
success: true,
file: req.file
});
});
Want me to implement this in your project?"
### Ask Mode Features
**Clear Explanations:**
- Step-by-step breakdowns
- Visual examples
- Comparisons
- Best practices
**Research Capabilities:**
- Web search
- Documentation lookup
- GitHub examples
- Stack Overflow solutions
**Learning-Focused:**
- No file modifications
- Read-only mode
- Safe to ask anything
- Encourages exploration
### Tips for Ask Mode
- Ask specific questions
- Provide context about your project
- Request examples
- Ask for comparisons ("X vs Y")
- Don't hesitate to ask follow-ups
---
## Orchestrator Mode
**Purpose:** Coordinating complex workflows that involve multiple modes.
### When to Use
- Complex projects requiring multiple approaches
- Tasks that need planning + execution
- Multi-phase implementations
- Cross-cutting concerns
### What It Does Differently
**Regular Modes:**
- Focus on specific task type
- Single approach
- Direct execution
**Orchestrator Mode:**
- Coordinates multiple modes
- Strategic planning
- Delegates to appropriate modes
- Synthesizes results
### Example Interactions
**Complex Migration:**
You: "@mode orchestrator Migrate our app from JavaScript to TypeScript"
Agent: [Orchestrator Mode] "This is a complex migration. Let me coordinate this systematically.
Migration Strategy
Phase 1: Planning (Architect Mode)
Switching to Architect Mode...
[Creates migration plan with phases]
Phase 2: Setup (Code Mode)
Switching to Code Mode...
[Configures TypeScript, adds tsconfig.json]
Phase 3: Type Definitions (Code Mode)
[Creates interface files, type definitions]
Phase 4: File Conversion (Code Mode)
Converting files in order of dependencies:
- Utility functions (no dependencies)
- Models and types
- Services
- Components
- Pages
Progress: 45% (23/51 files)
Phase 5: Error Resolution (Debug Mode)
Switching to Debug Mode for type errors...
[Fixes type errors systematically]
Phase 6: Testing (Code Mode)
[Updates tests, runs test suite]
Phase 7: Documentation (Architect Mode)
[Updates README, adds migration notes]
Migration Complete!
- 51 files converted
- 0 type errors
- All tests passing
- Documentation updated"
**Full-Stack Feature:**
You: "@mode orchestrator Build a complete analytics dashboard"
Agent: [Orchestrator Mode] "Building analytics dashboard. This requires:
- Architecture planning
- Backend API
- Frontend dashboard
- Testing
Let me coordinate...
Phase 1: Architecture
[Architect Mode] Designed system architecture:
- REST API for metrics
- PostgreSQL for storage
- React dashboard
- Chart.js for visualization
Phase 2: Backend Implementation
[Code Mode] Created:
- Database schema
- API endpoints (5 endpoints)
- Data aggregation service
- Authentication middleware
Phase 3: Frontend Implementation
[Code Mode] Created:
- Dashboard layout
- Chart components
- Data fetching hooks
- Loading/error states
Phase 4: Integration & Testing
[Debug Mode + Code Mode]
- Tested API endpoints
- Fixed CORS issues
- Added error handling
- Generated test suite
Phase 5: Documentation
[Ask Mode]
- API documentation
- Component documentation
- Setup instructions
Complete! Dashboard ready at /dashboard"
### Orchestrator Mode Features
**Strategic Coordination:**
- Breaks down complex projects
- Delegates to specialized modes
- Maintains context across modes
- Synthesizes results
**Progress Tracking:**
- Shows current phase
- Mode being used
- Completion percentage
- Next steps
**Adaptive Planning:**
- Adjusts plan based on findings
- Handles unexpected issues
- Reprioritizes as needed
### Tips for Orchestrator Mode
- Use for genuinely complex projects
- Trust the agent to coordinate
- Review plans before full execution
- Provide feedback between phases
---
## Switching Between Modes
### Automatic Mode Switching
The agent often switches modes automatically based on your request:
"Fix the login bug" → Debug Mode "Add a new feature" → Code Mode "How does this work?" → Ask Mode "Design a system" → Architect Mode
### Manual Mode Switching
Force a specific mode:
@mode debug @mode code @mode architect @mode ask @mode orchestrator
### Mid-Conversation Switching
You: [In Code Mode] "Actually, before we implement this, let's plan it out first" @mode architect
Agent: "Switching to Architect Mode. Let me design this first..."
---
## Mode Comparison
### By Speed
**Fastest:** Code Mode (high confidence tasks)
**Fast:** Ask Mode (read-only)
**Medium:** Debug Mode (investigation takes time)
**Slower:** Architect Mode (thorough planning)
**Slowest:** Orchestrator Mode (coordinates multiple phases)
### By Autonomy
**Most Autonomous:** Code Mode (with learned patterns)
**Moderate:** Debug Mode (needs to investigate)
**Less Autonomous:** Architect Mode (needs decisions)
**Interactive:** Ask Mode (question/answer)
**Coordinating:** Orchestrator Mode (manages other modes)
### By File Modifications
**Heavy Modifications:** Code Mode, Orchestrator Mode
**Targeted Modifications:** Debug Mode
**No Modifications:** Ask Mode
**Creates Documentation:** Architect Mode
---
## Best Practices
### 1. Let Agent Choose Mode
Unless you have a specific reason, let the agent auto-select:
✅ "The login isn't working" (Agent selects Debug Mode)
❌ "@mode code The login isn't working" (Wrong mode for debugging)
### 2. Switch When Needed
If the agent isn't approaching the problem right:
"Actually, I don't want you to implement yet. Let's design this first. @mode architect"
### 3. Use Orchestrator for Big Projects
✅ "@mode orchestrator Migrate to microservices" ❌ "@mode code Migrate to microservices" (Too complex for single mode)
### 4. Ask Mode for Learning
✅ "@mode ask Explain how this authentication works" ❌ "@mode code Explain how this authentication works" (Ask mode better for explanations)
### 5. Debug Mode for Problems
✅ "@mode debug Users can't upload files" ✅ "@mode debug Why is this test failing?" ✅ "@mode debug The app is slow"
---
## Troubleshooting Modes
### "Agent is in wrong mode"
**Switch manually:**
@mode [correct_mode]
### "Agent keeps switching modes"
**This is normal for complex tasks.** Orchestrator mode does this intentionally.
### "Mode isn't working as expected"
**Try being more specific:**
Instead of: "Fix this" Try: "@mode debug This function returns unexpected values"
---
## Next Steps
- Learn about [How to Use](./how-to-use) for practical examples
- Read [Best Practices](../agent-guide/best-practices) for expert tips
- See [Examples](./examples) for real-world mode usage
- Explore [AGI Capabilities](../agent-guide/agi-capabilities) for advanced features
---
*Modes help the agent think differently about your problem. Choose the right tool for the job, or let the agent decide!*