Skip to content

Build message generation and scheduling systemΒ #417

@BillChirico

Description

@BillChirico

πŸ’¬ Build Message Generation and Scheduling System

Overview

Create the engine that decides when, what, and how to message users β€” personalized, timely, meaningful.


Goals

  • Right message at the right time
  • Context-aware (recent check-ins, triggers, milestones)
  • Personalized based on learned patterns
  • Never generic or robotic

Message Types

Type Trigger Example
Check-in Daily schedule "Hey, how's today going?"
Anticipatory Pattern prediction "Friday night coming up. Want to lock in your plan?"
Contextual Recent event "Rough day yesterday β€” you good?"
Milestone Streak achieved "30 days. That's not luck β€” that's you."
Supportive Slip reported "Slips happen. You're not starting over."
Tool suggestion High-risk moment "Want to try a breathing exercise?"

Scheduling Logic

Schedule Message:
  IF quiet hours β†’ skip
  IF user disabled Buddy β†’ skip
  IF recent message (< 4 hours) β†’ skip
  
  Determine optimal time:
    - Learned check-in window
    - User timezone
    - No quiet hours
    
  Generate message:
    - Context from mem0
    - User tone preference
    - Current situation (triggers, milestones)
    
  Send via push notification

Message Generation Pipeline

  1. Context Assembly β€” Gather from mem0 (patterns, history)
  2. Prompt Building β€” Create AI prompt with context
  3. Generation β€” Vercel AI SDK streaming response
  4. Personalization β€” Apply tone, insert user details
  5. Delivery β€” Push notification with deep link
  6. Tracking β€” Log delivery, open, response

Implementation Tasks

  • Build message template system
  • Implement scheduling engine
  • Create context assembly layer
  • Build prompt builder
  • Integrate with Vercel AI SDK (Set up Vercel AI SDK infrastructureΒ #413)
  • Add push notification delivery
  • Implement message tracking
  • Create A/B testing framework
  • Add message history view

Acceptance Criteria

  • Messages send within learned time windows
  • Quiet hours never violated
  • Contextual messages reference actual events
  • Tone matches user preference
  • Push notifications open to conversation
  • Message history accessible in app
  • < 2 second generation time

Message Examples by Tone

Warm:

"Hey! Saw you hit 7 days. That's a whole week of choosing you. How are you feeling?"

Direct:

"7 days. What's working?"

Encouraging:

"A whole week! You're building something real here. Keep going!"


Related


Part of Sobers v2

Metadata

Metadata

Assignees

Labels

aiAI/ML relatedbackendBackend/API related changessobers-buddySobers Buddy AI companion feature

Type

No type

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions