# Commands Overview

Complete reference for all macOS Resource Optimizer commands.

## Command Architecture

Six commands provide complete control over system optimization:

```
0-init       → Initialize and verify setup
    ↓
1-analyze    → Analyze current system state
    ↓
2-optimize   → Apply optimizations
    ↓
3-monitor    → Monitor performance continuously
    ↓
4-report     → Generate detailed reports
    ↓
9-feedback   → Submit improvements
```

## Quick Reference

| Command | Purpose | Time | Cost | Use Case |
|---------|---------|------|------|----------|
| `0-init` | Initialize system | 1.0s | 5K | Setup verification |
| `1-analyze` | Analyze resources | 1.8s | 15K | Baseline metrics |
| `2-optimize` | Optimize system | 2.0s | 20K | Apply improvements |
| `3-monitor` | Monitor continuous | 3.0s | 10K | Real-time tracking |
| `4-report` | Generate reports | 1.5s | 8K | Analysis results |
| `9-feedback` | Submit feedback | 0.5s | 2K | Improvements |

## Command Categories

### Setup Commands

**0-init**: Initialize and validate the system
```bash
/macos-resource-optimizer:0-init
```

### Analysis Commands

**1-analyze**: Collect and analyze metrics
```bash
/macos-resource-optimizer:1-analyze
```

### Optimization Commands

**2-optimize**: Apply system optimizations
```bash
/macos-resource-optimizer:2-optimize
```

### Monitoring Commands

**3-monitor**: Continuous performance monitoring
```bash
/macos-resource-optimizer:3-monitor
```

### Reporting Commands

**4-report**: Generate detailed analysis reports
```bash
/macos-resource-optimizer:4-report
```

### Feedback Commands

**9-feedback**: Submit improvements and feedback
```bash
/macos-resource-optimizer:9-feedback "Your feedback"
```

## Typical Workflow

### First Time Users

1. Initialize: `/macos-resource-optimizer:0-init`
2. Analyze: `/macos-resource-optimizer:1-analyze`
3. Review results
4. Optimize: `/macos-resource-optimizer:2-optimize`
5. Generate report: `/macos-resource-optimizer:4-report`

### Regular Users

1. Analyze: `/macos-resource-optimizer:1-analyze`
2. Optimize: `/macos-resource-optimizer:2-optimize`
3. Monitor: `/macos-resource-optimizer:3-monitor`

### Advanced Users

1. Monitor: `/macos-resource-optimizer:3-monitor` (continuous)
2. Custom reports: `/macos-resource-optimizer:4-report --options`
3. Feedback: `/macos-resource-optimizer:9-feedback`

## Command Details

### Command 0: init
Initializes the system and verifies all components are functional.

**Use**: First-time setup, validation, troubleshooting
**Time**: ~1 second
**Output**: Status and system info

[Full documentation →](/commands/init)

### Command 1: analyze
Collects metrics from all system components and provides analysis.

**Use**: Baseline metrics, problem diagnosis, optimization planning
**Time**: ~1.8 seconds
**Output**: Comprehensive metrics and recommendations

[Full documentation →](/commands/analyze)

### Command 2: optimize
Applies targeted optimizations based on analysis.

**Use**: Improve performance, apply recommendations
**Time**: ~2 seconds
**Output**: Changes applied and improvements

[Full documentation →](/commands/optimize)

### Command 3: monitor
Continuous monitoring with real-time metrics and alerts.

**Use**: Long-term tracking, performance monitoring, trend analysis
**Time**: ~3 seconds per cycle
**Output**: Real-time metrics and alerts

[Full documentation →](/commands/monitor)

### Command 4: report
Generates detailed reports with before/after comparisons.

**Use**: Analysis sharing, performance tracking, documentation
**Time**: ~1.5 seconds
**Output**: Formatted report (JSON, HTML, etc.)

[Full documentation →](/commands/report)

### Command 9: feedback
Submit improvements, bug reports, or feature requests.

**Use**: Share feedback, report issues, suggest improvements
**Time**: ~0.5 seconds
**Output**: Feedback confirmation

[Full documentation →](/commands/feedback)

## Command Chaining

Execute multiple commands in sequence:

```bash
# Typical optimization session
/macos-resource-optimizer:0-init && \
/macos-resource-optimizer:1-analyze && \
/macos-resource-optimizer:2-optimize && \
/macos-resource-optimizer:4-report
```

## Advanced Usage

### With Parameters

```bash
# Analyze with specific options
/macos-resource-optimizer:1-analyze --verbose

# Optimize with custom strategy
/macos-resource-optimizer:2-optimize --strategy aggressive

# Report with specific format
/macos-resource-optimizer:4-report --format html
```

### Conditional Execution

```bash
# Only optimize if analysis finds issues
/macos-resource-optimizer:1-analyze && \
if [ $? -eq 0 ]; then
  /macos-resource-optimizer:2-optimize
fi
```

## Performance Characteristics

### Speed Metrics

- **Total workflow time**: 9.3 seconds
- **Average command**: 1.6 seconds
- **Fastest command**: 0.5 seconds (feedback)
- **Slowest command**: 3.0 seconds (monitor)

### Optimization Impact

- **Memory reduction**: 5-15%
- **CPU improvement**: 10-25%
- **Disk efficiency**: 20-30%
- **Battery improvement**: 8-12%

## Error Handling

Each command includes error handling:

```bash
# Check command status
/macos-resource-optimizer:1-analyze
# Exit code 0 = success
# Exit code 1 = error

# View detailed error info
/macos-resource-optimizer:1-analyze --verbose
```

## See Also

- Individual command documentation
- [API Reference](/api/coordinator)
- [Architecture](/architecture/overview)
- [Troubleshooting](/guides/troubleshooting)

## Getting Help

- Check command-specific documentation
- Review [FAQ](/guides/faq)
- Submit feedback: `/macos-resource-optimizer:9-feedback`
