# TSK-0043: Centralize Configuration with ConfigurationManager

**Type**: Task
**Status**: Open
**Priority**: Medium
**Assignee**: Engineer Agent
**Created**: 2025-07-24
**Epic**: Utility Module Integration Phase 3

## Description

Replace manual JSON, YAML, and TOML configuration handling throughout the codebase with the centralized ConfigurationManager utility. This will provide consistent configuration loading, validation, and caching.

## Acceptance Criteria

- [ ] Replace manual `json.loads/dumps` in configuration files
- [ ] Implement ConfigurationManager in all service configuration loaders
- [ ] Add configuration validation schemas
- [ ] Implement configuration caching for frequently accessed configs
- [ ] Support configuration hot-reloading where appropriate
- [ ] Maintain backward compatibility with existing config formats

## Technical Details

### Target Files:
1. **parent_directory_manager/config_manager.py**:
   - Currently uses direct `json.loads/dumps`
   - Needs schema validation and error handling

2. **agent_lifecycle_manager.py**:
   - Manual JSON handling for agent configurations
   - Needs centralized loading and caching

3. **shared_prompt_cache.py**:
   - Configuration loading for cache settings
   - Needs validation and defaults

### Implementation Pattern:
```python
# Before:
import json
with open('config.json', 'r') as f:
    config = json.load(f)

# After:
from claude_mpm.utils.config_manager import ConfigurationManager
config_mgr = ConfigurationManager()
config = config_mgr.load_config('config.json', schema=config_schema)
```

### Configuration Schema Example:
```python
config_schema = {
    "type": "object",
    "properties": {
        "version": {"type": "string"},
        "settings": {
            "type": "object",
            "required": ["timeout", "retry_count"]
        }
    },
    "required": ["version", "settings"]
}
```

## Dependencies
- ConfigurationManager from `claude_mpm.utils.config_manager`
- JSON Schema for validation

## Testing Requirements
- Test configuration loading for all formats (JSON, YAML, TOML)
- Verify schema validation works correctly
- Test configuration caching performance
- Ensure backward compatibility
- Add tests for malformed configurations

## Success Metrics
- All manual config handling replaced
- Zero configuration-related errors
- Improved configuration load times via caching
- Comprehensive validation coverage