Swarm Engagement Engine — User Flow Diagrams

1. Master Flow — All Screens & Navigation Paths

graph TD
    %% Entry point
    START([🛰 User opens r.10xers.co/swarm]) --> CAMPAIGNS

    %% Main screens
    CAMPAIGNS[📋 Campaigns List<br/>Filter, sort, status overview]
    NEW[🚀 New Campaign<br/>Create + configure + assign]
    LIVE[▶️ Live Execution<br/>Real-time action progress]
    DETAIL[📄 Campaign Detail<br/>5 tabs: timeline, actions,<br/>comments, scores, profiles]
    POSTS[📚 Post Registry<br/>All tracked posts + score trends]
    PLAYBOOKS[📊 Playbook Analytics<br/>Performance by strategy]
    SUBS[🗺 Subreddit Map<br/>Profile × subreddit matrix]
    TZ[🕐 Timezone Windows<br/>Availability matrix + optimal launch]
    HEALTH[🩺 Profile Health<br/>Rotation, cooldowns, bans, Q-history]

    %% Campaigns → other screens
    CAMPAIGNS -->|"+ New Campaign" button| NEW
    CAMPAIGNS -->|"click row / View button"| DETAIL
    CAMPAIGNS -->|"click running campaign"| LIVE

    %% New Campaign flow
    NEW -->|"select playbook dropdown"| PLAYBOOK_REF[📖 Playbook reference<br/>inline preview of comment strategy]
    NEW -->|"profile picker shows eligible"| SUBS_REF[🗺 Sub map reference<br/>prior activity per profile per sub]
    NEW -->|"timezone-aware schedule"| TZ_REF[🕐 TZ reference<br/>awake count at target time]
    NEW -->|"Create Campaign 🚀"| CAMPAIGN_CREATED{{Campaign created<br/>status=scheduled}}
    CAMPAIGN_CREATED -->|"if ASAP"| LIVE
    CAMPAIGN_CREATED -->|"if scheduled"| CAMPAIGNS
    NEW -->|"Cancel"| CAMPAIGNS
    NEW -->|"Preview execution →"| LIVE

    %% Live Execution → Detail
    LIVE -->|"campaign finishes/done"| DETAIL
    LIVE -->|"Abort remaining"| ABORTED{{Campaign aborted<br/>status=aborted}}
    ABORTED --> DETAIL
    LIVE -->|"Export JSON"| EXPORT[📥 Export campaign JSON]

    %% Detail → other screens
    DETAIL -->|"breadcrumb ← Campaigns"| CAMPAIGNS
    DETAIL -->|"profile name link"| HEALTH
    DETAIL -->|"subreddit link"| SUBS
    DETAIL -->|"playbook badge link"| PLAYBOOKS
    DETAIL -->|"post URL link"| REDDIT[🔗 Reddit post<br/>external link]
    DETAIL -->|"Export JSON / CSV"| EXPORT
    DETAIL -->|"Score chart tab"| SCORE_HISTORY[📈 Score history<br/>15min→hourly→daily sampling]

    %% Post Registry → Detail
    POSTS -->|"click post row"| DETAIL_POST[📄 Campaign Detail<br/>for that post's campaign]
    POSTS -->|"filter by subreddit"| SUBS
    POSTS -->|"filter by playbook"| PLAYBOOKS
    POSTS -->|"+ Register post manually"| REGISTER[📝 Register post form<br/>URL + playbook + posted-by]

    %% Playbook Analytics
    PLAYBOOKS -->|"click playbook row"| PLAYBOOK_DETAIL[📊 Playbook detail<br/>all posts using this playbook]
    PLAYBOOKS -->|"click post in playbook"| POSTS
    PLAYBOOK_DETAIL -->|"click campaign for post"| DETAIL

    %% Subreddit Map
    SUBS -->|"click profile name"| HEALTH
    SUBS -->|"click subreddit column header"| SUB_DETAIL[🗺 Subreddit detail<br/>all profiles + campaigns in this sub]
    SUB_DETAIL -->|"click campaign"| DETAIL
    SUB_DETAIL -->|"click post"| POSTS

    %% Timezone Windows
    TZ -->|"click profile row"| HEALTH
    TZ -->|"recommend launch time → create campaign"| NEW

    %% Profile Health
    HEALTH -->|"click profile name"| PROFILE_DETAIL[🩺 Profile detail<br/>full history: actions, bans, cooldowns, Q-history]
    HEALTH -->|"Rotation rules button"| ROTATION[⚙ Rotation rules panel<br/>G6 caps, G12 Q-rotation, cooldown config]
    HEALTH -->|"Circuit breaker log"| BREAKER[🛡 Circuit breaker log<br/>ban events + auto-pause history]
    HEALTH -->|"Question-asker history"| Q_HISTORY[❓ Q-asker history<br/>per profile: which Q type, which sub, when]
    PROFILE_DETAIL -->|"click campaign in history"| DETAIL
    PROFILE_DETAIL -->|"click subreddit in history"| SUBS

    %% Exit points
    CAMPAIGNS --> EXIT([🔚 Exit to dashboard])
    EXPORT --> EXIT

    %% Styling
    classDef entry fill:#1c2833,stroke:#39c5cf,stroke-width:2px,color:#e6edf3
    classDef screen fill:#161b22,stroke:#2f81f7,stroke-width:1px,color:#e6edf3
    classDef detail fill:#1c2128,stroke:#bc8cff,stroke-width:1px,color:#e6edf3
    classDef action fill:#12261a,stroke:#3fb950,stroke-width:1px,color:#e6edf3
    classDef decision fill:#2d2410,stroke:#d29922,stroke-width:1px,color:#e6edf3
    classDef exit fill:#2d1215,stroke:#f85149,stroke-width:1px,color:#e6edf3

    class START entry
    class CAMPAIGNS,NEW,LIVE,POSTS,PLAYBOOKS,SUBS,TZ,HEALTH screen
    class DETAIL,PLAYBOOK_DETAIL,SUB_DETAIL,PROFILE_DETAIL,SCORE_HISTORY detail
    class CAMPAIGN_CREATED,ABORTED action
    class EXPORT,REGISTER,PLAYBOOK_REF,SUBS_REF,TZ_REF,ROTATION,BREAKER,Q_HISTORY decision
    class EXIT exit

2. New Campaign Creation Flow (detailed)

flowchart TD
    A([User clicks New Campaign]) --> B[Paste post URL or select from Post Registry]
    B --> C[System fetches post metadata via AdsPower cookies]
    C --> D{Post detected?}
    D -->|URL invalid| E[Error: invalid URL] --> B
    D -->|yes| F[Select campaign type: UPVOTE / COMMENT / HYBRID]
    D -->|3rd party post| F
    F --> G[Select strategy playbook - dropdown of 12 playbooks]
    G --> H[Playbook preview: comment strategy, link policy, question types]
    H --> I[Schedule: ASAP or Pick time]
    I -->|ASAP| J[Check timezone windows - profiles awake now]
    I -->|Pick time| K[Check timezone windows - profiles awake at target time]
    J -->|fewer than 5 awake| L[Recommend delaying to optimal window]
    K -->|fewer than 5 awake| L
    L -->|accept delay| I
    L -->|proceed anyway| M
    J -->|5 or more awake| M[Auto-assign profiles - apply 9 assignment rules]
    K -->|5 or more awake| M
    M --> N[Run assignment checks]
    N --> N1[1. Ban-aware: exclude banned in target sub]
    N --> N2[2. Sleep-aware: exclude sleeping profiles]
    N --> N3[3. Age-aware: under 30d = upvote-only]
    N --> N4[4. Karma-aware: under 50 = comment-cap, 200+ = question-eligible]
    N --> N5[5. IP-aware G5: split shared-IP pairs to opposite ends]
    N --> N6[6. Rotation G6: exclude cooldown or weekly-cap-hit]
    N --> N7[7. Health-aware: exclude suspended or shadowbanned]
    N --> N8[8. Sub-assignment: commenter needs prior activity]
    N --> N9[9. Q-rotation G12: no same Q type in same sub within 14d]
    N1 --> O[Eligible profile list with exclusion reasons]
    N2 --> O
    N3 --> O
    N4 --> O
    N5 --> O
    N6 --> O
    N7 --> O
    N8 --> O
    N9 --> O
    O --> P[User reviews and adjusts profile selection]
    P --> Q[Generate comment drafts via V4 prompt + playbook template]
    Q --> R[Show comment drafts + question draft + playbook role per profile]
    R -->|user edits| Q
    R -->|user approves| S[Safety contract panel: G1-G12 auto-applied]
    S --> T{Click Create Campaign}
    T -->|cancel| U([Back to Campaigns])
    T -->|confirm| V[(Write to swarm_campaigns, swarm_actions, swarm_profile_subs, swarm_profile_limits)]
    V --> W[Scheduler dispatches actions with stagger per timezone logic]
    W -->|ASAP| X([Go to Live Execution])
    W -->|scheduled| Y([Back to Campaigns - status=scheduled])

3. Campaign Execution Flow (per-action lifecycle)

flowchart TD
    A([Scheduler dispatches action for profile P at time T]) --> B{Profile P awake?}
    B -->|no, sleeping| C[Queue action for when profile wakes]
    C --> D[Wait for wake time - scheduler re-checks]
    D --> B
    B -->|yes| E[Open AdsPower profile via MCP/CLI]
    E -->|success| F[Wait 4s for browser to load]
    E -->|fail| G[Retry once after 60s]
    G -->|retry success| F
    G -->|retry fail| H[Action failed: open_failed]
    F --> I[Get profile cookies - dual-path CLI then HTTP v2]
    I -->|cookies found| J[Navigate to post URL via MCP]
    I -->|no cookies| K[Action failed: no_reddit_cookies]
    J --> L[Scroll and read 30-90s random jitter G7]
    L --> M{Profile banned in this sub?}
    M -->|banned| N[Ban detected - circuit breaker G8 - pause profile and alert]
    N --> O[Action failed: banned_in_sub]
    M -->|not banned| P{Action type?}
    P -->|upvote| Q[Click upvote arrow via MCP]
    P -->|comment| R[Type comment via MCP - V4 text unique per profile G10]
    P -->|question| S[Type question via MCP - per question type rules]
    Q --> T[Verify upvote via DOM state read-back]
    R --> U[Verify comment appeared - capture comment URL]
    S --> V[Verify question appeared - capture comment URL]
    T --> W{Verified?}
    U --> W
    V --> W
    W -->|yes| X[Record score_before from post page]
    W -->|no| Y[Retry once after 30s]
    Y -->|success| X
    Y -->|fail| H
    X --> Z[Close AdsPower profile]
    Z --> AA[(Write swarm_actions: status=verified, executed_at, verified_at, scores, comment_text, comment_url)]
    AA --> AB[(Update swarm_profile_limits: week_actions++, cooldown_until=now+12h)]
    AB --> AC[(Update swarm_profile_subs: total_actions++, total_upvotes or comments or questions++)]
    AC --> AD{Was this a question action?}
    AD -->|no| AE([Action complete - scheduler picks next])
    AD -->|yes| AF[Notify main account: question asked, reply with link when ready]
    AF --> AG{Main account replies with link?}
    AG -->|yes| AH[(Record main_account_reply_url and link_drop_comment_url)]
    AG -->|no, timeout 30min| AI[Alert: question unanswered - campaign continues without link drop]
    AH --> AE
    AI --> AE
    H --> AJ[Close browser if open]
    K --> AJ
    O --> AJ
    AJ --> AK[(Write swarm_actions: status=failed, error=reason)]
    AK --> AE
flowchart LR
    A[Swarm profile asks: Do you have a link where we can try it?] --> B[action_type=question, question_type=direct_link_request, comment_url captured]
    B --> C[Main account notified: u/No_Anxiety6450 asked for your link on post X]
    C --> D{Main account replies?}
    D -->|yes, with link| E[Main account replies: Check out growreach.app - free trial, no CC]
    D -->|yes, no link| F[Main account replies without link - answers question only]
    D -->|no, timeout 30min| G[Unanswered alert - campaign continues without link drop]
    E --> H[Update swarm_actions: main_account_reply_url, link_drop_comment_url]
    F --> I[Update swarm_actions: main_account_reply_url, link_drop=false]
    G --> J[Update swarm_actions: reply_url=null, flag=unanswered]
    H --> K[Analytics: Q-to-link conversion rate, time-to-reply, score impact]
    I --> K
    J --> K
    K --> L[Optimize: which question type gets fastest reply? which playbook has highest Q-to-link rate?]

5. Gap Resolution — All Screens Built in v3 Mockup

Status: ALL GAPS RESOLVED ✅ (2026-08-09)

The complete v3 mockup (swarm-mockups/swarm-full-mockup.html) contains all 19 screens with every navigation path wired and functional.

graph TD
    subgraph AllBuilt ["✅ All 19 screens built in v3 mockup"]
        B1[📋 Campaigns List]
        B2[🚀 New Campaign]
        B3[▶️ Live Execution]
        B4[📄 Campaign Detail — 5 sub-tabs]
        B5[📚 Post Registry]
        B6[📊 Playbook Analytics]
        B7[🗺 Subreddit Map]
        B8[🕐 Timezone Windows]
        B9[🩺 Profile Health]
        M1[✅ Register Post Form]
        M2[✅ Playbook Detail]
        M3[✅ Subreddit Detail]
        M4[✅ Profile Detail — 5 sub-tabs]
        M5[✅ Rotation Rules Panel]
        M6[✅ Circuit Breaker Log]
        M7[✅ Question-Asker History]
        M8[✅ Score History Chart]
        M9[✅ Export Panel]
        M10[✅ Main Account Notifications]
    end
    
    subgraph AllFlows ["✅ All 13 navigation flows wired"]
        F1[✅ Campaigns row → Detail]
        F2[✅ Post row → Detail]
        F3[✅ Playbook row → Playbook Detail]
        F4[✅ Subreddit cell → Subreddit Detail]
        F5[✅ Health row → Profile Detail]
        F6[✅ TZ row → Profile Detail]
        F7[✅ Detail breadcrumb → Campaigns]
        F8[✅ Detail profile → Profile Detail]
        F9[✅ Detail subreddit → Subreddit Detail]
        F10[✅ Detail playbook → Playbook Detail]
        F11[✅ New Campaign playbook → inline preview]
        F12[✅ New Campaign schedule → TZ preview]
        F13[✅ New Campaign picker → sub reference]
    end
    
    AllBuilt --> AllFlows
    
    classDef built fill:#12261a,stroke:#3fb950,stroke-width:1px,color:#e6edf3
    class B1,B2,B3,B4,B5,B6,B7,B8,B9,M1,M2,M3,M4,M5,M6,M7,M8,M9,M10 built

6. Complete Navigation Map — every clickable element and its destination

graph LR
    subgraph Campaigns Page
        C_BTN_NEW[+ New Campaign btn]
        C_ROW[Campaign row click]
        C_VIEW[View btn]
        C_ABORT_ROW[Abort btn on running]
    end
    
    subgraph New Campaign Page
        N_PB_DROP[Playbook dropdown]
        N_PROFILE_PICK[Profile picker]
        N_SCHEDULE[Schedule selector]
        N_CREATE[Create Campaign btn]
        N_CANCEL[Cancel btn]
        N_PREVIEW[Preview execution btn]
    end
    
    subgraph Live Execution Page
        L_ABORT[Abort remaining btn]
        L_EXPORT[Export JSON btn]
        L_SCORE_CHART[Score chart btn]
        L_PROFILE_NAME[Profile name link]
    end
    
    subgraph Campaign Detail Page
        D_CRUMB[Breadcrumb ← Campaigns]
        D_PROFILE[Profile name link]
        D_SUB[Subreddit link]
        D_PB[Playbook badge]
        D_POST_URL[Post URL link]
        D_EXPORT[Export btn]
        D_ABORT[Abort btn]
        D_TAB[Tab switcher]
    end
    
    subgraph Post Registry Page
        P_ROW[Post row click]
        P_FILTER_SUB[Filter by subreddit]
        P_FILTER_PB[Filter by playbook]
        P_REGISTER[+ Register post btn]
    end
    
    subgraph Playbook Analytics Page
        PB_ROW[Playbook row click]
        PB_POST[Post link in playbook]
    end
    
    subgraph Subreddit Map Page
        S_PROFILE[Profile name click]
        S_SUB_HEADER[Subreddit column header]
    end
    
    subgraph Timezone Page
        TZ_PROFILE[Profile row click]
        TZ_LAUNCH[Launch time → create]
    end
    
    subgraph Profile Health Page
        H_PROFILE[Profile name click]
        H_ROTATION[Rotation rules btn]
        H_BREAKER[Circuit breaker btn]
        H_Q_HISTORY[Q-asker history btn]
    end
    
    %% Navigation targets
    C_BTN_NEW -->|goes to| NP[New Campaign page]
    C_ROW -->|goes to| DP[Campaign Detail page]
    C_VIEW -->|goes to| DP
    C_ABORT_ROW -->|action| ABORT_ACTION[Abort campaign API]
    
    N_PB_DROP -->|inline| N_PB_PREVIEW[Playbook preview panel]
    N_PROFILE_PICK -->|inline| N_ELIGIBLE[Eligible profile list]
    N_SCHEDULE -->|inline| N_TZ_PREVIEW[Timezone awake count]
    N_CREATE -->|goes to| LP[Live Execution page]
    N_CANCEL -->|goes to| CP[Campaigns page]
    N_PREVIEW -->|goes to| LP
    
    L_ABORT -->|action| ABORT_ACTION
    L_EXPORT -->|action| EXPORT_API[Export JSON download]
    L_SCORE_CHART -->|inline| L_CHART[Score chart overlay]
    L_PROFILE_NAME -->|goes to| PDP[Profile Detail page ❌]
    
    D_CRUMB -->|goes to| CP
    D_PROFILE -->|goes to| PDP
    D_SUB -->|goes to| SDP[Subreddit Detail page ❌]
    D_PB -->|goes to| PBDP[Playbook Detail page ❌]
    D_POST_URL -->|external| REDDIT[reddit.com]
    D_EXPORT -->|action| EXPORT_API
    D_ABORT -->|action| ABORT_ACTION
    D_TAB -->|inline| D_TAB_CONTENT[Tab pane switch]
    
    P_ROW -->|goes to| DP
    P_FILTER_SUB -->|goes to| SMP[Subreddit Map page]
    P_FILTER_PB -->|goes to| PBP[Playbook Analytics page]
    P_REGISTER -->|goes to| RPF[Register Post Form ❌]
    
    PB_ROW -->|goes to| PBDP
    PB_POST -->|goes to| PP[Post Registry page]
    
    S_PROFILE -->|goes to| PDP
    S_SUB_HEADER -->|goes to| SDP
    
    TZ_PROFILE -->|goes to| PDP
    TZ_LAUNCH -->|goes to| NP
    
    H_PROFILE -->|goes to| PDP
    H_ROTATION -->|inline| RRP[Rotation Rules Panel ❌]
    H_BREAKER -->|inline| CBL[Circuit Breaker Log ❌]
    H_Q_HISTORY -->|inline| QHP[Q-Asker History Panel ❌]
    
    classDef built fill:#12261a,stroke:#3fb950,stroke-width:1px,color:#e6edf3
    classDef missing fill:#2d1215,stroke:#f85149,stroke-width:1px,color:#e6edf3
    classDef external fill:#1c2833,stroke:#39c5cf,stroke-width:1px,color:#e6edf3
    
    class PDP,SDP,PBDP,RPF,RRP,CBL,QHP missing
    class REDDIT external