Protocol Raw System Architecture
Layer 4: SOP Cross-Reference
Version: 1.0
Status: Production Reference
Last Updated: January 2026
Owner: Protocol Raw Operations
1. SOP Master Index
1.1 Core Operations SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-00 |
Shopify → Supabase Bridge |
v4.0 |
✅ Production |
Order/customer ingestion from Shopify |
| SOP-01 |
Batch Creation & Lab-to-Release |
v4.2 |
✅ Production |
Batch lifecycle, QA, lab processing |
| SOP-02 |
Courier Watchdog |
v3.0 |
✅ Production |
DPD tracking, exception handling |
| SOP-03 |
Daily Operations Snapshot |
v3.1 |
✅ Production |
Morning ops digest |
| SOP-04 |
Reserved |
- |
- |
- |
| SOP-05 |
Email Processing |
v3.0 |
✅ Production |
Email outbox queue processing |
| SOP-0R |
Formulation Management |
v4.2 |
✅ Production |
Product formulation tracking |
| SOP-0X |
Order Export |
v3.0 |
✅ Production |
Export orders for fulfillment |
| SOP-0Y |
Dispatch Recording |
v2.0 |
✅ Production |
Record dispatch, tracking submission |
1.2 Inventory SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-INV-01 |
Inventory Control |
v1.1 |
✅ Production |
Stock levels, manual adjustments |
| SOP-INV-02 |
Demand Forecasting |
v1.0 |
✅ Production |
Predict inventory needs |
1.3 Packing & Fulfillment SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-PACK-01 |
Intelligent Packing |
v2.0 |
✅ Production |
PCM calculation, pack day workflow |
| SOP-COLD-01 |
Cold Chain Integrity |
v1.0 |
✅ Production |
3PL cold chain requirements |
1.4 Customer Operations SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-CS-00 |
Customer Operations System |
v1.5 |
✅ Production |
Support system overview |
| SOP-CS-01 |
AI Customer Service Triage |
v2.1 |
✅ Production |
Email classification |
| SOP-CS-02 |
Live Chat System |
v1.8 |
✅ Production |
Real-time messaging |
| SOP-CS-03 |
Autonomous Support Agent |
v1.5 |
✅ Production |
AI-powered automation |
1.5 Subscription & Lifecycle SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-SUB-00 |
Subscription State Management |
v1.0 |
🔵 Design |
Seal sync, dunning, card expiry |
| SOP-LC-01 |
Lifecycle Communications |
v1.0 |
✅ Production |
All automated emails |
| SOP-REF-01 |
Referral System |
v2.1 |
✅ Production |
Referral codes, credits |
1.6 Monitoring & Infrastructure SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-MON-01 |
Monitoring & Alerting Architecture |
v1.0 |
✅ Production |
Centralized monitoring |
| SOP-MON-02 |
Order Ingestion SLO Monitor |
v2.0 |
✅ Production |
Order ingestion health |
| SOP-AI-KB-01 |
AI Knowledge Base |
v1.8 |
✅ Production |
KB management |
| SOP-CHS-01 |
Customer Health Scoring |
v1.0 |
🔵 Design |
Churn prediction |
1.7 Content & Marketing SOPs
| ID |
Name |
Version |
Status |
Purpose |
| SOP-JOURNAL-01 |
Journal Content Management |
v1.0 |
🔵 Design |
Blog content workflow |
2. SOP Dependency Map
2.1 Order Flow Dependencies
SOP-00 (Shopify Bridge)
↓ Creates: orders, customers, order_items
↓
SOP-INV-01 (Inventory) ← Allocation trigger
↓ Creates: allocations
↓
SOP-0X (Order Export)
↓ Updates: export_state = 'exported'
↓
SOP-PACK-01 (Packing)
↓ Creates: packing_instructions
↓
SOP-0Y (Dispatch)
↓ Creates: shipments
↓
SOP-02 (Courier Watchdog)
↓ Creates: courier_events
↓
SOP-LC-01 (Lifecycle) → Customer emails
2.2 Batch Flow Dependencies
SOP-01 (Batch Creation)
↓ Creates: batches (status: QA_HOLD)
↓ Creates: inventory (qty_on_hold)
↓
SOP-01 (Lab Processing)
↓ Creates: lab_results
↓ Updates: batch status → RELEASED
↓
SOP-INV-01 (Inventory)
↓ Releases: inventory to qty_available
↓ Triggers: pending order allocation
2.3 Support Flow Dependencies
SOP-CS-00 (Customer Ops System)
↓ Defines: Overall support architecture
↓
SOP-CS-01 (AI Triage)
↓ Creates: support_tickets, cs_agent_decisions
↓
SOP-CS-03 (Autonomous Agent)
↓ Updates: tickets, sends responses
↓
SOP-AI-KB-01 (Knowledge Base)
↓ Provides: kb_articles for AI context
2.4 Monitoring Dependencies
SOP-MON-01 (Monitoring Architecture)
↓ Defines: run-monitor, ops-alerter pattern
↓
├── SOP-MON-02 (Order Ingestion SLO) → uses pattern
├── SOP-03 (Daily Snapshot) → uses pattern
├── SOP-01 (Lab SLA) → uses pattern
├── SOP-01 (Working Capital) → uses pattern
├── SOP-INV-01 (Stock Levels) → uses pattern
└── SOP-CS-03 (Support Queue) → uses pattern
3. SOP to Component Mapping
3.1 SOP-00: Shopify Bridge
| Component Type |
Name |
Purpose |
| Edge Function |
shopify-webhook-handler |
Receive webhooks |
| Database Table |
webhook_inbox |
Store raw webhooks |
| Database Table |
customers |
Customer master |
| Database Table |
orders |
Order headers |
| Database Table |
order_items |
Line items |
| Database Function |
process_order_webhook_txn() |
Processing logic |
| pg_cron Job |
retry-failed-webhooks |
Retry failures |
| View |
v_webhook_health |
24h metrics |
| View |
v_retry_queue_depth |
Queue status |
3.2 SOP-01: Batch Creation & Lab-to-Release
| Component Type |
Name |
Purpose |
| Edge Function |
create-batch |
Create batch with assets |
| Database Table |
batches |
Batch records |
| Database Table |
lab_results |
Lab test results |
| Database Table |
formulations |
Product formulations |
| Database Function |
generate_public_batch_id() |
Hash generation |
| Database Trigger |
trigger_set_public_batch_id |
Auto-set public ID |
| Make.com Scenario |
Lab Results Processing |
Parse lab PDFs |
| Monitor Function |
fn_check_lab_sla_v2() |
Lab SLA tracking |
| Monitor Function |
fn_check_working_capital_v2() |
QA hold value |
3.3 SOP-02: Courier Watchdog
| Component Type |
Name |
Purpose |
| Make.com Scenario |
DPD Tracking Ingestion |
Receive events |
| Make.com Scenario |
Courier Exception Handler |
Customer notification |
| Database Table |
shipments |
Dispatch records |
| Database Table |
courier_events |
Tracking events |
| Customer.io Template |
delivery_exception |
Exception email |
3.4 SOP-03: Daily Snapshot
| Component Type |
Name |
Purpose |
| Monitor Function |
fn_daily_snapshot_v2() |
Daily metrics |
| Database Function |
get_daily_snapshot() |
Metric calculation |
| pg_cron Job |
monitor-daily-snapshot |
Daily 09:00 |
| Slack Channel |
#daily-ops |
Delivery |
3.5 SOP-INV-01: Inventory Control
| Component Type |
Name |
Purpose |
| Database Table |
inventory |
Stock levels |
| Database Table |
inventory_movements |
Audit trail |
| Database Function |
execute_manual_inventory_adjustment() |
Manual adjustments |
| Database Function |
get_current_inventory_for_reconciliation() |
Inventory display |
| Database Trigger |
trg_decrement_inventory_on_dispatch |
Auto-decrement |
| Monitor Function |
fn_check_stock_levels_v2() |
Low stock alerts |
3.6 SOP-PACK-01: Intelligent Packing
| Component Type |
Name |
Purpose |
| Edge Function |
calculate-pack-day-instructions |
PCM calculation |
| Database Table |
packing_instructions |
Pack requirements |
| View |
v_pack_queue |
Orders to pack |
| External API |
OpenWeatherMap |
Weather forecast |
3.7 SOP-CS-00: Customer Operations System
| Component Type |
Name |
Purpose |
| Database Table |
support_tickets |
Tickets |
| Database Table |
ticket_messages |
Conversation history |
| Database Table |
address_changes |
Address sync tracking |
| View |
v_support_queue |
Open tickets |
| View |
v_customer_context |
Customer 360 |
| Make.com Scenario |
Address Update Sync |
Shopify + Seal sync |
| Edge Function |
sync-address-change |
Address sync trigger |
3.8 SOP-CS-01: AI Triage
| Component Type |
Name |
Purpose |
| Edge Function |
cs-agent-triage |
Classification |
| Database Table |
cs_agent_decisions |
AI decisions |
| Make.com Scenario |
CS-01: Email Triage |
Gmail watch |
3.9 SOP-CS-03: Autonomous Agent
| Component Type |
Name |
Purpose |
| Edge Function |
cs-agent-triage |
Classification + draft |
| Edge Function |
send-support-email |
Email delivery |
| Database Table |
cs_agent_decisions |
AI decisions |
| Database Table |
ticket_messages |
Conversation log |
| Monitor Function |
fn_check_support_queue_v2() |
Queue depth |
3.10 SOP-LC-01: Lifecycle Communications
| Component Type |
Name |
Purpose |
| Customer.io Templates |
Multiple |
All email templates |
| Make.com Scenario |
Event Bridge |
Trigger campaigns |
| Database Table |
email_outbox |
Email queue |
3.11 SOP-MON-01: Monitoring Architecture
| Component Type |
Name |
Purpose |
| Edge Function |
run-monitor |
Generic runner |
| Edge Function |
ops-alerter |
Slack delivery |
| Database Table |
monitoring_runs |
Execution log |
| pg_cron Jobs |
monitor-* |
All schedules |
| Slack Channels |
#ops-alerts, #ops-urgent, #daily-ops |
Alert delivery |
3.12 SOP-SUB-00: Subscription State Management
| Component Type |
Name |
Purpose |
| Edge Function |
seal-webhook-handler |
Webhook ingestion |
| Database Table |
subscriptions |
Local state cache |
| Database Table |
subscription_events |
Event log |
| Database Table |
billing_attempts |
Payment attempts |
| Make.com Scenarios |
SUB-01 to SUB-05 |
Dunning sequence |
4. SOP to External System Mapping
5. Database Table to SOP Mapping
6. Edge Function to SOP Mapping
| Edge Function |
Primary SOP |
Purpose |
| shopify-webhook-handler |
SOP-00 |
Order ingestion |
| seal-webhook-handler |
SOP-SUB-00 |
Subscription sync |
| create-batch |
SOP-01 |
Batch creation |
| cs-agent-triage |
SOP-CS-01 |
AI classification |
| send-support-email |
SOP-CS-00 |
Email delivery |
| sync-address-change |
SOP-CS-00 |
Address sync |
| calculate-pack-day-instructions |
SOP-PACK-01 |
PCM calculation |
| run-monitor |
SOP-MON-01 |
Monitor execution |
| ops-alerter |
SOP-MON-01 |
Slack delivery |
| retry-failed-webhooks |
SOP-00 |
Webhook retry |
| Scenario |
Primary SOP |
Trigger |
Purpose |
| CS-01: Email Triage |
SOP-CS-01 |
Gmail watch |
Support intake |
| Address Update Sync |
SOP-CS-00 |
Supabase webhook |
Address sync |
| Lab Results Processing |
SOP-01 |
Gmail filter |
Lab PDF parsing |
| DPD Tracking Ingestion |
SOP-02 |
DPD webhook |
Tracking events |
| Courier Exception Handler |
SOP-02 |
courier_events |
Customer notification |
| Event Bridge |
SOP-LC-01 |
Database trigger |
Customer.io events |
8. pg_cron Job to SOP Mapping
| Job Name |
Schedule |
SOP |
Purpose |
| monitor-order-ingestion-slo |
*/2 * * * * |
SOP-MON-02 |
Order health |
| monitor-outbox-health |
*/2 * * * * |
SOP-MON-01 |
Email queue |
| monitor-stock-levels |
*/15 * * * * |
SOP-INV-01 |
Low stock |
| monitor-lab-sla |
*/15 * * * * |
SOP-01 |
Lab tracking |
| monitor-working-capital |
0 */6 * * * |
SOP-01 |
QA hold value |
| monitor-daily-snapshot |
0 9 * * * |
SOP-03 |
Daily digest |
| monitor-support-queue |
*/15 * * * * |
SOP-CS-03 |
Support queue |
| retry-failed-webhooks |
*/5 * * * * |
SOP-00 |
Webhook retry |
| process-email-outbox |
* * * * * |
SOP-05 |
Send emails |
| order-export |
0 6 * * * |
SOP-0X |
Export orders |
9. Customer.io Template to SOP Mapping
10. Quick Reference: "Where Do I Look?"
| I need to understand... |
Start with SOP |
| How orders get into the system |
SOP-00 |
| How batches work |
SOP-01 |
| How inventory is managed |
SOP-INV-01 |
| How packing works |
SOP-PACK-01 |
| How dispatch works |
SOP-0Y |
| How courier tracking works |
SOP-02 |
| How customer support works |
SOP-CS-00 |
| How AI support works |
SOP-CS-03 |
| How emails are sent |
SOP-LC-01 |
| How subscriptions work |
SOP-SUB-00 |
| How monitoring works |
SOP-MON-01 |
| How the ops portal works |
Ops Portal Docs |
| How the customer portal works |
Customer Portal Docs |
| Document |
Purpose |
| Layer 1: System Map |
Visual architecture |
| Layer 2: Component Registry |
Database and function specs |
| Layer 3: Integration Specifications |
External API specs |
| Operations Portal Documentation |
Portal features |
| Customer Portal Documentation |
Portal features |
| Visual Identity Guide |
Brand standards |
| Email Design System |
Email standards |
Protocol Raw — Verified safe, batch by batch.