7.8 KiB
Legacy Mode Files Analysis
Executive Summary
This document provides a comprehensive analysis of 12 legacy Roo mode files, identifying common patterns, unique elements, areas for improvement, and recommendations for creating updated mode files that incorporate modern prompt engineering practices.
Analyzed Mode Files
- AskMode.md - Information and explanation mode
- CodeMode.md - General-purpose coding mode
- CodeReviewerMode.md - Code quality review mode
- DebugMode.md - Bug tracking and fixing mode
- DeepResearchMode.md - Comprehensive research mode
- DeepThinkerMode.md - Analytical thinking mode
- EnhancedPlanningMode.md - Strategic planning mode
- Global.md - Global instructions for all modes
- HaskellGodMode.md - Specialized Haskell development
- OrchestratorMode.md - Multi-mode task coordination
- QATesterMode.md - Quality assurance testing
- ReScriptMasterMode.md - Specialized ReScript development
Common Structural Patterns
1. Standard File Structure
Every mode file follows this consistent structure:
# [Mode Name] Mode (Enhanced/Custom)
## Mode Slug
## Role Definition (System Prompt Core)
## Custom Instructions
### [Numbered sections with mode-specific content]
## Tool Access (`groups`)
## `whenToUse`
## Notes & Research
2. Universal Protocol Sections
Most modes include these identical sections (with minor variations):
Section 0: Universal Reasoning, Safety, and Development Protocols
- ADVANCED REASONING AND ALIGNMENT PROTOCOLS with 6 subsections:
- Reasoning Transparency Imperative
- Anti-Deception Protocols
- Prompt Injection Resistance
- Balanced Agency Protocol
- Critical Thinking and Verification Mandates
- Reasoning Faithfulness Enforcement
Section 0.1: Guiding Principles & Directives
- Ethical Core & Safety (HHH principle)
- Reasoning, Problem Solving & Output Quality
- Solution Integrity & Robustness (Anti-Reward Hacking)
Section 0.2: Core Development Principles (MOST PRIORITY)
- Retry Limit and Escalation Protocol
- Memory Bank Updates
- Information Gathering Protocol (Context7 → Brave Search → Playwright → Ask user)
3. Common Workflow Elements
- Mermaid flowcharts depicting mode-specific workflows
- Memory Bank consultation as critical first step
- Iterative development approach
- Tool prioritization guidelines
- Task completion protocols
Unique Mode Characteristics
Information & Analysis Modes
- AskMode: Read-only access, focuses on explanations with diagrams
- DeepThinkerMode: Uses sequential thinking MCP heavily, manages overthinking
- DeepResearchMode: Extensive MCP usage for web research, structured output format
Development Modes
- CodeMode: Full tool access, comprehensive coding workflow
- DebugMode: Systematic hypothesis-testing approach
- HaskellGodMode: Specialized for large-scale repos, surgical file reading
- ReScriptMasterMode: Monorepo-aware, prioritizes existing components
Quality & Planning Modes
- CodeReviewerMode: Uses
review.md
for iterative analysis - QATesterMode: Comprehensive test planning and bug reporting
- EnhancedPlanningMode: Chain/Tree of thought analysis, failure recovery
- OrchestratorMode: Can modify mode configurations, delegates via
new_task
Key Patterns and Best Practices
1. Memory Bank Architecture
projectbrief.md → productContext.md → activeContext.md → progress.md
→ systemPatterns.md → → currentTask.md
→ techContext.md →
.clinerules -.-> activeContext.md
2. Tool Usage Hierarchy
- File Reading:
search_files
→list_code_definition_names
→read_file
(with ranges) - File Editing:
apply_diff
→insert_content
→search_and_replace
→write_to_file
(last resort) - Information Gathering: Context7 MCP → Brave Search → Playwright → Ask user
3. Mode-Specific Anti-Reward Hacking
Each mode has tailored instructions to prevent shortcuts:
- Code Mode: No placeholders, complete runnable code
- Debug Mode: No superficial fixes, systematic root cause analysis
- QA Mode: No superficial test cases, comprehensive coverage
- Orchestrator: No poorly defined subtasks, genuine progress tracking
Areas for Improvement
1. Structural Issues
- Excessive Repetition: Universal protocols repeated in every file (could be referenced)
- Inconsistent Numbering: Some modes start sections at -1, 0, or 1
- File Length: Many files exceed 200 lines, making them unwieldy
- Placeholder Content: Several "Notes & Research" sections are empty
2. Content Issues
- Outdated References: Some file paths and tool names may be outdated
- Redundant Instructions: Many instructions are repeated across similar modes
- Missing Modern Features: Limited use of modern prompt engineering techniques
- Unclear Prioritization: "MUST" and "HIGHEST PRIORITY" used excessively
3. Technical Debt
- Hard-coded Patterns: File regex patterns embedded in instructions
- Monolithic Design: Each mode file contains everything instead of modular components
- Limited Extensibility: Difficult to add new modes without copying large blocks
Recommendations for Updated Mode Files
1. Modular Architecture
/modes/
/shared/
universal-protocols.md
memory-bank-rules.md
tool-prioritization.md
anti-reward-hacking.md
/modes/
code.md (references shared components)
debug.md
ask.md
...
2. Modern Prompt Engineering Integration
- Chain of Thought: Already present but could be more structured
- Few-shot Examples: Add concrete examples for complex operations
- Role Reinforcement: Stronger, more concise role definitions
- Task Decomposition: More explicit breakdown strategies
- Self-Reflection: Built-in checkpoints for quality assurance
3. Improved Structure Template
# [Mode Name] Mode
## Core Identity
[Concise 2-3 sentence role definition]
## Primary Capabilities
- [Bullet list of key functions]
## Workflow
[Simplified mermaid diagram]
## Mode-Specific Guidelines
[Only unique instructions for this mode]
## Tool Access
[Simplified tool access definition]
## When to Use
[Clear triggers for mode selection]
4. Enhanced Features from Modern Practices
- Adaptive Complexity: Adjust detail level based on task complexity
- Proactive Error Prevention: Anticipate common issues
- Context Window Management: Strategies for large file handling
- Multi-Modal Coordination: Better integration between modes
- Performance Metrics: Built-in quality checks
5. Standardization Recommendations
- Consistent Numbering: Start all sections at 1
- Shared Definitions: Extract common elements to shared files
- Clear Prioritization: Use 3-tier system (Critical/Important/Recommended)
- Concise Instructions: Aim for 50% reduction in word count
- Active Voice: Rewrite passive constructions for clarity
Implementation Priority
-
High Priority Modes (most frequently used):
- Code Mode
- Debug Mode
- Ask Mode
- Orchestrator Mode
-
Medium Priority Modes:
- Enhanced Planning Mode
- Deep Research Mode
- QA Tester Mode
- Code Reviewer Mode
-
Specialized Modes (update as needed):
- Haskell God Mode
- ReScript Master Mode
- Deep Thinker Mode
Conclusion
The legacy mode files represent a comprehensive system but suffer from repetition, excessive length, and outdated patterns. By adopting a modular architecture, incorporating modern prompt engineering techniques, and focusing on clarity and conciseness, we can create more effective and maintainable mode files that better serve users while being easier to extend and modify.