# Changelog

All notable changes to the MCP Prompt Optimizer will be documented in this file.

## [1.1.0] - 2025-07-05

### 🎯 Smart Tier-Aware Features
- **NEW**: Smart tier detection and feature delivery
- **NEW**: Auto-save templates for high-confidence optimizations (Creator/Innovator)
- **NEW**: Similar template search and discovery (Creator/Innovator)
- **NEW**: Advanced optimization insights and analytics (Innovator)
- **NEW**: Performance improvement metrics (Innovator)
- **NEW**: AI-powered optimization recommendations (Innovator)

### ✨ Enhanced User Experience
- **IMPROVED**: Tier-aware response formatting
- **NEW**: Upgrade prompts and value progression
- **IMPROVED**: Error messages with tier-specific guidance
- **NEW**: Professional messaging for each tier level

### 🔧 Technical Improvements
- **UPDATED**: Backend integration for smart endpoint
- **IMPROVED**: Response parsing and formatting
- **NEW**: Graceful handling of template save failures
- **UPDATED**: Tool descriptions to reflect smart features

### 📚 Documentation
- **UPDATED**: README with tier-specific examples
- **NEW**: Complete feature matrix by tier
- **UPDATED**: Setup instructions for smart features
- **NEW**: Example responses for all tier levels

### 🐛 Bug Fixes
- **FIXED**: Response formatting for complex nested data
- **FIXED**: Error handling for backend communication
- **IMPROVED**: Fallback behavior for missing features

## [2.0.0] - 2024-12-19 - 🚀 **MAJOR RELEASE: True MCP Server**

### 🎯 **Revolutionary Architecture**
- **BREAKING**: Complete rewrite to true MCP server architecture
- **NEW**: Hybrid local+remote optimization capabilities
- **NEW**: Universal compatibility with ALL MCP clients
- **NEW**: Intelligent routing between optimization strategies

### ⚡ **Local Optimization Engine**
- **NEW**: JavaScript-based rules engine for ultra-fast optimization (~50ms)
- **NEW**: AI context detection (image generation, code, technical automation, etc.)
- **NEW**: Parameter preservation for image generation (`--parameters`)
- **NEW**: Code block and URL preservation
- **NEW**: Sophistication analysis for intelligent routing
- **NEW**: 15+ optimization rules with priority system
- **NEW**: Offline capability (no API key required for local mode)

### 🌐 **Remote Enhancement**
- **IMPROVED**: Enhanced remote API integration
- **NEW**: Smart fallback handling
- **NEW**: Confidence-based enhancement decisions
- **NEW**: Batch optimization support
- **NEW**: Health monitoring and diagnostics

### 🔄 **Hybrid Routing System**
- **NEW**: Auto mode with intelligent strategy selection
- **NEW**: Local-first mode (fast local + optional remote enhancement)
- **NEW**: Remote-first mode (quality remote + local validation)
- **NEW**: Parallel mode (run both, choose best result)
- **NEW**: Local-only mode (pure offline)
- **NEW**: Remote-only mode (cloud-powered)

### 🛠️ **Enhanced Configuration**
- **NEW**: Comprehensive configuration manager
- **NEW**: User preference system
- **NEW**: Environment variable support
- **NEW**: Configuration file persistence (`~/.mcp-prompt-optimizer/`)
- **NEW**: CLI configuration options
- **NEW**: Health check and diagnostic tools

### 📋 **MCP Protocol Compliance**
- **NEW**: Full JSON-RPC 2.0 implementation
- **NEW**: Proper MCP protocol version 2024-11-05
- **NEW**: Standard tools interface
- **NEW**: Error handling and validation
- **NEW**: Stdio communication

### 🎮 **Enhanced Tools**
- **IMPROVED**: `optimize_prompt` with extensive options
- **NEW**: `health_check` tool with detailed diagnostics
- **NEW**: `get_config` tool for configuration viewing
- **NEW**: `update_config` tool for runtime configuration updates

### 🏗️ **New Components**
- **NEW**: `lib/mcp-server.js` - Core MCP protocol handler
- **NEW**: `lib/hybrid-router.js` - Intelligent optimization routing
- **NEW**: `lib/local-optimizer.js` - Local rules engine
- **NEW**: `lib/remote-client.js` - Enhanced remote API client
- **NEW**: `lib/ai-context-detector.js` - AI context detection
- **NEW**: `lib/config-manager.js` - Configuration management
- **NEW**: `bin/mcp-prompt-optimizer` - New CLI executable

### 📊 **Performance Improvements**
- **IMPROVED**: ~50ms local optimization (vs ~2-5s remote-only)
- **NEW**: Parallel processing capabilities
- **NEW**: Strategy caching for repeated optimizations
- **NEW**: Intelligent timeout handling
- **NEW**: Memory-efficient rule application

### 🔧 **Developer Experience**
- **NEW**: Comprehensive test suite
- **NEW**: Debug mode with detailed logging
- **NEW**: Health check and connection testing
- **NEW**: Configuration generation tools
- **NEW**: Example configurations for all MCP clients

### 🎯 **AI Context Support**
- **NEW**: `human_communication` - Emails, letters, social content
- **NEW**: `llm_interaction` - General LLM conversations (default)
- **NEW**: `image_generation` - Image/art generation prompts
- **NEW**: `technical_automation` - DevOps, system administration
- **NEW**: `structured_output` - JSON, data formats, templates
- **NEW**: `code_generation` - Programming and development
- **NEW**: `api_automation` - API calls, integrations

### 🎨 **Optimization Goals**
- **EXISTING**: `clarity` - Make prompts clearer
- **EXISTING**: `conciseness` - Remove unnecessary words
- **EXISTING**: `creativity` - Enhance creative aspects
- **NEW**: `specificity` - Add specific details
- **NEW**: `actionability` - Make prompts more directive
- **NEW**: `comprehensiveness` - Add depth and thoroughness
- **NEW**: `precision` - Increase accuracy and exactness
- **NEW**: `engagement` - Improve user engagement

### 📚 **Documentation**
- **REWRITTEN**: Complete README with hybrid architecture explanation
- **NEW**: Comprehensive usage examples
- **NEW**: Performance comparison tables
- **NEW**: Troubleshooting guide
- **NEW**: Architecture documentation
- **NEW**: API reference

### 🔄 **Backward Compatibility**
- **MAINTAINED**: Legacy mode support for existing users
- **MAINTAINED**: Existing API key configuration
- **MAINTAINED**: Original remote-only functionality
- **SMOOTH**: Auto-detection of old vs new mode

### 🐛 **Bug Fixes**
- **FIXED**: Connection timeout handling
- **FIXED**: Error response formatting
- **FIXED**: Configuration persistence issues
- **FIXED**: MCP client compatibility issues

### ⚠️ **Breaking Changes**
- **BREAKING**: New binary location (`bin/mcp-prompt-optimizer`)
- **BREAKING**: Enhanced configuration structure
- **BREAKING**: New tool response format (includes content array)
- **MIGRATION**: Automatic migration from legacy config

### 🔒 **Security**
- **IMPROVED**: Input validation and sanitization
- **IMPROVED**: Error message safety
- **NEW**: Local processing for sensitive parameters
- **NEW**: Configurable data routing

## [1.0.2] - 2024-12-17

### Fixed
- Package installation issues
- Binary execution permissions
- Configuration file handling

## [1.0.1] - 2024-12-17

### Added
- Initial MCP server implementation
- Basic prompt optimization via remote API
- Claude Desktop integration
- Setup wizard for API key configuration

### Features
- Remote optimization using AI-Enhanced Prompt Optimizer API
- MCP protocol compliance
- Cross-platform support (Windows, macOS, Linux)
- Global npm installation support

---

## Migration Guide: 1.x → 2.0

### For Existing Users

1. **Backup Configuration** (optional):
   ```bash
   cp ~/.prompt-optimizer/config.json ~/.prompt-optimizer/config.json.backup
   ```

2. **Update Package**:
   ```bash
   npm update -g mcp-prompt-optimizer
   ```

3. **Test New Server**:
   ```bash
   mcp-prompt-optimizer --health-check
   ```

4. **Update MCP Client Config** (optional):
   ```json
   {
     "mcpServers": {
       "prompt-optimizer": {
         "command": "npx",
         "args": ["mcp-prompt-optimizer", "--mode", "auto"]
       }
     }
   }
   ```

### New Configuration Options

```bash
# Use hybrid mode (recommended)
mcp-prompt-optimizer --mode hybrid

# Use local-only (no API key needed)
mcp-prompt-optimizer --local-only

# Debug mode
mcp-prompt-optimizer --debug
```

### Legacy Mode

The 1.x functionality is still available:
```bash
mcp-prompt-optimizer --legacy
```

---

## Upgrade Benefits

| Aspect | v1.x | v2.0 |
|--------|------|------|
| **Speed** | ~2-5s | ~50ms (local) |
| **Offline** | ❌ | ✅ (local mode) |
| **Preservation** | ⚠️ | ✅ (perfect) |
| **Clients** | Limited | All MCP clients |
| **Architecture** | API wrapper | True MCP server |
| **Intelligence** | Basic | Hybrid routing |
| **Flexibility** | Single mode | 5 modes |

**Ready to experience the future of prompt optimization? Update now!**
