# CEO Dashboard Runbook

> Last Verified: 2026-02-17 | Owner: John

# CEO Dashboard

**URL:** http://localhost:3030/ceo
**Server:** Mission Control Dashboard (port 3030)
**Auto-refresh:** 60 seconds
**Theme:** Dark (ALAI brand)

## Overview

The CEO Dashboard provides Alem with a single-screen view of all critical business metrics. It aggregates data from multiple sources (Mission Control tasks, sales pipeline, invoices, support tickets, decisions) into a real-time executive view.

## Sections

### 1. Revenue Overview (Banner)
Top banner showing financial health:
- **MRR (Monthly Recurring Revenue)** — Estimated from total invoiced / months
- **Outstanding** — Total unpaid invoices
- **3-Month Trend** — Revenue trend (TODO: implement calculation)
- **Next Invoice Due** — Next upcoming payment deadline

**Data Source:** `invoice-generator.js stats` and `invoice-generator.js list`

### 2. Pipeline Funnel
Visual funnel showing lead progression:
- Prospect → Qualified → Proposal Sent → Negotiating → Won
- Each stage shows count of active leads

**Data Source:** `sales-pipeline.js stats`

### 3. Active Projects (Kanban)
Project status board with 3 columns:
- **Active** — In progress tasks with project tag
- **Pending** — Paused tasks with project tag
- **Stalled** — Blocked tasks with project tag

**Data Source:** Mission Control `tasks` table (filtered by `project IS NOT NULL`)

### 4. Decisions Pending
Top 5 GO/NO-GO decisions awaiting Alem's response:
- Title of decision
- Recommendation (MUST GO / GO / CONDITIONAL GO / NO-GO)
- Visual badge indicating action needed

**Data Source:** `~/system/specs/alem-decisions-2026-02.md` (parsed from markdown)

### 5. Alerts Panel
Critical alerts requiring attention:
- **Overdue invoices** (from `invoice-generator.js check-overdue`)
- **SLA breaches** (from `ticket-sla-checker.js`)
- **Stale tasks** (open >7 days from MC)

Color coding:
- 🔴 Critical (red) — SLA breaches
- ⚠️ Warning (yellow) — Overdue invoices
- ℹ️ Info (blue) — Stale tasks

**Data Sources:** `invoice-generator.js`, `ticket-sla-checker.js`, MC tasks table

### 6. Upcoming Deadlines
Timeline of upcoming deadlines (next 14 days):
- Tasks with "deadline" keyword in description
- Sorted by creation date (proxy for urgency)

**Data Source:** Mission Control `tasks` table (filtered by description LIKE '%deadline%')

## Technical Details

### Implementation
- Added as route `/ceo` to existing MC dashboard server
- Server file: `~/system/tools/mc-dashboard.js`
- HTML file: `~/system/tools/ceo-dashboard.html`
- API endpoint: `GET /api/ceo/dashboard` (JSON)

### Data Aggregation
Dashboard uses `child_process.execSync` to call existing tools:
```javascript
const invoiceStatsRaw = execSync('node ~/system/tools/invoice-generator.js stats 2>/dev/null');
const pipelineRaw = execSync('node ~/system/tools/sales-pipeline.js stats 2>/dev/null');
```

Data is cached for 60 seconds to avoid hammering tools on every browser refresh.

### Styling
- Pure CSS (no frameworks)
- ALAI brand colors:
  - Background: `#09090b`
  - Accent: `#00E5A0`
  - Cards: `#18181b`
  - Borders: `#27272a`
  - Text: `#e4e4e7`
- Responsive grid layout
- Mobile-friendly (single column on mobile)

### Auto-refresh
Two mechanisms:
1. HTML meta refresh: `<meta http-equiv="refresh" content="60">`
2. JavaScript interval: `setInterval(loadDashboard, 60000)`

## Access

### Local
- Direct: http://localhost:3030/ceo
- From MC dashboard: Click "CEO Dashboard" link (TODO: add link to MC dashboard)

### LAN Access
Dashboard is bound to `0.0.0.0:3030`, accessible from any device on the network:
- Find Mac Studio IP: `ifconfig | grep "inet " | grep -v 127.0.0.1`
- Access from phone/tablet: `http://[MAC_IP]:3030/ceo`

### Mobile
Fully responsive. Recommended for iPad/tablet in landscape mode for best experience.

## Future Enhancements

### Phase 2 (Interactive)
- [ ] Click on decisions to mark GO/NO-GO (updates alem-decisions file)
- [ ] Click on alerts to take action (send reminder, escalate ticket)
- [ ] Filter pipeline by source/date range
- [ ] Drill-down from project kanban to task list

### Phase 3 (Advanced Metrics)
- [ ] Revenue trend calculation (3-month moving average)
- [ ] Pipeline conversion rates (qualified → won)
- [ ] Task velocity (tasks closed per week)
- [ ] SLA compliance percentage over time
- [ ] Contract expiration warnings

### Phase 4 (AI Insights)
- [ ] Weekly digest summary (Ollama-generated)
- [ ] Anomaly detection (sudden drop in pipeline, spike in alerts)
- [ ] Predictive revenue forecasting
- [ ] Recommendations engine (which decision to prioritize)

## Maintenance

### Update Decision File
When Alem makes decisions, update:
```
~/system/specs/alem-decisions-2026-02.md
```

Dashboard will auto-parse on next refresh.

### Restart Dashboard
If changes are made to server code:
```bash
launchctl kickstart -k gui/$(id -u)/com.john.mc-dashboard
```

### Check Logs
```bash
tail -f ~/system/logs/mc-dashboard.log
tail -f ~/system/logs/mc-dashboard-error.log
```

## Troubleshooting

### Dashboard shows "Loading..." indefinitely
- Check API endpoint: `curl http://localhost:3030/api/ceo/dashboard`
- Check browser console for JavaScript errors
- Verify MC dashboard daemon is running: `launchctl list | grep mc-dashboard`

### Data shows 0 or N/A
- Verify tool outputs: `node ~/system/tools/invoice-generator.js stats`
- Check tool paths in `mc-dashboard.js` API route
- Ensure database files exist in `~/system/databases/`

### Mobile layout broken
- Clear browser cache
- Test responsive design in browser dev tools
- Check CSS media queries in `ceo-dashboard.html`

## Related Files
- Server: `/Users/makinja/system/tools/mc-dashboard.js`
- HTML: `/Users/makinja/system/tools/ceo-dashboard.html`
- Daemon: `~/Library/LaunchAgents/com.john.mc-dashboard.plist`
- Manifest: `~/system/tools/manifest.md`
- Decisions: `~/system/specs/alem-decisions-2026-02.md`