|
| 1 | +# MCP Task Orchestrator - Claude Code Development Guide |
| 2 | + |
| 3 | +This file provides context and guidance for Claude Code development sessions in the MCP Task Orchestrator project. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +**Version**: 1.4.1 (stable, production-ready) |
| 8 | +**Architecture**: Python-based MCP server with SQLite persistence and enhanced features |
| 9 | +**Location**: `E:\My Work\Programming\MCP Servers\mcp-task-orchestrator` |
| 10 | + |
| 11 | +### Key Capabilities |
| 12 | +- **Task Orchestration**: Intelligent breakdown with specialized AI roles |
| 13 | +- **Artifact Storage**: Context limit prevention for complex workflows |
| 14 | +- **Maintenance Coordination**: Automated task lifecycle management |
| 15 | +- **Enhanced Testing**: Advanced infrastructure with alternative runners |
| 16 | +- **Feature Management**: 8 approved features with implementation roadmap |
| 17 | + |
| 18 | +## Quick Commands |
| 19 | + |
| 20 | +### System Diagnostics |
| 21 | +```bash |
| 22 | +# Comprehensive health check |
| 23 | +python scripts/diagnostics/check_status.py |
| 24 | + |
| 25 | +# Installation verification |
| 26 | +python scripts/diagnostics/verify_tools.py |
| 27 | + |
| 28 | +# Database optimization |
| 29 | +python scripts/diagnostics/diagnose_db.py |
| 30 | +``` |
| 31 | + |
| 32 | +### Enhanced Testing |
| 33 | +```bash |
| 34 | +# Enhanced test runners (preferred) |
| 35 | +python simple_test_runner.py |
| 36 | +python test_validation_runner.py |
| 37 | + |
| 38 | +# Resource management validation |
| 39 | +python tests/test_resource_cleanup.py |
| 40 | + |
| 41 | +# Traditional pytest (still supported) |
| 42 | +python -m pytest tests/ -v |
| 43 | +``` |
| 44 | + |
| 45 | +### Development Server |
| 46 | +```bash |
| 47 | +# Launch orchestrator |
| 48 | +python -m mcp_task_orchestrator.server |
| 49 | +python launch_orchestrator.py |
| 50 | + |
| 51 | +# CLI interface |
| 52 | +python launch_cli.py |
| 53 | +``` |
| 54 | + |
| 55 | +## Claude Code Integration |
| 56 | + |
| 57 | +### Context-Specific Development |
| 58 | +- **Root Context**: Universal project guidance (current directory) |
| 59 | +- **Documentation**: `cd docs && claude` for multi-audience documentation workflows |
| 60 | +- **Testing**: `cd tests && claude` for enhanced testing procedures |
| 61 | +- **Core Implementation**: `cd mcp_task_orchestrator && claude` for orchestrator development |
| 62 | +- **Diagnostics**: `cd scripts && claude` for system tools and troubleshooting |
| 63 | + |
| 64 | +### Enhanced Orchestrator Workflows |
| 65 | +- **Artifact System**: Seamless integration with Claude Code file operations |
| 66 | +- **Maintenance Coordination**: Automated task lifecycle and cleanup |
| 67 | +- **Testing Infrastructure**: Optimized for Claude Code development patterns |
| 68 | +- **Feature Management**: Strategic planning and implementation tracking |
| 69 | + |
| 70 | +## Architecture |
| 71 | + |
| 72 | +### Core Components |
| 73 | +- **Orchestrator Core** (`orchestrator/`): Task breakdown and specialist management |
| 74 | +- **Database Persistence** (`db/`): SQLAlchemy ORM with SQLite backend |
| 75 | +- **Testing Infrastructure** (`testing/`): Enhanced framework with alternative runners |
| 76 | +- **Monitoring Systems** (`monitoring/`): Diagnostics and health checking |
| 77 | + |
| 78 | +### Development Patterns |
| 79 | +- **Async Safety**: All database operations with proper timeout handling |
| 80 | +- **Singleton Management**: Lazy initialization for core components |
| 81 | +- **Error Recovery**: Retry mechanisms with exponential backoff |
| 82 | +- **Type Safety**: Pydantic models for data validation |
| 83 | + |
| 84 | +## Git Workflow |
| 85 | + |
| 86 | +### Repository Sync (CRITICAL) |
| 87 | +**NEVER make individual file changes without considering full repository state.** |
| 88 | + |
| 89 | +```bash |
| 90 | +# Before any changes |
| 91 | +git status |
| 92 | +git pull origin main |
| 93 | + |
| 94 | +# After making changes |
| 95 | +git status |
| 96 | +git add [related-files] |
| 97 | +git commit -m "feat: descriptive message" |
| 98 | +git push origin main |
| 99 | +``` |
| 100 | + |
| 101 | +### Atomic Development |
| 102 | +- Group related changes in single commits |
| 103 | +- Test thoroughly before committing |
| 104 | +- Push only complete, working features |
| 105 | +- Use descriptive commit messages with scope |
| 106 | + |
| 107 | +## Enhanced Features (v1.4.1) |
| 108 | + |
| 109 | +### Artifact Storage System |
| 110 | +- **Context Limit Prevention**: Detailed work stored as filesystem artifacts |
| 111 | +- **Cross-Session Continuity**: Complete history preservation across contexts |
| 112 | +- **Professional Handovers**: Comprehensive documentation for team transitions |
| 113 | +- **File Integration**: Works with all MCP file operation tools |
| 114 | + |
| 115 | +### Maintenance Coordinator |
| 116 | +- **Automated Management**: `orchestrator_maintenance_coordinator` tool |
| 117 | +- **Cleanup Operations**: Smart removal of stale tasks with artifact preservation |
| 118 | +- **Structure Validation**: Task hierarchy and data integrity analysis |
| 119 | +- **Handover Preparation**: Complete transition documentation generation |
| 120 | + |
| 121 | +### Advanced Testing Infrastructure |
| 122 | +- **Enhanced Runners**: Alternative to pytest with improved reliability |
| 123 | +- **File-Based Output**: Complete result capture without truncation |
| 124 | +- **Hang Detection**: Timeout mechanisms and process monitoring |
| 125 | +- **Resource Management**: Automatic cleanup of connections and resources |
| 126 | + |
| 127 | +## Development Guidelines |
| 128 | + |
| 129 | +### Code Quality Standards |
| 130 | +- Use `black` for formatting: `black mcp_task_orchestrator/ tests/` |
| 131 | +- Organize imports with `isort`: `isort mcp_task_orchestrator/ tests/` |
| 132 | +- Type checking with `mypy` when available |
| 133 | +- Comprehensive error handling and input validation |
| 134 | + |
| 135 | +### Testing Best Practices |
| 136 | +- Prefer enhanced test runners over standard pytest |
| 137 | +- Use file-based output for complex test scenarios |
| 138 | +- Include timeout mechanisms for all operations |
| 139 | +- Validate resource cleanup in database tests |
| 140 | + |
| 141 | +### Database Operations |
| 142 | +- Use managed connections with proper cleanup |
| 143 | +- Implement retry logic with exponential backoff |
| 144 | +- Leverage WAL mode for better concurrency |
| 145 | +- Monitor connection health and performance |
| 146 | + |
| 147 | +## Project Structure |
| 148 | + |
| 149 | +``` |
| 150 | +mcp-task-orchestrator/ |
| 151 | +├── .task_orchestrator/ # Runtime state and custom roles |
| 152 | +├── docs/ # Multi-audience documentation |
| 153 | +│ ├── llm-agents/ # AI-optimized documentation |
| 154 | +│ ├── user-guide/ # Human-readable guides |
| 155 | +│ ├── architecture/ # System design records |
| 156 | +│ ├── testing/ # Testing documentation |
| 157 | +│ ├── troubleshooting/ # Issue resolution guides |
| 158 | +│ └── prompts/features/ # Feature lifecycle management |
| 159 | +├── mcp_task_orchestrator/ # Main Python package |
| 160 | +│ ├── orchestrator/ # Core orchestration logic |
| 161 | +│ ├── db/ # Database persistence layer |
| 162 | +│ ├── testing/ # Enhanced testing infrastructure |
| 163 | +│ └── monitoring/ # Diagnostics and monitoring |
| 164 | +├── tests/ # Test suite with alternative runners |
| 165 | +├── scripts/diagnostics/ # System diagnostic tools |
| 166 | +└── architecture/ # Architectural documentation |
| 167 | +``` |
| 168 | + |
| 169 | +## Troubleshooting |
| 170 | + |
| 171 | +### Common Issues |
| 172 | +- **Database Schema**: Run `python scripts/diagnostics/diagnose_db.py` for analysis |
| 173 | +- **Installation**: Use `python scripts/diagnostics/verify_tools.py` for validation |
| 174 | +- **Testing Failures**: Try enhanced runners: `python simple_test_runner.py` |
| 175 | +- **Resource Warnings**: Use resource cleanup validation tests |
| 176 | + |
| 177 | +### Emergency Procedures |
| 178 | +- **Database Issues**: Emergency schema fix scripts available in project root |
| 179 | +- **Test Hanging**: Enhanced infrastructure includes hang detection and timeouts |
| 180 | +- **Context Limits**: Artifact storage system prevents work loss in complex sessions |
| 181 | + |
| 182 | +## Performance Optimization |
| 183 | + |
| 184 | +### Development Workflow |
| 185 | +1. **Health Check**: Run diagnostics before major work |
| 186 | +2. **Git Sync**: Always pull latest changes before development |
| 187 | +3. **Feature Development**: Make logical, atomic changes |
| 188 | +4. **Enhanced Testing**: Use improved test infrastructure |
| 189 | +5. **Validation**: Verify system health after changes |
| 190 | + |
| 191 | +### Resource Management |
| 192 | +- Close resource-intensive tools when done |
| 193 | +- Use enhanced testing for reliable validation |
| 194 | +- Monitor database performance with diagnostic tools |
| 195 | +- Leverage artifact storage for complex workflows |
| 196 | + |
| 197 | +--- |
| 198 | + |
| 199 | +**For specialized contexts**: Use `cd <directory> && claude` to access area-specific guidance and workflows. |
0 commit comments