# Sample Health Report Output

This document shows example outputs from the Claude PM Framework Health Monitoring System.

## Command Output Examples

### Single Health Check
```bash
$ npm run monitor:once

> @claudepm/framework@4.0.0 monitor:once
> node scripts/automated-health-monitor.js once

[2025-07-07T03:11:29.589Z] INFO: Starting comprehensive health check...
[2025-07-07T03:11:29.591Z] INFO: Checking service health...
[2025-07-07T03:11:29.594Z] INFO: Checking framework compliance...
[2025-07-07T03:11:29.607Z] INFO: Scanning all projects...
🚨 ALERT: [2025-07-07T03:11:40.622Z] CRITICAL: Overall health 36% is below alert threshold 60%
🚨 ALERT: [2025-07-07T03:11:40.622Z] CRITICAL: 1 project(s) have critical issues requiring immediate attention
[2025-07-07T03:11:40.630Z] INFO: Health check completed

📊 Health check completed. Reports saved to:
  📝 JSON Report: ~/Projects/Claude-PM/logs/health-report.json
  📋 Summary: ~/Projects/Claude-PM/logs/health-summary.md
  📈 Monitor Log: ~/Projects/Claude-PM/logs/health-monitor.log
  🚨 Alerts Log: ~/Projects/Claude-PM/logs/health-alerts.log
```

### Monitor Status
```bash
$ npm run monitor:status

📊 Monitor Status:
  PID: 9748
  Started: 7/6/2025, 11:11:29 PM
  Last Check: 7/6/2025, 11:11:29 PM
  Checks Run: 1
  Alerts Sent: 2

📈 Latest Health Summary:
  Overall Health: 36%
  Total Projects: 23
  Healthy Projects: 3
  Warning Projects: 19
  Critical Projects: 1
  Framework Compliance: 89%
  Last Updated: 7/6/2025, 11:11:29 PM

🚨 Recent Alerts: 2
  [CRITICAL] Overall health 36% is below alert threshold 60%
  [CRITICAL] 1 project(s) have critical issues requiring immediate attention
```

### Recent Alerts
```bash
$ npm run monitor:alerts

🚨 Recent Health Alerts:
  [2025-07-07T03:11:40.622Z] CRITICAL: Overall health 36% is below alert threshold 60%
  [2025-07-07T03:11:40.622Z] CRITICAL: 1 project(s) have critical issues requiring immediate attention
```

## Generated Report Examples

### Health Summary (Markdown)
```markdown
# Claude PM Framework Health Report

**Generated**: 7/6/2025, 11:11:29 PM

## Summary

- **Total Projects**: 23
- **Healthy**: 3 (13%)
- **Warning**: 19 (83%)
- **Critical**: 1 (4%)
- **Framework Compliance**: 89%

## Framework Status

### TrackDown System
- **Total Tickets**: 189
- **Completed**: 28 (15%)
- **Pending**: 161
- **Last Update**: 0 days ago
- **Status**: active

## Services Status

- **mem0ai_mcp**: healthy (13ms)
- **portfolio_manager**: unhealthy (2ms)
- **git_portfolio_manager**: down 
- **claude_pm_dashboard**: down 

## Recommendations

- Create missing file: CLAUDE.md
- Address 1 critical project issues immediately
- More than half of projects have warnings - consider a framework compliance review
- Restart or fix services: portfolio_manager, git_portfolio_manager, claude_pm_dashboard

## Critical Issues

- **scraper-engine**: Missing CLAUDE.md, No README.md

---
*Report generated by Claude PM Automated Health Monitor*
```

### Health Report (JSON Structure)
```json
{
  "timestamp": "2025-07-07T03:11:29.589Z",
  "version": "2.0.0",
  "config": {
    "checkInterval": 300000,
    "alertThreshold": 60,
    "enableAlerting": true,
    "enableServiceChecks": true,
    "enableGitChecks": true,
    "verboseLogging": false
  },
  "summary": {
    "total_projects": 23,
    "healthy_projects": 3,
    "warning_projects": 19,
    "critical_projects": 1,
    "framework_compliance": 89,
    "overall_health_percentage": 36,
    "project_health_percentage": 13,
    "service_health_percentage": 25
  },
  "services": {
    "mem0ai_mcp": {
      "name": "mem0ai_mcp",
      "description": "mem0AI MCP Service",
      "port": 8002,
      "critical": true,
      "last_check": "2025-07-07T03:11:29.604Z",
      "status": "healthy",
      "response_time": 13,
      "http_status": 200,
      "performance": "excellent"
    },
    "portfolio_manager": {
      "name": "portfolio_manager",
      "description": "Claude PM Portfolio Manager",
      "port": 3000,
      "critical": false,
      "last_check": "2025-07-07T03:11:29.606Z",
      "status": "unhealthy",
      "response_time": 2,
      "http_status": 500
    }
  },
  "framework": {
    "compliance_percentage": 89,
    "total_checks": 9,
    "passed_checks": 8,
    "optional_compliance": 3,
    "optional_total": 5,
    "managed_projects": {
      "total_projects": 12,
      "compliant_projects": 8,
      "compliance_rate": 67,
      "project_details": {
        "ai-code-review": {
          "project_name": "ai-code-review",
          "score": 100,
          "status": "compliant"
        }
      }
    },
    "trackdown": {
      "total_tickets": 189,
      "completed_tickets": 28,
      "in_progress_tickets": 0,
      "pending_tickets": 161,
      "high_priority_tickets": 45,
      "critical_tickets": 12,
      "completion_rate": 15,
      "health_status": "active"
    }
  },
  "projects": {
    "managed/ai-code-review": {
      "name": "ai-code-review",
      "status": "healthy",
      "issues": [],
      "metrics": {
        "git": {
          "health_status": "active",
          "days_since_last_commit": 2
        },
        "dependencies": {
          "type": "node",
          "total_dependencies": 45,
          "outdated_count": 3,
          "health_status": "moderate"
        }
      }
    }
  },
  "recommendations": [
    "Create missing file: CLAUDE.md",
    "Address 1 critical project issues immediately",
    "More than half of projects have warnings - consider a framework compliance review",
    "Restart or fix services: portfolio_manager, git_portfolio_manager, claude_pm_dashboard"
  ],
  "alerts": [
    {
      "timestamp": "2025-07-07T03:11:40.622Z",
      "level": "critical",
      "message": "Overall health 36% is below alert threshold 60%"
    },
    {
      "timestamp": "2025-07-07T03:11:40.622Z",
      "level": "critical",
      "message": "1 project(s) have critical issues requiring immediate attention"
    }
  ]
}
```

## PM2 Service Output

### Starting the Service
```bash
$ pm2 start ecosystem.config.js

[PM2] Starting ~/Projects/Claude-PM/ecosystem.config.js
[PM2] Process successfully started
┌─────┬────────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name                       │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ claude-pm-health-monitor   │ default     │ N/A     │ fork    │ 12345    │ 0s     │ 0    │ online    │ 0%       │ 25.2mb   │ masa     │ disabled │
└─────┴────────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
```

### Viewing Logs
```bash
$ pm2 logs claude-pm-health-monitor

[TAILING] Tailing last 15 lines for [claude-pm-health-monitor] process (change the value with --lines option)
~/Projects/Claude-PM/logs/health-monitor-combined.log last 15 lines:
0|claude-p | [2025-07-07T03:15:00.123Z] INFO: Starting comprehensive health check...
0|claude-p | [2025-07-07T03:15:00.125Z] INFO: Checking service health...
0|claude-p | [2025-07-07T03:15:00.128Z] INFO: Checking framework compliance...
0|claude-p | [2025-07-07T03:15:00.135Z] INFO: Scanning all projects...
0|claude-p | [2025-07-07T03:15:10.456Z] INFO: Health check completed
```

## Performance Metrics

### Service Response Times
- **Excellent**: < 100ms
- **Good**: 100-500ms
- **Fair**: 500-2000ms
- **Poor**: > 2000ms

### Health Score Calculation
- **Project Health (40%)**: Percentage of healthy projects
- **Service Health (35%)**: Percentage of healthy services  
- **Framework Compliance (25%)**: Framework structure compliance

### Alert Thresholds
- **Critical**: Health < 60% (default), Critical services down
- **Warning**: Framework compliance < 80%, Project issues
- **Info**: General status updates

This monitoring system provides comprehensive insights into the Claude PM Framework health and helps maintain optimal performance across all components.