---
name: csm-goals-copilot
display_name: CSM Goals Copilot
description: "Data-first 2026 CSM IC Goals companion. Auto-pulls your accounts, pipeline, activities, certifications, and TFC status from AWSentral, PhoneTool, Browser (skills.amazon.com + TFC Hub). Drafts SMART goals, tracks progress, logs activities, and generates Player Card content. Works for any US AGS CSM. Use when someone says 'goals copilot', 'my csm goals', 'check my goals', 'goal discovery', 'log activity', 'how am I tracking', 'suggest goals', 'goals status', 'update my goals', 'generate player card', or 'enter my goals'."
icon: "🎯"
trigger: goals copilot
depends-on:
  - user_mcp__aws_sentral_mcp
  - quick_suite__phone_tool
  - outlook_builtin
  - browser
  - knowledge_graph
  - quick_suite__spaces
inputs:
  - name: csm_alias
    description: "CSM's Amazon alias. If omitted, auto-detected from PhoneTool Me()."
    type: string
    required: false
  - name: mode
    description: "Operating mode: discover, check, log, generate. If omitted, auto-detected from trigger phrase."
    type: string
    required: false
tools: [run_python, run_javascript, file_write, file_read, file_read_docx, file_edit, open_in_session_tab, open_file, file_copy, download_file]
---

# CSM Goals Copilot — 2026 AGS US CSM IC Goals

## Overview

Data-first 2026 CSM IC Goals companion for any US AGS CSM. Auto-pulls your accounts, pipeline, activities, certifications, and TFC status from AWSentral, PhoneTool, Browser (skills.amazon.com), and QuickSight (TFC dashboard via Quick Suite Spaces API) — then drafts SMART goals, tracks progress across all 5 pillars (CI/AO/TL/TFC/TE), logs activities with optimal pillar allocation, and generates Player Card content or Goals DOCX documents.

## 2026 AGS US CSM IC Goals — Framework Reference

### The 5 Pillars (with 1-line explanation each)

| # | Pillar | Abbrev | Weight | 1-Line Explanation |
|---|--------|--------|--------|-------------------|
| 1 | **Customer Impact** | CI | 40% | Deliver measurable business outcomes (pipeline, ARR, Big Rocks) across your account portfolio aligned to G1–G5 Tech Goals. |
| 2 | **Advancing the Org** | AO | 15% | Scale your impact beyond your accounts — mentoring, tooling, knowledge shares, VOC, and team contributions. |
| 3 | **Thought Leadership** | TL | 20% | Create reusable content (blogs, talks, whitepapers, sessions) that elevates AWS and your domain expertise. |
| 4 | **Technical Field Communities** | TFC | 10% | Active participation in TFCs — earn points through community engagement, content creation, and peer support. |
| 5 | **Technical Excellence** | TE | 15% | Maintain certifications, attend enablement sessions, and stay current on AWS services and GenAI fluency. |

### G1–G5 Tech Goals (with 1-line explanation each)

| Goal | Name | 1-Line Explanation |
|------|------|-------------------|
| G1 | GenAI | Drive Bedrock, AgentCore, Q Developer, SageMaker, and other AI/ML adoption — the #1 priority for 2026. |
| G2 | Migration | Accelerate cloud migrations via MAP, VMCCO, SAP RISE, and mainframe modernization programs. |
| G3 | Security & Resilience | Improve customer security posture through SHIP, SIP, DrPET, Security Journeys, and resilience programs. |
| G4 | Adoption & Expansion | Grow NGU (net-new service) adoption and expand existing workloads to increase customer spend. |
| G5 | Modernization | Drive application modernization via ModAx EBA, containers, serverless, and modern architectures. |

### Rating Scale (applies to CI, AO, TL)

| Rating | Level | Description |
|--------|-------|-------------|
| 1 | Foundational | Below minimum expectations |
| 2 | Developing | Meeting basic requirements |
| 3 | Delivering | Solid, consistent performance — the baseline target |
| 4 | Outstanding | Exceeding expectations with differentiated impact |
| 5 | Distinguished | Exceptional, org-wide influence |

### TFC Rating Scale

| Rating | Status |
|--------|--------|
| 1 | Not a TFC member or AOD resting, 0 pts |
| 2 | AOD / Ambassador with points |
| 3 | Bronze — on track for 40 pts |
| 4 | Silver — on track for 80 pts |
| 5 | Gold — on track for 160 pts |

### TE Rating Scale (max 4, not 5)

| Rating | Points | Description |
|--------|--------|-------------|
| 1 | 0–6 | Below — missing mandatory certs |
| 2 | 7 | Meets Expectations — all 4 mandatory certs |
| 3 | 8–11 | Exceeds — mandatory + additional certs |
| 4 | 12+ | Outstanding — deep certification portfolio |

### TE Mandatory Certifications

1. AWS AI Practitioner (+L100 accreditation) — 2 pts
2. AWS Solutions Architect – Associate — 2 pts
3. Associate Speaker — 2 pts
4. GenAI L200 (by Q2) — 1 pt
Total mandatory: 7 pts = Rating 2 (Meets)

---

## Workflow

### Step 0: Welcome & Pre-Flight Auth Check

**This MUST be the very first thing displayed when the skill is triggered.**

Display this welcome message:

> 🎯 **Welcome to CSM Goals Copilot — your 2026 IC Goals companion.**
>
> I'm going to pull your data from AWSentral, PhoneTool, skills.amazon.com, and TFC Hub to give you a complete picture of where you stand across all 5 pillars (CI, AO, TL, TFC, TE).
>
> **Before I start, let me check your integrations:**

Then immediately check and display the integration status:

```
🔌 INTEGRATION STATUS:

Required (skill will NOT work without these):
  [✅/❌] AWSentral MCP — accounts, pipeline, activities, logging
         → Enable at: Settings → Capabilities → Connections → Advanced Integrations → search "AWSentral" → Connect
         → After connecting, authenticate via Midway when prompted

  [✅/❌] Phone Tool — auto-detect your name, level, manager, org
         → Enable at: Settings → Capabilities → Connections → Quick Suite → search "Phone Tool" → Connect

  [✅/❌] Browser (Chrome remote debugging) — REQUIRED for certifications (TE pillar)
         → This is MANDATORY. Without it, the TE pillar cannot be scored.
         → To enable:
           1. Open Chrome (must be Chrome, not another browser)
           2. Go to chrome://flags in the address bar
           3. Search for "remote debugging" and enable it
           4. Restart Chrome after enabling
           5. Alternatively, open chrome://inspect and ensure remote targets are visible
         → After enabling, say "done" and I'll verify the connection.

Recommended (enhances the experience, but not required):
  [✅/❌] Quick Suite Spaces — REQUIRED for TFC pillar (pulls TFC QuickSight dashboard data)
         → Should be auto-available if user has Quick Suite enabled

  [✅/❌] Outlook — scan calendar for enablement sessions, training events
         → Enable at: Settings → Capabilities → Connections → Outlook → Connect


  [✅/❌] Slack — TFC channel membership, community engagement tracking
         → Enable at: Settings → Capabilities → Connections → Slack → Connect
```

### Handling Missing Required Integrations

**When a REQUIRED integration shows ❌, do NOT proceed.** Follow this pattern for EACH missing required integration:

1. **Tell them what they're missing** — explain what data this integration provides
2. **Give exact steps to enable it** — not generic "go to settings" but the exact click path
3. **Offer to retry** — "Once you've enabled it, say 'done' and I'll check again"
4. **WAIT for user confirmation** — do NOT auto-skip required integrations

**Browser is MANDATORY because:**
- **TE Pillar**: Navigate to `https://skills.amazon.com/users/{alias}` to pull the full certification inventory (cert names, dates, types, point values)
- Without browser, the TE pillar (15% of the total score) cannot be assessed

**Runtime errors (Midway expiry during assessment):**
If AWSentral calls fail mid-assessment with "AEA verification failed" or "Request Forbidden":
> "⚠️ Your Midway session has expired. Please:"
> 1. Go to **midway-auth.amazon.com** in your browser
> 2. Complete the authentication
> 3. Come back here and say **'retry'**
> "I'll pick up where I left off."

### Ready to Go?

After showing the integration status AND all required integrations show ✅, ask for confirmation:

> "All required integrations are connected! Ready? I'll pull your accounts, pipeline, activities, certs, and TFC status and give you a full scorecard. This takes about 60 seconds."
>
> Options: **"Let's go!"** | "Just log an activity" | "Just generate a document"

**IMPORTANT:** Do NOT proceed until the user confirms. If they say "done" after enabling browser, re-check the browser connection before proceeding.

---

### Step 1: Identity & Data Collection

**Mode**: `deterministic`

Once the user says "Let's go!", immediately fire these calls in parallel:

1. `phone_tool__Me` → get alias
2. `phone_tool__GetEmployeeDetailByAlias` → get name, level, manager, org, cost center
3. `aws_sentral_mcp__get_my_personal_details` → get SFDC User ID
4. `aws_sentral_mcp__list_user_assigned_accounts` → get account portfolio
5. `aws_sentral_mcp__search_opportunities` → get open pipeline (filter: isClosed=false, closeDate >= 2026-01-01, ownershipFilter: alias=associated)
6. `aws_sentral_mcp__search_tasks` → get logged activities (filter: ownerId, activityDate 2026-01-01 to 2026-12-31)
7. `aws_sentral_mcp__search_events` → get logged events (same date filter)
8. `aws_sentral_mcp__sift_insights_listMyInsights` → get ALL SIFT insights authored by the CSM (paginate if needed — pageSize=100)

**Date ranges — CRITICAL**: ALL data queries MUST use the current assessment year: `2026-01-01` to `2026-12-31`. Never use `datetime.now()`. This applies to tasks, events, opportunities, and SIFT insights. For SIFT, filter by `dateRangeStart` = `2026-01-01T00:00:00.000Z` and `dateRangeEnd` = `2026-12-31T23:59:59.000Z` if using `sift_insights_search` instead.

**Validation:**
- sfdc_user_id must be present
- accounts list must be non-empty
- On failure: Try `get_registry_assignments` fallback; ask for alias manually

---

### Step 2: Browser Data Collection (MANDATORY)

**Mode**: `deterministic`

After Step 1 data is collected, use the browser skill to pull TE and TFC data.

#### Step 2a: Certifications from skills.amazon.com

1. Load the browser skill: `use_skill("browser")`
2. Launch browser: `browser_launch`
3. Navigate to: `https://skills.amazon.com/users/{alias}/edit` — use the **EDIT page**, NOT the profile page. The edit page has a structured table with cert names, validation codes, and **Date Acquired** columns.
4. Wait for page load (`browser_wait(timeout=10000)`), then use `browser_read_page()` to extract text.
5. Extract the certification inventory from the page text. The page has two sections:
   - **"AWS/PR Certifications"** — table rows with: Certification name | Certificate/Validation Number | Date Acquired (YYYY/MM/DD format)
   - **"Industry Certifications"** — same table format
6. Parse each cert row to extract: name, validation code, date_acquired (YYYY/MM/DD string).

**AWS Certification Expiry — 3-Year Rule (CRITICAL):**

AWS **official exam certifications** are **valid for exactly 3 years** from the Date Acquired. You MUST check expiry for every AWS exam cert. **Exemptions from expiry check** (these are NOT standard AWS exam certs and do NOT expire):
- **AWS Associate Speaker Certification** — this is a program-based certification, not an AWS exam. No expiry.

Apply the 3-year expiry check to all OTHER AWS/PR certs (Solutions Architect, Developer, Cloud Practitioner, AI Practitioner, ML Engineer, GenAI Developer, etc.):

```python
from datetime import datetime, timedelta

# Use the date the skill is invoked as "today" (hardcode as 2026-04-30 or current assessment date)
today = datetime(2026, 4, 30)  # <-- assessment date
THREE_YEARS = timedelta(days=365 * 3)

# Certs EXEMPT from expiry check (always valid regardless of date)
EXPIRY_EXEMPT = [
    "AWS Associate Speaker Certification",
]

for cert in aws_certs:
    if cert["name"] in EXPIRY_EXEMPT:
        cert["is_valid"] = True
        cert["expires_date"] = "N/A (exempt)"
        continue
    acquired = datetime.strptime(cert["date_acquired"], "%Y/%m/%d")
    expires = acquired + THREE_YEARS
    cert["is_valid"] = expires > today
    cert["expires_date"] = expires.strftime("%Y/%m/%d")
```

**Only count points for VALID (non-expired or exempt) AWS certs.** Expired certs:
- Do NOT count toward the TE point total
- Do NOT satisfy mandatory cert requirements
- ARE still listed in the report but marked as ❌ EXPIRED with the expiry date
- **Exception**: Speaker cert and Industry certs are always valid — no expiry check

**Industry certifications have NO expiry** — always count them regardless of Date Acquired. Same for Speaker cert.

7. Map each **valid** cert to TE point values:
   - Industry / Practitioner / Accreditation = 1 pt each (Industry certs: no expiry check)
   - Associate = 2 pts each (AWS certs: must be valid / not expired)
   - Professional / Specialty = 3 pts each (AWS certs: must be valid / not expired)
8. Check for the 4 mandatory certs — **only valid (non-expired) certs count**:
   - AWS AI Practitioner (+L100 accreditation)
   - AWS Solutions Architect – Associate
   - Associate Speaker
   - GenAI L200
9. Calculate TE total: sum of points from VALID certs only (expired certs = 0 pts)
10. In the report, show the full cert table with a "Status" column:

| Cert Name | Type | Points | Mandatory? | Date Acquired | Expires | Status |
|-----------|------|--------|------------|---------------|---------|--------|
| AWS Certified AI Practitioner | Practitioner | 1 | ✅ Yes | 2024/09/07 | 2027/09/07 | ✅ Valid |
| AWS Certified SA - Associate | Associate | 0 | ✅ Yes | 2020/11/15 | 2023/11/15 | ❌ EXPIRED |
| PMP | Industry | 1 | — | 2019/07/26 | N/A | ✅ Valid (no expiry) |

**If mandatory certs are expired, flag prominently:**
> "⚠️ MANDATORY CERT EXPIRED: AWS Solutions Architect – Associate expired on 2023/11/15. You must recertify to meet TE mandatory requirements."

#### Step 2b: TFC Status from QuickSight Dashboard

**⚠️ IMPORTANT — Source of Truth:** The TFC QuickSight dashboard is the **sole source of truth** for TFC IC goal scoring. AWS Skills (`skills.amazon.com/skill_ratings/tfc`) only shows self-reported skill ratings — it does NOT track contributions, points, or membership status. **Never use AWS Skills data for TFC pillar scoring.**

**Data collection cascade:**
1. **Quick Suite Spaces API** (`get_dashboard_sheet`) — preferred, fastest
2. **Browser fallback** — navigate to the actual QuickSight dashboard when API returns 0 rows
3. **Manual user input** — last resort only

**Dashboard coordinates:**
- Dashboard ARN: `arn:aws:quicksight:us-east-1:amazonbi:dashboard/734b2acb-da82-4f96-8b82-1729cecfd1d6`
- Dashboard URL (for browser fallback): `https://us-east-1.quicksight.aws.amazon.com/sn/account/amazonbi/dashboards/734b2acb-da82-4f96-8b82-1729cecfd1d6`
- Sheet ID: `734b2acb-da82-4f96-8b82-1729cecfd1d6_f2753d29-2dca-499f-8c93-ede655966bc5`
- Sheet name: "2026 TFC IC Dashboard"

**Key filter:**
- TFC Alias filter ID: `31b5ea03-0347-43cb-b765-2ca14df6d6f3`
- Set this to the CSM's alias discovered in Step 1
- **Do NOT set the "Reporting Month End" date filter** — omit it entirely and let the dashboard use its default (Live data mode)

##### Method 1: Quick Suite Spaces API (Preferred)

1. Load the Quick Suite Spaces skill: `use_skill("quick_suite__spaces")`
2. Call `get_dashboard_sheet` with:
   ```
   dashboard_arn = "arn:aws:quicksight:us-east-1:amazonbi:dashboard/734b2acb-da82-4f96-8b82-1729cecfd1d6"
   sheet_id = "734b2acb-da82-4f96-8b82-1729cecfd1d6_f2753d29-2dca-499f-8c93-ede655966bc5"
   filter_overrides = {"31b5ea03-0347-43cb-b765-2ca14df6d6f3": "{alias}"}
   ```
3. **Parse the response correctly:**
   - Data is in each visual's `rows` array and `headers` array
   - `headers` = list of column name strings
   - `rows` = list of data row arrays (each a list of values matching header positions)
   - Use `zip(headers, row)` to build dicts for each data row

**Key visuals to extract:**

| Visual Index | Chart Title | Type | What to Extract |
|---|---|---|---|
| 0 | "TFC Membership Details & YTD Activity Contribution - Raw Data" | TABLE | **Primary data source.** Each row = one TFC community membership. Columns: `community`, `login`, `tfc_role`, `tfc_member_status`, `Active/Not - Active`, `achieved_competency`, `inprogress_competency`, `join_date`, `mentor`. Points columns have GUID names (e.g. `89a0d513-...` and `0bcbd98b-...`). |
| 4 | "TFC Total Member Activity Contribution & Points - YTD" | LINE_CHART | Historical monthly trend. Columns: `end_date`, `Total Activity Points`, `Total Activity Contribution`. Shows cumulative points by month. |
| Last-2 | "TFC Membership Details & YTD Activity Contribution - By TFC" | TABLE | Alternate view with community-level breakdown including `min_bronze_for_active_membership`, `min_silver_for_active_membership`, `min_gold_for_active_membership` thresholds. |

**Parsing example (Python):**
```python
visuals = dashboard_data["data"]["dashboard_context"]["visuals"]

# Visual 0: Membership details
membership_viz = visuals[0]
headers = membership_viz["headers"]
for row in membership_viz["rows"]:
    row_dict = dict(zip(headers, row))
    community = row_dict.get("community", "")
    tfc_role = row_dict.get("tfc_role", "")
    status = row_dict.get("tfc_member_status", "")
    active = row_dict.get("Active/Not - Active", "")
    achieved = row_dict.get("achieved_competency", "")
    join_date = row_dict.get("join_date", "")

# Visual 4: Historical points
points_viz = visuals[4]
pts_headers = points_viz["headers"]
for row in points_viz["rows"]:
    row_dict = dict(zip(pts_headers, row))
    month = row_dict.get("end_date", "")
    points = int(row_dict.get("Total Activity Points", "0"))
    contributions = int(row_dict.get("Total Activity Contribution", "0"))
```

4. **Check if API returned actual data:** If ALL visuals have 0 rows (`len(rows) == 0` for every visual), proceed to **Method 2 (Browser Fallback)** — do NOT skip to manual input.

##### Method 2: Browser Fallback (when API returns 0 rows for all visuals)

**When to use:** Only when Method 1 (API) returns 0 rows for ALL visuals. The API may return empty results even when the dashboard visually has data due to QuickSight API limitations.

**⚠️ QuickSight renders via canvas** — `browser_read_page()` and standard DOM text extraction return minimal or no content. You must use a combination of JS-based extraction (`document.querySelectorAll('[aria-label]')`) and screenshots.

**Steps:**

1. Navigate to the dashboard: `browser_navigate("https://us-east-1.quicksight.aws.amazon.com/sn/account/amazonbi/dashboards/734b2acb-da82-4f96-8b82-1729cecfd1d6")`
2. Wait for the page to load — QuickSight dashboards are slow. Use `browser_wait(timeout=15000)`.
3. Dismiss any popups — look for "Done" or "close" buttons in page_state and click them.
4. Click the **"2026 TFC IC Dashboard"** sheet tab — find it in page_state as `div role=tab "2026 TFC IC Dashboard"` and click it.
5. Wait for visuals to render — use `browser_wait(timeout=10000)`.
6. **Verify the TFC Alias filter** is set to the CSM's alias — look in page_state for `div role=StaticText [clickable]` next to "TFC Alias". If it's not set, click the filter and type the alias.
7. **Extract KPI values** using JS:
   ```javascript
   // Extract all aria-labels which contain KPI titles and values
   const labels = [];
   document.querySelectorAll('[aria-label]').forEach(el => {
       const label = el.getAttribute('aria-label');
       if (label && /point|member|resting|bronze|silver|gold|aspir|ambass|contribution/i.test(label)) {
           labels.push(label);
       }
   });
   return labels;
   ```
   Also check for DOM list items with value attributes:
   ```
   li role=StaticText "Total Activity Points" value="0"
   li role=StaticText "Total Activity Contribution" value="0"
   ```
8. **Scroll down** to find the **"TFC Membership Details & YTD Activity Contribution - By TFC"** TABLE widget. This is the key data source for browser extraction — it contains:
   - All TFC community names the user belongs to
   - TFC Role for each community
   - **Requires horizontal scrolling within the widget** to see additional columns: current points, overall TFC member status (`Resting`, `Bronze`, `Silver`, `Gold`), and `Active/Not - Active` status
9. To scroll within the table widget: use `browser_scroll(element_id=<table_widget_id>, direction="down")` to find the row, then use `browser_run_js` to scroll the table container horizontally:
   ```javascript
   // Find and scroll the table container horizontally
   const tableContainer = document.querySelector('[class*="grid-container"]');
   if (tableContainer) { tableContainer.scrollLeft += 500; }
   ```
10. Take a screenshot (`browser_screenshot(save=True)`) after each scroll to read the data visually via `file_read_image`.
11. Look for **"No data found for visual"** text in page_state — this confirms genuinely empty data (Resting state).

##### Method 3: Manual Input (Last Resort)

Only if BOTH Method 1 and Method 2 fail (e.g., browser cannot load QuickSight, or dashboard is completely down):
- Ask the user: "I couldn't pull your TFC data automatically. Can you tell me: (1) Which TFC communities are you a member of? (2) What's your current TFC member status? (3) How many points have you earned YTD?"

**TFC scoring logic:**
- If no communities found → Rating 1
- If member but 0 YTD points → Rating 1 (Resting/Not Active)
- If Ambassador status with 0 points → still Rating 1 (Ambassador status alone ≠ active)
- Check `tfc_member_status` field: "Ambassador", "Resting", "Bronze", "Silver", "Gold"
- Check `Active/Not - Active` field: "Active", "Not Active", "Not Applicable"
- Use the TFC Rating Scale from the framework reference
- If multiple communities exist, report ALL of them with per-community status

---

### Step 3: Analysis & Scoring

**Mode**: `agentic`

Using ALL data collected from Steps 1–2, build the comprehensive assessment.

#### CI (Customer Impact) — 40% weight

Analyze:
- Account portfolio (how many accounts, which territories)
- Open pipeline (total $, stage distribution)
- Big Rocks identified (opportunities tagged #BigRock)
- GenAI/AIML opportunities (G1 alignment)
- G-Goal coverage across pipeline (G1–G5)
- Accounts with NO open opportunities (gap)
- Activity coverage per account

Score CI on:
- Number of accounts with active engagement
- Pipeline breadth and depth
- G-Goal coverage
- Big Rock progress
- GenAI pipeline strength (G1 is #1 priority)

#### AO (Advancing the Org) — 15% weight

Analyze:
- Activities categorized as "Org Capabilities" or "Program Execution"
- Mentoring, knowledge shares, tooling contributions
- Cross-team impact

#### TL (Thought Leadership) — 20% weight

Analyze:
- Activities categorized as "Thought Leadership"
- Blog posts, speaking engagements, whitepapers
- PFR curations
- **SIFT insights authored** — pulled in Step 1 via `sift_insights_listMyInsights`. Count ALL insights created in 2026 (filter by `createdAt` date). For each insight, extract:
  - Title, category (Highlight/Lowlight/Risk/Observation/Blocker/Challenge/Health of Business)
  - Associated accounts and opportunities
  - Creation date
  - Salesforce URL: `https://aws-crm.lightning.force.com/lightning/n/Sales_Insights_Field_Trends?c__insightId={id}`
- SIFT insights count toward AO and/or TL scoring depending on content — field observations/VOC = AO, published thought pieces = TL

#### TFC (Technical Field Communities) — 10% weight

Score using browser-extracted data from Step 2b:
- Membership status
- Points earned
- Tier achieved
- Apply TFC Rating Scale

#### TE (Technical Excellence) — 15% weight

Score using browser-extracted data from Step 2a:
- Mandatory certs check (4 required)
- Additional certs inventory
- Total points
- Apply TE Rating Scale (max 4)
- Also check: quarterly enablement sessions attended (from Outlook calendar if available)

---

### Step 4: Report Generation

**Mode**: `deterministic`

Generate a detailed, formatted report as an **HTML file** and open it in a session tab.

**Output format**: Generate the report as `artifacts/csm_goals_assessment.html` using the `html_design` skill theme tokens. Load `use_skill("html_design")` and `use_skill("highcharts")` first for styling and chart support.

**HTML report requirements:**
- Use a clean, professional dashboard layout with the html_design skill's theme tokens (background, card surfaces, typography)
- Include a sticky header with CSM name, alias, assessment date, and overall weighted score
- Each pillar section should be a collapsible card with status indicator (🟢/🟡/🔴)
- All SFDC record references MUST be clickable `<a href="..." target="_blank">` links — accounts, opportunities, tasks, events, SIFT insights
- Tables should be sortable where appropriate (pipeline table, activity timeline)
- The Overall Scorecard should be a prominent visual at the top (use Highcharts gauge or bar chart if appropriate)
- Include a "Pipeline by Stage" donut/pie chart (Highcharts)
- Include a "Monthly Activity Timeline" bar chart (Highcharts)
- Include a "G-Goal Coverage" radar or matrix chart (Highcharts)
- Cert table MUST show the expiry date and ✅/❌ status with color coding (green for valid, red for expired)
- SIFT insights table should link each title to SFDC
- TFC section should show community membership cards with status badges
- The Top Actions section should use priority color coding (🔴 red border, 🟡 amber, 🟢 green)
- Footer with data sources and timestamp

**After generating the HTML file:**
1. Save to `artifacts/csm_goals_assessment.html`
2. Open with `open_in_session_tab("artifacts/csm_goals_assessment.html", title="🎯 2026 CSM Goals Assessment")`

**Link formatting in HTML:**
```html
<!-- Account link -->
<a href="https://aws-crm.lightning.force.com/lightning/r/Account/{accountId}/view" target="_blank">{Account Name}</a>

<!-- Opportunity link -->
<a href="https://aws-crm.lightning.force.com/lightning/r/Opportunity/{oppId}/view" target="_blank">{Opp Name}</a>

<!-- SIFT Insight link -->
<a href="https://aws-crm.lightning.force.com/lightning/n/Sales_Insights_Field_Trends?c__insightId={id}" target="_blank">{Insight Title}</a>
```

The report MUST include:

#### SFDC Hyperlinks — MANDATORY

Every SFDC record referenced in the report MUST include a clickable hyperlink to the record in Salesforce. Use these URL patterns:

| Record Type | URL Pattern |
|---|---|
| Account | `https://aws-crm.lightning.force.com/lightning/r/Account/{accountId}/view` |
| Opportunity | `https://aws-crm.lightning.force.com/lightning/r/Opportunity/{opportunityId}/view` |
| Task/Activity | `https://aws-crm.lightning.force.com/lightning/r/Task/{taskId}/view` |
| Event | `https://aws-crm.lightning.force.com/lightning/r/Event/{eventId}/view` |
| SIFT Insight | `https://aws-crm.lightning.force.com/lightning/n/Sales_Insights_Field_Trends?c__insightId={insightId}` |
| User | `https://aws-crm.lightning.force.com/lightning/r/User/{userId}/view` |

In Markdown output, format as: `[Account Name](https://aws-crm.lightning.force.com/lightning/r/Account/{id}/view)`

This applies to: account names in the portfolio table, opportunity names in pipeline tables, activity subjects in the activity timeline, and SIFT insight titles.

#### Quick-Action Links — MANDATORY

The report MUST include a dedicated "Quick Links" bar (near the top of the report, below the overall scorecard) with direct links to the tools the CSM needs to act on their gaps. These are NOT SFDC record links — they are links to external tools and dashboards.

| Link Label | URL Pattern | When to Show |
|---|---|---|
| 📝 Manage Certifications | `https://skills.amazon.com/users/{alias}/edit` | Always |
| 🏘️ TFC Dashboard | `https://us-east-1.quicksight.aws.amazon.com/sn/account/amazonbi/dashboards/734b2acb-da82-4f96-8b82-1729cecfd1d6` | Always |
| 📊 My AWSentral | `https://aws-crm.lightning.force.com/lightning/page/home` | Always |
| 📋 Log a Tech Activity | `https://aws-crm.lightning.force.com/lightning/o/Task/new` | Always |
| 📝 Create SIFT Insight | `https://aws-crm.lightning.force.com/lightning/n/Sales_Insights_Field_Trends` | Always |

Format these as a horizontal row of styled buttons/pills at the top of the report. Example HTML:
```html
<div style="display:flex; gap:8px; flex-wrap:wrap; margin:12px 0;">
  <a href="https://skills.amazon.com/users/{alias}/edit" target="_blank" 
     style="padding:6px 12px; background:#1f6feb20; color:#58a6ff; border-radius:6px; text-decoration:none; font-size:12px;">
    📝 Manage Certs
  </a>
  <!-- repeat for each link -->
</div>
```

#### Activity Table — Clickable Task Links

The Activities YTD table MUST make each activity subject a clickable link to the SFDC Task record. This is critical because the primary action from the "Activity Tagging Gap" alert is to click into each activity and re-tag it with proper SA Activity codes.

Format: `<a href="https://aws-crm.lightning.force.com/lightning/r/Task/{taskId}/view" target="_blank">{activity subject}</a>`

If a task ID is not available (e.g., was not returned by the search API), show the subject as plain text.

Similarly:
- **Opportunity names** in pipeline/Big Rocks tables → link to `https://aws-crm.lightning.force.com/lightning/r/Opportunity/{oppId}/view`
- **Account names** in portfolio table → link to `https://aws-crm.lightning.force.com/lightning/r/Account/{accountId}/view`
- **SIFT insight titles** → link to `https://aws-crm.lightning.force.com/lightning/n/Sales_Insights_Field_Trends?c__insightId={insightId}`

**These links are what make the scorecard actionable, not just informational.** Without them, the CSM has to manually search SFDC for each record. With them, they can click and fix issues immediately.

#### Section 1: CSM Profile
- Name, alias, level, manager, org, territory
- Account portfolio with territory names
- Date of assessment

#### Section 2: Overall Scorecard

| Pillar | Weight | Score | Rating | Status |
|--------|--------|-------|--------|--------|
| CI — Customer Impact | 40% | X/5 | [Rating Name] | 🟢/🟡/🔴 |
| AO — Advancing the Org | 15% | X/5 | [Rating Name] | 🟢/🟡/🔴 |
| TL — Thought Leadership | 20% | X/5 | [Rating Name] | 🟢/🟡/🔴 |
| TFC — Technical Field Communities | 10% | X/5 | [Rating Name] | 🟢/🟡/🔴 |
| TE — Technical Excellence | 15% | X/4 | [Rating Name] | 🟢/🟡/🔴 |
| **Weighted Total** | 100% | **X.XX/5** | | |

Status legend: 🟢 = Rating 3+ (on track), 🟡 = Rating 2 (needs attention), 🔴 = Rating 1 (critical gap)

#### Section 3: Detailed Pillar Breakdowns

For EACH pillar, provide:
1. **What this pillar measures** (1-line explanation)
2. **Raw data** — everything pulled from systems
3. **Scoring rationale** — how the score was calculated
4. **Rating** — projected rating with framework reference
5. **Gaps identified** — specific things missing
6. **Recommended actions** — concrete steps to improve

#### Section 4: G-Goal Mapping

Map ALL opportunities and activities to G1–G5:

| G-Goal | Opportunities | Activities | Coverage |
|--------|--------------|------------|----------|
| G1 GenAI | [list] | [list] | ✅/⚠️ |
| G2 Migration | [list] | [list] | ✅/⚠️ |
| G3 Security | [list] | [list] | ✅/⚠️ |
| G4 Adoption | [list] | [list] | ✅/⚠️ |
| G5 Modernization | [list] | [list] | ✅/⚠️ |

#### Section 5: Certification Inventory

Full cert list from skills.amazon.com/users/{alias}/edit:

| Cert Name | Type | Points | Mandatory? | Date Acquired | Expires | Status |
|-----------|------|--------|------------|---------------|---------|--------|
| ... | ... | ... | ✅/— | YYYY/MM/DD | YYYY/MM/DD or N/A | ✅ Valid / ❌ EXPIRED |

- **AWS certs are valid for 3 years from Date Acquired.** Expired certs score 0 points.
- **Industry certs have no expiry** — always valid.
- Show TOTAL points as: "X pts (Y valid AWS + Z industry) — W expired AWS certs excluded"
Mandatory certs checklist:
- [✅/❌] AWS AI Practitioner
- [✅/❌] AWS Solutions Architect – Associate
- [✅/❌] Associate Speaker
- [✅/❌] GenAI L200

#### Section 6: TFC Dashboard

TFC membership and points from TFC Hub:

| TFC Community | Status | Points | Tier |
|---------------|--------|--------|------|
| ... | ... | ... | ... |

#### Section 7: SIFT Insights (2026 YTD)

All SIFT insights authored by the CSM in the current year:

| # | Title | Category | Accounts | Created | SFDC Link |
|---|-------|----------|----------|---------|-----------|
| 1 | [Title](sfdc_url) | Highlight/Risk/etc. | [Account names] | YYYY-MM-DD | [View](sfdc_url) |

- Total insights authored in 2026: X
- Categories breakdown: X Highlights, X Risks, X Observations, etc.
- SIFT insights contribute to **AO** (field observations, VOC) and/or **TL** (published thought leadership) pillar scoring

#### Section 8: Top Actions (Priority-Ranked)

Ranked list of the most impactful actions the CSM should take, with:
- Priority (🔴 Critical / 🟡 Important / 🟢 Maintain)
- Action description
- Which pillar(s) it improves
- Estimated rating impact

#### Section 9: Monthly Activity Timeline

| Month | Activities Logged | Category Mix | Notes |
|-------|------------------|--------------|-------|
| Jan | X | ... | ... |
| Feb | X | ... | ... |
| ... | ... | ... | ... |

---

### Step 5: Post-Assessment Menu

**Mode**: `agentic`

**ALWAYS show this menu after delivering the report.** Present as a decision card:

> "Your full assessment is ready. What would you like to do next?"

Options:
- 💡 Get suggestions to meet my goals
- 📝 Log an AO/TL activity to AWSentral
- 🔧 Work on my gaps (deep dive weakest pillar)
- ✏️ Review/edit SMART goals
- 📄 Generate a document (Player Card, Goals Summary DOCX, Manager Report)
- 📧 Email this report to myself
- 🔄 Set up weekly tracking agent

---

## Mode Detection

Detect the operating mode from the user's trigger phrase:

| Trigger Phrases | Mode |
|---|---|
| "goals copilot", "my csm goals", "full assessment", "check all goals", "where do I stand", "run assessment", "check my goals" | **Mode 0: FULL ASSESSMENT** (default) |
| "set up my goals", "suggest goals", "goal discovery" | **Mode 1: DISCOVER** |
| "how am I doing", "check my goals", "goals status", "how am I tracking" | **Mode 2: CHECK** (same as Full Assessment) |
| "log activity", "record activity", "log a call" | **Mode 3: LOG** |
| "generate player card", "goals document", "export goals" | **Mode 4: GENERATE** |

---

## Error Handling

### Midway Session Expiry
If any AWSentral call returns "AEA verification failed" or "Request Forbidden":
1. Pause the assessment
2. Tell the user: "⚠️ Your Midway session has expired."
3. Give fix steps: Go to midway-auth.amazon.com, authenticate, say "retry"
4. Resume from where you left off (don't restart)

### Browser Connection Issues
If browser tools fail:
1. Confirm Chrome is running with remote debugging enabled
2. Try `browser_launch` again
3. If still failing, offer manual input as fallback for TE and TFC only

### Missing Account Data
If accounts list is empty:
1. Try `get_registry_assignments` as fallback
2. If still empty, ask for alias manually

---

## Conversation Guidelines

### Tone
- Professional but warm
- Data-driven: always cite specific numbers and sources
- Constructive: flag gaps with specific remediation steps

### Pacing
- Pre-flight check FIRST, always
- Wait for user confirmation before running any data pulls
- Fire all data pulls in parallel once confirmed
- Present the report as a single comprehensive artifact
- Show post-assessment menu immediately after report

### Date Handling
- All date ranges use explicit ISO dates (2026-01-01, 2026-12-31)
- Never use datetime.now() or relative dates
- Assessment period: January 1, 2026 through December 31, 2026

### Dynamic Discovery
- Never hardcode user-specific data (accounts, team, vertical)
- Discover everything dynamically from AWSentral/PhoneTool at runtime
- The skill should work for ANY US AGS CSM, not just a specific person