# Command Sovereignty — Missing Features Implementation Plan

Created: June 29, 2026
Source: Landing page audit vs. actual implementation

---

## Status Legend

| Icon | Meaning |
|------|---------|
| ✅ | Done |
| 🟡 | Partial — needs finishing |
| ❌ | Not started |

---

## 1. Forecasting & Run-Rate (✅ DONE)

**Landing page claim:** "Live run-rate vs. required pace. See your projected landing curve and exactly how you stack up."

| Feature | Status | Notes |
|---------|--------|-------|
| 6-month revenue projection (likely/best/conservative) | ✅ | Backend + frontend done |
| Trailing 3-month actuals | ✅ | Done |
| Confidence score (0-100) | ✅ | Done |
| Pipeline health gauge | ✅ | Done |
| Stage distribution chart | ✅ | Done |
| At-risk deals table | ✅ | Done |
| KPI cards with period-over-period | ✅ | 11 KPIs across 4 categories |
| **"Required pace" line** | ✅ | Added dashed line (green/red) on chart |
| **Run-rate comparison** | ✅ | On Track / Behind indicator with projected YE |
| **Goal setting UI** | ✅ | localStorage revenue target input |

**To finish forecasting (this session):**
- [ ] Add "Set Target Revenue" input to ForecastingPage
- [ ] Calculate required pace = (target - closed) / remaining months
- [ ] Draw required pace line on revenue chart
- [ ] Add "On Track / Behind" indicator
- [ ] Persist target in DB (new model or session storage)

---

## 2. Cascading Goals (✅ DONE)

**Landing page claim:** "Goals that cascade from org → department → team → rep. Auto-calculated targets that keep everyone aligned."

| Feature | Status | Notes |
|---------|--------|-------|
| Goal model (Org/Dept/Team/Rep) | ✅ | Exists in models.py with parent_goal_id, level, weight |
| Goal hierarchy | ✅ | parent_goal_id FK, recursive relationship |
| Auto-calculation engine | ✅ | `_calculate_cascade()` — org → dept → team → rep |
| Goal tracking page | ✅ | GoalsPage.tsx — collapsible tree, progress bars, variance |
| Goal vs. actual comparison | ✅ | Progress percentages, variance badges |
| Goal progress indicators | ✅ | Color-coded (green ≥80%, yellow ≥50%, red <50%) |
| REST API endpoints | ✅ | GET /api/analytics/goals + PUT /progress with roll-up |
| Cascade summary | ✅ | Org overview, dept/team/rep totals, variance % |

**Scope:**
- [ ] `Goal` model with hierarchy (parent_id, level, target_value, actual_value)
- [ ] Auto-calculation: when org goal changes, distribute to departments by historical contribution
- [ ] Goals page in admin sidebar
- [ ] Real-time progress bars per level
- [ ] API: CRUD goals, recalculate cascade, get progress

---

## 3. Strategic Intelligence (FP&A Waterfall + Root Cause Tree) (✅ DONE)

**Landing page claim:** "FP&A-grade waterfall analysis and drillable root-cause trees. See every dollar explained."

| Feature | Status | Notes |
|---------|--------|-------|
| Revenue waterfall chart | ✅ | BarChart with +/− bars, 6-month trend |
| Variance analysis (budget vs. actual) | ✅ | Variance cards with trend arrows |
| Root cause drill-down tree | ✅ | Expandable tree, impact scores, action items |
| Factor decomposition | ✅ | Contribution analysis by source |
| Contribution analysis | ✅ | Pie chart + table breakdown |

**Scope:**
- [x] Waterfall chart component (Recharts custom or Nivo)
- [x] Backend: revenue variance calculation (actual vs. forecast vs. target)
- [x] Drill-down tree: revenue → deals → stages → contacts → sources
- [x] "Explain the gap" engine: what drove the variance?
- [x] New page: `/admin/strategic-intelligence`
- [x] API: waterfall data, variance breakdown, drill paths
- [x] Sidebar nav item added

---

## 4. Scale Optimization (ROAS, LTV:CAC, Budget Recommendations) (✅ DONE)

**Landing page claim:** "ROAS, LTV:CAC by product × channel × market. AI-powered budget reallocation."

| Feature | Status | Notes |
|---------|--------|-------|
| ROAS calculation per channel | ✅ | Per-channel ROAS from AdMetric + CrmDeal |
| LTV:CAC calculation | ✅ | (avg_deal_amount × 12mo) / (spend/conversions) |
| Product × channel × market matrix | ✅ | Heatmap grid with color-coded ROAS |
| Budget recommendation engine | ✅ | "Move $X from Y to Z" with projected lift |
| Connector data for ad spend | ✅ | AdMetric model with spend, conversions, ROAS |

**Scope:**
- [x] Overview cards: spend 30d/90d, ROAS, LTV:CAC, conversions, revenue, active campaigns
- [x] Channel performance table: sortable, ROAS color-coded (green ≥4x, yellow 2-4x, red <2x)
- [x] Product × channel × market heatmap
- [x] Budget recommendations: ranked by projected revenue lift, Apply button (localStorage)
- [x] New page: `/admin/scale-optimization`
- [x] API: overview, channels, matrix, recommendations
- [x] Sidebar nav item added

---

## 5. Smart Coaching (Recommendation Engine + Scorecards)

**Landing page claim:** "AI-powered coaching recommendations. Automated scorecards from live performance."

| Feature | Status | Notes |
|---------|--------|-------|
| Recommendation engine | ❌ | Not built |
| "Next move" suggestions | ❌ | Shown in hero mockup, not implemented |
| Rep scorecards | ❌ | Not built |
| Performance alerts | ❌ | Not built |
| Coaching tips based on data | ❌ | Not built |

**Scope:**
- [ ] Recommendation rules engine (if-then based on KPIs)
- [ ] Examples: "3 deals stalled >14 days in Qualification → nudge to move forward"
- [ ] Scorecard per rep (if multi-user) or per team
- [ ] "Next Move" card on dashboard
- [ ] Alert system: when KPIs drop below threshold
- [ ] New section on admin dashboard or separate `/admin/coaching` page
- [ ] API: recommendations, scorecards, alerts

---

## 6. Multi-Market / Multi-Location Views

**Landing page claim:** "Multi-location views. See each market performing."

| Feature | Status | Notes |
|---------|--------|-------|
| Per-market breakdown | ❌ | Single-tenant only |
| Location filter on all dashboards | ❌ | Not built |
| Market comparison charts | ❌ | Not built |

**Scope:**
- [ ] Add `market`/`location` field to deals, contacts
- [ ] Location filter dropdown on all admin pages
- [ ] Comparison view: side-by-side markets
- [ ] API: filter by market parameter

---

## 7. Demo Request Form (✅ DONE)

**Landing page claim:** Functional demo request form.

| Feature | Status | Notes |
|---------|--------|-------|
| Form on landing page | ✅ | Wired with submit handler, loading state, success/error states |
| Backend handler | ✅ | `POST /api/leads/demo-request` — validates, stores, sends email |
| Email notification | ✅ | via `app/utils/email.py` — configurable SMTP |
| Lead storage in DB | ✅ | `DemoRequest` model in models.py |
| Admin leads view | ✅ | `/api/super-admin/leads` returns DemoRequest records |

---

## 8. Pricing & Billing

**Landing page claim:** 3 tiers (Starter/Professional/Enterprise) + 7-day trial.

| Feature | Status | Notes |
|---------|--------|-------|
| Pricing tiers on page | ✅ | Displayed |
| Signup creates account | ✅ | Done |
| Trial timer | ❌ | No trial tracking |
| Stripe integration | ❌ | Not built |
| Payment page | ❌ | Not built |
| Subscription management | ❌ | Not built |
| Feature gating by tier | ❌ | All users have same access |

**Scope:**
- [ ] Stripe customer creation on signup
- [ ] Trial start/end dates in User model
- [ ] Payment page with Stripe Checkout
- [ ] Subscription webhook handler
- [ ] Feature gating: Starter gets X, Pro gets Y, Enterprise gets Z
- [ ] Billing management page in settings

---

## 9. Enterprise Features

**Landing page claims:**
- SSO/SAML (Enterprise) — ✅
- White-label branding — ✅
- Dedicated support — N/A (service promise)

**Implementation:**
- Backend: `app/routes/enterprise.py` — SAML config CRUD, SP metadata generation, ACS/SLO endpoints, branding settings
- Frontend: `frontend/src/pages/admin/EnterpriseSettingsPage.tsx` — two-tab UI (SSO/SAML + White-Label Branding)
- Types: `frontend/src/types/index.ts` — SSOConfig, BrandingSettings interfaces
- API: `frontend/src/api/enterpriseApi.ts` — REST client

| Feature | Status |
|---------|--------|
| SAML configuration form | ✅ |
| SP metadata XML endpoint | ✅ |
| ACS/SLO endpoints | ✅ |
| White-label branding form | ✅ |
| Custom logo upload | ✅ |
| Custom colors | ✅ |
| Custom domain config | ✅ |

---

## 10. See How Links

**Landing page:** 3 audience cards (Home Service, Roofing, Remodeling) with "See how" links.

| Feature | Status |
|---------|--------|
| Links to `#` | ❌ |

**Scope:**
- [ ] Create industry-specific landing pages or filter views
- [ ] Wire "See how" links to actual destinations

---

## 11. Field Companion Mobile App (Growth plan)

**Landing page claim:** "Mobile field companion app."

| Feature | Status |
|---------|--------|
| Mobile app | ❌ |

**Scope:** Not in scope for now. Requires React Native or Tauri mobile.

---

## 12. Multi-Tenant Connector Management

**Current state:** Connectors are global, not per-user/organization.

| Feature | Status | Notes |
|---------|--------|-------|
| Per-user connector CRUD | 🟡 | API exists but not scoped |
| Per-organization data isolation | ❌ | Not enforced |
| Connector limits by tier | ❌ | Not built |

**Scope:**
- [ ] Scope connectors to user/organization
- [ ] API: only return user's connectors
- [ ] Tier limits: Starter gets 2, Pro gets 5, Enterprise gets unlimited

---

## Priority Order

1. **Forecasting completion** (✅ DONE)
2. **Cascading Goals** (✅ DONE)
3. **Demo request form** (✅ DONE)
4. **Strategic Intelligence** (✅ DONE)
5. **Scale Optimization** (✅ DONE)
6. **Enterprise Features** (✅ DONE) — SSO/SAML, white-label branding
7. **Smart Coaching** — "Next Move" engine (NEXT)
8. **Multi-market views** — nice to have

## Dependencies

- Cascading Goals depends on Goal model being created
- Scale Optimization depends on ad spend tracking in Google Ads/FB connectors
- Billing depends on Stripe account setup
- Smart Coaching depends on KPI thresholds being defined