# Numu — Statuses, Actions, Agents & UI/UX — Implementation Report

**Date:** 2026-06-27 · **Scope:** reqs 1–9. All existing workflows, automations, labels, MCP APIs, and the AI-Agent architecture preserved (extended, not redesigned).

## 1. Implementation summary

| # | Requirement | Outcome |
|---|---|---|
| 1 | Startup status beside group (detail) + Status list column | ✅ Status badge added to the startup hero (distinct indigo pill); list already had a Status column |
| 2 | Investor status system (like startups) | ✅ `status_option_id` + `status` label + hero badge + list column + editable via `/label` |
| 3 | Investor status in MCP (read + update) | ✅ `investor_get` returns status; `investor_update` accepts `status_option_id` (fires the label event) |
| 4 | Rename "Startup Actions" → "Action Details", unified + Applies-To | ✅ New unified screen for startups **and** investors with an Applies-To filter |
| 5 | Agent controls inside Action Details (AI-only) | ✅ Allowed agents + policy radios, shown only for AI-enabled actions |
| 6 | Notification channels inside Action Details | ✅ Read-only channel chips per action, reused from the Labels `methods` config |
| 7 | Move AI Agents under Settings | ✅ Already under **Settings → AI Agents** (confirmed; not top-level) |
| 8 | UI/UX polish | ✅ Focused: consistent status badges, segmented filters, cards, empty states, responsive grids — design language preserved |

## 2. Database changes

- **Migration** `2026_06_27_100000_add_status_to_investors`:
  - `investors.status_option_id` — nullable FK → `label_options` (nullOnDelete), `after action_option_id`.
  - Seeds the parent **`status` label** (`type=investor`, `key=status`, `monday_column_id=investor.status`) so admins add the option values (Active / Interested / Follow Up / Not Interested / VIP) from the Labels screen. Idempotent; reversible.
- No other schema changes. No existing column/table touched.

## 3. API / MCP changes

- **`AiInvestorWriteController`** — `status_option_id` added to `ALLOWED_FIELDS` + validation; a status change fires **`InvestorLabelOptionChanged`** after commit (same lifecycle as the dashboard, so any armed status notification runs). Mirrors the startup status path exactly.
- **Read** — `AiInvestorController::get` returns `status_option_id` + resolved `status`; `InvestorResource` adds `status` to `label_options` + `display_names`; `statusOption` eager-loaded in the AI get + REST list (no N+1).
- Backward-compatible: all existing investor/startup fields + endpoints unchanged.

## 4. UI changes

- **Startup detail** — Status pill beside the Group pill in the hero (distinct indigo styling).
- **Investor detail** — Status pill beside the Group pill (mirrors startups).
- **Investor list** — new sortable **Status** column (indigo pill) in `columnCatalog` + `statusOption` eager-loaded.
- **Action Details** (`/admin/action-details`) — replaces "Startup Actions": Applies-To segmented filter (Both / Startups / Investors) + Env tabs; per-action cards showing **Notification channels** (Email/SMS/WhatsApp/Push/Internal, from label `methods`) and **Agent policies** (AI-enabled only) + add-policy form. Empty states throughout.
- **Sidebar** — `Settings → AI Agents` + `Settings → Action Details`; `Approvals` top-level. The agent details page now links to "Settings → Action Details".
- **Lang** — `nav.action_details`, `action_details.*`, investor `fields.status_option_id` (en + ar).

## 5. Migration summary

```
2026_06_27_100000_add_status_to_investors ........ DONE
  + investors.status_option_id (FK label_options)
  + labels row (investor / status)  [idempotent]
```
Run on deploy: `php artisan migrate`. (No data backfill required; existing investors have null status until set.)

## 6. Verification report

| Check | Result |
|---|---|
| `investors.status_option_id` column | ✅ present |
| Investor `status` label (for Labels screen) | ✅ id=46 |
| `Investor::statusOption` relation | ✅ |
| Investor list Status column | ✅ in catalog |
| Startup list Status column | ✅ (pre-existing) |
| Startup + investor hero status badge | ✅ renders |
| MCP `investor_update` whitelists status + fires event | ✅ (live smoke: status set, `InvestorLabelOptionChanged` fired) |
| MCP `investor_get` returns status | ✅ (live smoke) |
| Action Details unified render | ✅ 9 startup + 7 investor actions; notification chips + policies |
| Old `startup-actions` route removed | ✅ |
| AI Agents under Settings (not top-level) | ✅ |
| All Blade views compile | ✅ `view:cache` clean |
| Full test suite | ✅ 72 passed (only the pre-existing unrelated `ExampleTest` fails) |
| Existing automations / labels / MCP / agents | ✅ untouched (extended only) |

## 7. Notes
- Investor status **option values** are intentionally left for the admin to create from the Labels screen (only the parent label is seeded), per the request.
- Action Details reuses the existing Labels notification config + the Phase-2 `ActionPolicyService` — no business logic duplicated; it is a read/aggregate + the existing policy writer.
