# Delivery Channels

Protocols for delivering analytics reports via console, email, and Slack.
The orchestrator (SKILL.md) and reporting-narrative agent use this reference.

## Console (Default)

**Format:** Standard GitHub-flavored markdown rendered in terminal.

**Rules:**

- Use monospace-friendly table alignment
- No images, no clickable links (terminal context)
- Use `↑`, `↓`, `→` for trend arrows
- Bold (`**`) for emphasis on key metrics
- Keep line width under 100 chars for readability
- No color codes (not all terminals support them)

**Invocation:** Direct output — no tool calls needed.

## Email

**Tool:** Invoke `/email` skill with pre-formatted content.

**Subject Line Format:**

| Tier | Format | Example |
|------|--------|---------|
| Mini | `Analytics Pulse — {date}` | `Analytics Pulse — Apr 16, 2026` |
| Medium | `Analytics Brief — {date_range} — {headline}` | `Analytics Brief — Apr 9-16 — Organic +18%` |
| Full | `Analytics Deep Dive — {date_range} — {headline}` | `Analytics Deep Dive — Mar 16-Apr 16 — AI Referrals 3x` |

**Body Format:**

```
{Report Title}
{'=' * len(title)}

{Executive Summary}

{Report sections with plain-text formatting}

---
Generated by Web Analytics Intelligence
{date} at {time} ET
```

**Email-specific rules:**

- No raw markdown tables — use aligned plain text or simple lists
- Key metrics in bold
- Limit to 5000 chars (email clients truncate)
- No code blocks (email rendering is unreliable)
- Always include generation timestamp

**Recipient:** jeremy@intentsolutions.io (from site-registry defaults)

**Invocation:**

```
/email
To: jeremy@intentsolutions.io
Subject: {formatted subject}
Body: {formatted report}
```

## Slack

**Tool:** Invoke `/slack` skill with Slack-formatted content.

**Channel:** #operation-hired (from site-registry defaults)

**Slack mrkdwn Format:**

```
*Analytics {Tier} — {date}*

*Portfolio:* {total} visitors across {n} sites ({change})

{site_name}: {visitors} visitors ({trend})
{site_name}: {visitors} visitors ({trend})

*Top Signal:* {key finding}

{Recommendations if medium/full tier}
```

**Slack-specific rules:**

- Use Slack mrkdwn: `*bold*`, `_italic_`, `` `code` ``, `>quote`
- Respect 3000-char message limit per message
- If over limit, split into 2 messages:
  - Message 1: Summary + portfolio overview
  - Message 2: Details + recommendations
- No markdown tables — use simple aligned text
- Use emoji sparingly for severity: `:red_circle:` P0/P1, `:large_orange_circle:` P2, `:white_circle:` P3/P4

**Invocation:**

```
/slack
Channel: #operation-hired
Message: {formatted report}
```

## Multi-Channel (`--all`)

When `--all` flag is set:

1. Display on console (always first)
2. Send via email
3. Send via Slack

Each channel gets its own formatted version — do NOT send the same text to all three.
Console gets full markdown, email gets plain text, Slack gets mrkdwn.

## Scheduled Delivery

For push-based analytics (Phase 4), the `/schedule` integration works like:

```
/schedule create --name "morning-analytics" --cron "0 7 * * 1-5" --prompt "/analytics medium --email --slack"
```

This runs the medium tier every weekday at 7am ET and sends to both email and Slack.

**Scheduling rules:**

- Mini tier: suitable for multiple times per day
- Medium tier: once daily (morning brief)
- Full tier: once weekly (Monday morning) or monthly
- Anomaly alerts: event-driven (not scheduled — triggered by anomaly-detector thresholds)

## Alert Delivery

For anomaly alerts (not full reports), use a compact format:

**Slack Alert:**

```
:red_circle: *Analytics Alert — {site}*
{severity}: {one-line description}
{key metric}: {value} (expected: {baseline})
Action: {recommended next step}
```

**Email Alert:**

```
Subject: [ALERT] {site} — {severity} — {description}
Body: {2-3 sentence explanation with numbers and recommended action}
```

Alerts bypass tier selection — they're always compact and immediate.
