Operational Modes System - Technical Documentation#
Overview#
The Operational Modes system is Marcusβs intelligent mode-switching architecture that adapts its behavior based on board state, user intent, and project context. It implements three distinct operational modes (Creator, Enricher, Adaptive) that each handle different stages of project management, from initial project generation to intelligent task coordination.
System Architecture#
Core Components#
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Operational Modes System β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Creator Mode β β Enricher Mode β β Adaptive Mode β β
β β β β β β β β
β β β’ Template Lib β β β’ Task Enricher β β β’ Dependency β β
β β β’ Task Gen β β β’ Board Org β β Resolution β β
β β β’ Project Types β β β’ Metadata β β β’ Skill Match β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β β β β
β βββββββββββ¬ββββββββββββ΄ββββββββββ¬ββββββββββββ β
β β β β
β βββββββββββββββββββ βββββββββββββββββββ β
β β Mode Registry β β Context Detectorβ β
β β β β β β
β β β’ Mode Switchingβ β β’ Board Analysisβ β
β β β’ State Persist β β β’ Intent Detect β β
β β β’ History Track β β β’ Mode Recommendβ β
β βββββββββββββββββββ βββββββββββββββββββ β
β β β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Hybrid Tools (MCP) β β
β β β β
β β β’ API Gateway β β
β β β’ Tool Definitions β β
β β β’ Cross-Mode Operations β β
β βββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Key Design Principles#
Context-Aware Switching: Modes switch automatically based on board state analysis
State Persistence: Each mode maintains state across switches
Dependency-Driven Logic: Prevents illogical task assignments (e.g., deployment before development)
Template-Based Generation: Standardized project structures with customization
Intelligent Coordination: Skills-based task assignment with dependency respect
Mode Definitions#
1. Creator Mode (src/modes/creator/)#
Purpose: Generate structured projects from templates or descriptions to prevent chaotic task creation.
Core Problem Solved: Eliminates the βDeploy to productionβ before any code exists scenario by generating properly ordered, dependency-aware task structures.
Components:
BasicCreatorMode: Main orchestrator for project generation
TaskGenerator: Converts templates into Task objects with proper dependencies
TemplateLibrary: Pre-built project templates (WebApp, API, Mobile)
Key Features:
Template System: Three built-in templates (Web, API, Mobile) with configurable project sizes (MVP β Enterprise)
Dependency Resolution: Automatic dependency detection between tasks based on logical patterns
Size Scaling: Task estimates automatically adjust based on project complexity
Phase Organization: Tasks organized into logical development phases
Technical Implementation:
# Template structure with dependency patterns
LOGICAL_DEPENDENCY_PATTERNS = [
{
'pattern': r'(setup|init|configure)',
'blocks_until_complete': r'(implement|build|test|deploy)'
},
{
'pattern': r'(implement|build)',
'blocks_until_complete': r'(test|deploy)'
}
]
Project Size Multipliers:
MVP: 0.5x base estimates
Small: 0.7x
Medium: 1.0x (baseline)
Large: 1.5x
Enterprise: 2.0x
2. Enricher Mode (src/modes/enricher/)#
Purpose: Transform chaotic existing boards into organized, metadata-rich structures.
Core Problem Solved: Takes existing poorly-defined tasks and adds structure, dependencies, estimates, and organization without losing existing work.
Components:
BasicEnricher: Simple pattern-based task improvement
TaskEnricher: Advanced metadata generation with board context
BoardOrganizer: Multiple organization strategies (phase, component, feature, priority)
Key Features:
Task Classification: Automatic categorization using regex patterns and keywords
Metadata Generation: Adds descriptions, estimates, labels, acceptance criteria
Organization Strategies: Multiple ways to structure boards with confidence scoring
Dependency Inference: Suggests logical dependencies based on task content
Technical Implementation:
# Task pattern recognition for enrichment
task_patterns = {
'backend': {
'patterns': [r'api', r'server', r'backend', r'endpoint'],
'base_hours': 8,
'labels': ['backend', 'api'],
'typical_dependencies': ['design']
}
}
Organization Strategies:
Phase-based: Planning β Development β Testing β Deployment
Component-based: Frontend, Backend, Database, Infrastructure
Feature-based: Groups by functional features
Priority-based: Urgent β High β Medium β Low
3. Adaptive Mode (src/modes/adaptive/)#
Purpose: Intelligent task coordination that respects dependencies and prevents illogical assignments.
Core Problem Solved: The primary issue Marcus was built to solve - preventing βDeploy to productionβ from being assigned when development isnβt complete.
Components:
BasicAdaptiveMode: Core coordination logic with dependency checking
Key Features:
Dependency Blocking: Hard blocks on both explicit dependencies and logical patterns
Skill Matching: Scores tasks based on agent capabilities
Preference Learning: Adapts to agent performance over time
Unblocking Analysis: Identifies whatβs preventing task completion
Technical Implementation:
# Core dependency checking logic
async def _is_task_unblocked(self, task, all_tasks, assigned_tasks):
# Check explicit dependencies
for dep_id in task.dependencies:
dep_task = next((t for t in all_tasks if t.id == dep_id), None)
if dep_task and dep_task.status != TaskStatus.DONE:
return False
# Check logical dependency patterns
for pattern in self.LOGICAL_DEPENDENCY_PATTERNS:
if self._matches_blocked_pattern(task, pattern):
if self._has_incomplete_blockers(task, all_tasks, pattern):
return False
return True
Scoring Algorithm:
Skill Match: 40% weight
Priority: 30% weight
Unblocking Value: 20% weight
Agent Preference: 10% weight
Context Detection and Mode Switching#
BoardAnalyzer (src/detection/board_analyzer.py)#
Analyzes board state to determine optimal mode:
Metrics Calculated:
Structure Score: Completeness of metadata across tasks
Workflow Pattern: Sequential, Parallel, Phased, or Ad-hoc
Phase Detection: Identifies development phases present
Component Detection: Identifies system components
State Classification:
Empty Board β Creator Mode recommended
Chaotic Board (low structure score) β Enricher Mode recommended
Well-Structured Board β Adaptive Mode recommended
ContextDetector (src/detection/context_detector.py)#
Analyzes user intent and recommends mode switches:
Intent Detection Patterns:
INTENT_PATTERNS = {
UserIntent.CREATE: [r"create.*project", r"new.*project", r"start.*from.*scratch"],
UserIntent.ORGANIZE: [r"organize", r"structure", r"clean.*up"],
UserIntent.COORDINATE: [r"assign", r"next.*task", r"who.*should"]
}
ModeRegistry (src/orchestration/mode_registry.py)#
Manages mode lifecycle and state persistence:
Features:
Mode switching with state preservation
Switch history tracking
Capability reporting per mode
Automatic mode suggestions
Marcus Ecosystem Integration#
Position in Marcus Workflow#
The Operational Modes system sits at the core of the Marcus workflow:
User Request β Context Detection β Mode Selection β Mode-Specific Logic β Board Updates
β
1. create_project β Creator Mode β Template Generation β Tasks Created
2. register_agent β Adaptive Mode β Agent Registration β Ready for Assignment
3. request_next_task β Adaptive Mode β Dependency Check β Task Assignment
4. report_progress β Adaptive Mode β Progress Update β Dependency Recalculation
5. report_blocker β Adaptive Mode β Blocker Analysis β Alternative Suggestions
6. finish_task β Adaptive Mode β Completion β Unblock Dependent Tasks
MCP Integration (src/orchestration/hybrid_tools.py)#
Exposes mode functionality through MCP tools:
Tool Categories:
Mode Management:
switch_mode,analyze_board_contextProject Creation:
create_project_from_template,create_project_from_descriptionTask Coordination:
get_next_task_intelligent,get_blocking_analysis
Board-Specific Considerations#
Kanban Integration:
Tasks created through templates automatically appear on board
Dependency relationships maintained through task IDs
Status updates trigger dependency recalculation
Cross-board project support (planned)
Multiple Project Support:
Each mode can handle multiple concurrent projects
Project context preserved in task metadata
Cross-project dependency detection (future enhancement)
Technical Implementation Details#
State Management#
Each mode implements state persistence:
class ModeInterface:
async def initialize(self, saved_state: Dict[str, Any]) -> None
async def get_state(self) -> Dict[str, Any]
async def get_status(self) -> Dict[str, Any]
State Contents:
Creator: Active project, generated tasks, template customizations
Enricher: Enrichment plans, organization strategies, metadata caches
Adaptive: Assignment preferences, blocked tasks, agent histories
Dependency Resolution Algorithm#
Multi-Layer Dependency Checking:
Explicit Dependencies: Direct task ID references
Logical Patterns: Regex-based pattern matching for task relationships
Phase Dependencies: Cross-phase dependency validation
Component Dependencies: Component interaction requirements
LOGICAL_DEPENDENCY_PATTERNS = [
# Setup blocks everything until complete
{
'pattern': r'(setup|init|configure|install)',
'blocks_until_complete': r'(implement|build|create|develop|test|deploy)'
},
# Implementation blocks testing
{
'pattern': r'(implement|build|create|develop)',
'blocks_until_complete': r'(test|qa|verify)'
},
# Testing blocks deployment
{
'pattern': r'(test|qa|quality|verify)',
'blocks_until_complete': r'(deploy|release|launch|production)'
}
]
Template System Architecture#
Template Hierarchy:
ProjectTemplate
βββ phases: List[PhaseTemplate]
β βββ tasks: List[TaskTemplate]
β βββ order: int
βββ size_adjustments: Dict[ProjectSize, float]
Built-in Templates:
WebAppTemplate: Full-stack web application (6 phases, 20+ tasks)
APIServiceTemplate: Backend API service (5 phases, 12+ tasks)
MobileAppTemplate: Mobile application (4 phases, 15+ tasks)
Error Handling and Resilience#
Dependency Validation:
Circular dependency detection
Cross-phase dependency validation
Missing dependency resolution
Invalid assignment prevention
Mode Switch Safety:
State validation before switching
Rollback capability on switch failure
Mode availability checking
User confirmation for destructive operations
Advantages and Limitations#
Advantages#
Solves Core Problem: Eliminates illogical task assignments through dependency-aware coordination
Progressive Enhancement: Works with existing boards, doesnβt require restructuring
Template Standardization: Provides proven project structures out-of-the-box
Context Awareness: Automatically adapts behavior based on board state
Skill-Based Assignment: Matches tasks to agent capabilities effectively
State Persistence: Maintains context across mode switches
Extensible Architecture: Easy to add new modes, templates, or organization strategies
Current Limitations#
Enricher Mode Implementation: Currently Phase 2 - only basic enricher available
Limited AI Integration: Template selection and enrichment use rule-based logic
Single Board Focus: Multi-board project management not fully implemented
Agent Skill Modeling: Simple keyword-based skill matching
Dependency Inference: Logical patterns may miss domain-specific dependencies
Real-time Collaboration: No live updates during multi-agent coordination
Why This Approach#
Design Rationale:
Mode-Based Architecture: Different project states need fundamentally different approaches
Template-First: Proven structures prevent common pitfalls and reduce setup time
Dependency-Centric: The core value proposition requires bulletproof dependency handling
Progressive Enhancement: Must work with existing workflows without disruption
Context-Driven: Automatic mode switching reduces cognitive load on users
Alternative Approaches Considered:
Single-Mode System: Too rigid for diverse project states
Always-Enricher: Doesnβt solve empty board problem
Always-Creator: Canβt handle existing chaotic boards
Manual Mode Selection: Increases user friction and complexity
Future Evolution#
Phase 2 Enhancements#
AI-Powered Enricher:
LLM-based task analysis and improvement
Intelligent dependency inference
Natural language acceptance criteria generation
Advanced Templates:
Industry-specific templates (e-commerce, SaaS, data science)
Custom template creation and sharing
Template version control
Smart Agent Matching:
Machine learning-based skill assessment
Performance history analysis
Workload balancing
Phase 3 Vision#
Multi-Board Orchestration:
Cross-project dependency management
Resource allocation across projects
Portfolio-level optimization
Predictive Analytics:
Project timeline prediction
Risk assessment and mitigation
Capacity planning
Integration Ecosystem:
IDE plugins for task context
CI/CD pipeline integration
Third-party tool connectors
Handling Simple vs Complex Tasks#
Simple Tasks (Adaptive Mode):
Direct skill-based assignment
Minimal dependency checking
Fast assignment decisions
Basic preference learning
Complex Tasks (Creator/Enricher Mode):
Multi-step decomposition
Comprehensive dependency analysis
Template-based structure
Rich metadata generation
Complexity Detection:
def detect_task_complexity(task):
complexity_indicators = [
len(task.description) > 200,
len(task.labels) > 3,
task.estimated_hours > 8,
len(task.dependencies) > 2,
'complex' in task.name.lower()
]
return sum(complexity_indicators) >= 2
Integration with Cato#
Current Integration: Limited - Cato operates as a separate agent coordinator
Planned Integration:
Cato as meta-coordinator managing mode switches
Operational Modes as Catoβs decision-making engine
Cross-system dependency tracking
Unified agent skill modeling
Architecture Vision:
Cato (Meta-Coordinator)
β
Operational Modes (Decision Engine)
β
Individual Agents (Task Execution)
Typical Usage Scenarios#
Scenario 1: New Project Creation#
1. Empty board detected β Auto-switch to Creator Mode
2. User: "Create a web app for e-commerce"
3. Creator Mode: Analyzes description β Suggests WebApp template
4. Template generates 25 tasks across 6 phases
5. Dependencies automatically established
6. Auto-switch to Adaptive Mode for coordination
Scenario 2: Chaotic Board Organization#
1. Board analysis: 50 tasks, low structure score β Suggest Enricher Mode
2. Enricher analyzes tasks β Identifies 3 organization strategies
3. User selects phase-based organization
4. Tasks automatically categorized and enhanced
5. Dependencies inferred and established
6. Switch to Adaptive Mode for ongoing coordination
Scenario 3: Ongoing Coordination#
1. Agent requests task β Adaptive Mode activated
2. Dependency analysis: Check 15 available tasks
3. 8 tasks blocked by incomplete dependencies
4. 7 tasks available, scored by skill match
5. Best task assigned with reasoning
6. Progress updates trigger dependency recalculation
This Operational Modes system represents Marcusβs core intelligence, ensuring that the chaotic βdeploy before buildingβ problem is systematically prevented while providing the flexibility to handle projects at any stage of development.