# Approval Workflow

## How It Works

1. CC sets `Needs Approval = true` on any task requiring Michael's decision
2. `check-approvals.sh` runs 3x daily (8am, 12pm, 5pm Sydney)
3. Michael gets Telegram message with approval requests
4. Michael replies or opens Notion to approve/reject
5. CC checks approval status before proceeding

## What Needs Approval (ASK MICHAEL)

| Category | Examples |
|----------|----------|
| **Money** | Pricing changes, payment logic, agent compensation |
| **Legal** | Terms changes, legal language, compliance |
| **Strategy** | New features, product pivots, market changes |
| **Data** | Deleting large amounts of data, schema changes affecting user data |
| **Scripts** | Going live with new scripts (>20% change) |
| **Hiring** | Firing/hiring decisions |
| **Reputation** | Anything that could damage brand if wrong |

**Rule of thumb:** Big money risk OR big reputation risk = Ask Michael

## What's Auto-Approved (NO HUMAN NEEDED)

| Category | Examples |
|----------|----------|
| **Bug fixes** | Fixing broken functionality |
| **Minor copy** | Script wording tweaks (<20% change) |
| **Data entry** | Adding new leads, updating call lists |
| **Filters** | Fixing broken filters, sorting |
| **Migrations** | DB migrations WITH rollback plan |
| **Rollbacks** | Test failures → automatic rollback |
| **Documentation** | Updating Lessons Learned, docs |
| **Research** | Research outputs to staging |

## Workflow States

```
Task Created
    ↓
[Auto-approve?] ──YES──→ Proceed with task
    │
    NO
    ↓
Set "Needs Approval" = true
    ↓
CC continues other work (doesn't block)
    ↓
check-approvals.sh → Telegram
    ↓
Michael reviews
    ↓
┌─────────────────┐
│ APPROVED        │ → Uncheck "Needs Approval" → CC proceeds
├─────────────────┤
│ REJECTED        │ → Add rejection reason to Notes → CC moves on
├─────────────────┤
│ NEEDS MORE INFO │ → Michael adds questions to Notes → CC responds
└─────────────────┘
```

## Setting Needs Approval

When CC encounters something needing approval:

```bash
curl -X PATCH "https://api.notion.com/v1/pages/{page_id}" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Notion-Version: 2022-06-28" \
  -d '{
    "properties": {
      "Needs Approval": { "checkbox": true },
      "Notes": { "rich_text": [{ "text": { "content": "APPROVAL NEEDED: [reason]\n\nOptions:\n1. [Option A]\n2. [Option B]\n\nRecommendation: [which option and why]" } }] }
    }
  }'
```

## Approval Request Format (Telegram)

```
⏳ APPROVAL NEEDED (2 items)

*P1 High* Deploy new pricing page
Type: Feature
Notes: New pricing with 3 tiers...
[Open in Notion](url)

*P0 Critical* Delete inactive leads >1 year
Type: Data
Notes: Will remove 500+ leads...
[Open in Notion](url)

Reply with task name + APPROVE or REJECT
```

## Cron Schedule

```bash
# Check for approvals 3x daily
0 8 * * * /home/clawd/scripts/check-approvals.sh   # 8am Sydney
0 12 * * * /home/clawd/scripts/check-approvals.sh  # 12pm Sydney
0 17 * * * /home/clawd/scripts/check-approvals.sh  # 5pm Sydney
```

## Emergency Approval

For urgent items (P0 Critical + Needs Approval):
- CC sends immediate Telegram alert (not just check-approvals.sh)
- Include "URGENT" in message
- Michael can reply directly to Telegram

```bash
./telegram-alert.sh "URGENT" "APPROVAL NEEDED: [task name] - [brief description]. Reply APPROVE or REJECT."
```
