# Notion Integration Plan - RateRight Central Hub

## Overview
Migrate from local Brain state files to Notion as the central business hub. Clawdbot (on DigitalOcean) becomes the new "Brain" - cloud-based, 24/7.

## Current State Files (14 total)
From `C:\RateRight-Brain\Agents\Data\`:

| File | Purpose | Notion Database |
|------|---------|-----------------|
| cfo-state.json | Finance (cash, burn, runway) | Business State |
| comms-state.json | Email, Slack, drafts | Business State |
| contractor-check-state.json | Contractor tracking | Business State |
| control-tower-state.json | Central ops, team status | Business State + Team |
| coo-state.json | Team details, hiring | Team |
| delivery-state.json | Dev: bugs, deploys | Business State |
| deploy-watcher-state.json | Deploy monitoring | Business State |
| disputes-state.json | Dispute tracking | Business State |
| growth-state.json | Sales pipeline, campaigns | Metrics Dashboard |
| lead-sync-state.json | Lead sync status | Business State |
| legal-state.json | ABN, GST, compliance | Business State |
| product-state.json | Roadmap, features | Tasks |
| startup-state.json | Startup checks | Business State |
| support-state.json | Support tickets | Business State |

---

## Notion Database Structure

### 1. Business State (Daily Health)
**Properties:**
- Name (title): e.g., "2026-01-27"
- Date (date)
- Cash Position (number)
- Burn Rate (number)
- Runway Months (number)
- MRR (number)
- Active Blockers (multi-select)
- Team Activity (rich text)
- Alerts (rich text)
- Status (select): Green/Yellow/Red
- Notes (rich text)

**Auto-populated by Clawdbot daily:**
- Finance summary from Growth Engine
- Team activity from Slack
- Blockers from various sources

### 2. Tasks (Replace ClickUp)
**Properties:**
- Task (title)
- Status (select): Not Started, In Progress, Done, Blocked
- Priority (select): P0, P1, P2, P3
- Owner (select): Michael, Markus, Tony, Angelica
- Due Date (date)
- Category (select): Dev, Growth, Ops, Legal, Finance
- Linked Lead (relation to Leads)
- Notes (rich text)
- Created (date)
- Completed (date)

### 3. Knowledge Base
**Properties:**
- Title (title)
- Category (select): Sales Script, Objection, Brand Voice, Process, Legal
- Content (rich text)
- Effectiveness (number): 0-100 rating
- Last Used (date)
- Tags (multi-select)

**Initial content to migrate:**
- Sales scripts from growth-state.json
- Objection handling patterns
- Brand voice guidelines
- Legal language rules

### 4. Team
**Properties:**
- Name (title)
- Role (select)
- Status (select): Active, Onboarding, Offboarding, Inactive
- Location (text)
- Slack ID (text)
- Email (email)
- Start Date (date)
- Monthly Cost (number)
- Current Focus (rich text)
- Blockers (rich text)
- Last Update (date)

**Initial members:**
- Michael (CEO)
- Markus (Developer)
- Tony (Sales - status unclear)
- Angelica (Ops - left Jan 19)

### 5. Metrics Dashboard
**Properties:**
- Period (title): e.g., "Week 4 2026", "January 2026"
- Type (select): Daily, Weekly, Monthly
- Date Range (date range)
- Total Leads (number)
- Hot Leads (number)
- Calls Made (number)
- Conversations (number)
- Conversions (number)
- Revenue (number)
- Best Trade (text)
- Best Channel (text)
- Patterns (rich text)

---

## Growth Engine Integration

### Endpoint: POST /api/notion/sync
Pushes summary data to Notion databases.

**Payload:**
```json
{
  "database": "business_state|metrics|tasks",
  "data": { ... }
}
```

### Endpoint: GET /api/notion/snapshot
Returns current business snapshot for Clawdbot to push to Notion.

**Response:**
```json
{
  "date": "2026-01-27",
  "pipeline": {
    "total": 240,
    "hot": 15,
    "warm": 45
  },
  "today": {
    "calls": 12,
    "conversations": 8,
    "sms": 25
  },
  "week": {
    "calls": 45,
    "conversions": 3,
    "revenue": 1500
  },
  "team": [
    { "name": "Angelica", "calls": 20, "sms": 15 }
  ]
}
```

---

## Clawdbot Update

### New Environment Variables
```
NOTION_API_KEY=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
NOTION_BUSINESS_STATE_DB=<database_id>
NOTION_TASKS_DB=<database_id>
NOTION_KNOWLEDGE_DB=<database_id>
NOTION_TEAM_DB=<database_id>
NOTION_METRICS_DB=<database_id>
```

### Daily Routine
1. **Morning (7am AEST):** Pull Growth Engine snapshot → Write to Business State
2. **After calls:** Log activity to Metrics Dashboard
3. **On blockers:** Create Task in Tasks database
4. **Weekly (Monday):** Generate weekly metrics summary

### Skill Updates
Add to `/root/clawd/skills/growth-engine/SKILL.md`:

```markdown
### notion_write_state
Write daily business state to Notion.
```bash
curl -X POST -H "X-API-Key: $CLAWDBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"database": "business_state", "data": {...}}' \
  "$GROWTH_ENGINE_API_URL/api/notion/sync"
```

### notion_get_snapshot
Get current business snapshot.
```bash
curl -H "X-API-Key: $CLAWDBOT_API_KEY" "$GROWTH_ENGINE_API_URL/api/notion/snapshot"
```
```

---

## Migration Steps

### Phase 1: Create Notion Databases
1. Create "Business State" database
2. Create "Tasks" database
3. Create "Knowledge Base" database
4. Create "Team" database
5. Create "Metrics Dashboard" database
6. Share all with RateRight Assistant integration

### Phase 2: Initial Data Migration
1. Manually create initial entries from state files
2. Add team members from coo-state.json
3. Add knowledge base from growth-state.json (scripts, objections)
4. Create first Business State entry

### Phase 3: Growth Engine Integration
1. Build /api/notion/snapshot endpoint
2. Build /api/notion/sync endpoint
3. Deploy to Railway

### Phase 4: Clawdbot Configuration
1. Add Notion database IDs to Clawdbot memory
2. Update skill file with new commands
3. Test daily sync routine
4. Deprecate local Brain state files

---

## Database IDs (CREATED)

```
NOTION_BUSINESS_STATE_DB=2f563e0c-a7d5-8116-89bb-de6bdde99011
NOTION_TASKS_DB=2f563e0c-a7d5-81cf-bc3d-c1f71325877c
NOTION_KNOWLEDGE_DB=2f563e0c-a7d5-8177-bdfd-d228b9f1f5cc
NOTION_TEAM_DB=2f563e0c-a7d5-818b-8e50-f416375eb906
NOTION_METRICS_DB=2f563e0c-a7d5-81e9-a90e-c52b4b84126d
```

**Parent Page:** "Rough Initial Brainstorms" (26563e0c-a7d5-80b3-8784-d8fe545087df)

**Initial Data Created:**

**Team (4 entries):**
- Michael (CEO) - Active
- Markus (Developer) - Active
- Tony (Sales) - Onboarding (status unclear - mum sick)
- Angelica (GM Ops) - Inactive (left Jan 19 for health reasons)

**Tasks (7 entries):**
- Growth Engine app - finish and test (P1, Dev)
- Test payment system with real person (P1, Finance)
- Tony sales process follow-up (P1, Growth)
- Cormac Cronin - chase re Murray Hydro job (P1, Growth)
- Contact lawyers re: Stripe rate.com.au employer risk (P0, Legal)
- LawPath review - ABN classification and super obligations (P0, Legal)
- Get 5 contractors posting jobs by Jan 31 (P0, Growth)

**Knowledge Base (10 entries):**
- Legal Language Rules (banned words, required words)
- Pricing Tiers (5.9% compliance, 9.9% standard)
- Competitor Battlecard (CreteMate: $300/mo subscription)
- Best Calling Times (pattern from AI)
- Cormac Cronin - Murray Hydro Lead Intel (hot lead)
- ABN and Super Obligation Rules (60% rule, 7-factor test)
- Labour Hire Cost Reality (objection handling)
- Stripe Margin Math (7% at 9.9%, 3% at 5.9%)
- CreteMate Competitor Intel (cretemate.com, Instagram founder)
- Worker Acquisition Breakthrough Strategy (reverse psychology - 4 signups in 30 mins)

**Business State (1 entry):**
- 2026-01-27: 154 leads, 2 hot, status red, $58,900 cash, 9.5mo runway

---

## Notes

- Notion API token: `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`
- Clawdbot already has Notion skill - just needs database IDs
- Don't duplicate CRM data - just summary dashboards
- Growth Engine is source of truth for leads/communications
- Notion is source of truth for business state, tasks, knowledge
