Skip to main content

Task System

How coaches respond to different tasks and contexts.


Overview

Tasks define WHAT the coach is being asked to do. Each task has:

  • Active coaches (who responds)
  • Context requirements (what data is needed)
  • Output format (how to respond)
  • Phase configurations (for multi-step tasks)

Task Registry

Task IDNameActive CoachesDescription
plan-feedbackPlan Feedbackmax, nova, sageMoPlan wizard feedback (multi-phase)
chatOpen ChatallFree-form coach conversations
greetingDaily GreetingpersonalityMorning motivation
check-inCheck-inpersonalityRecovery and mood check-ins
workout-coachingWorkout Coachingmax, sageIn-workout guidance
contextual-tipsContextual TipsvariesContext-aware tips
progress-reviewProgress ReviewnovaWeekly/monthly reviews

Plan Feedback Task

The plan-feedback task is multi-phase, with different coach involvement at each step.

Phase Overview

User Input → Domain Experts Analyze → Personality Coach Summarizes
│ │ │
│ ├── Max: Training design │
│ ├── Nova: Feasibility ├── Delivers in user's
│ └── Sage: Recovery │ preferred style
│ │
└────────────────────────────────────────┘

Coach Involvement by Phase

PhaseMaxNovaSagePersonalityIntensity
Goal SelectionComments on training fitValidates feasibilityNotes recovery implicationsSummarizes team reactionMedium
Goal QuantificationOutlines training requirementsPrimary: Feasibility score, projectionsHighlights recovery demandsPresents verdictHeavy
Activity SelectionPrimary: Comments on activity fitSilent (defers to Max)Suggests recovery activitiesEncourages choicesMedium
Frequency & SchedulePrimary: Validates volumeChecks against timelinePrimary: Warns if overtrainingMediates conflictsHeavy
Equipment & ConstraintsPrimary: Confirms programmingSilentNotes injury accommodationsBrief acknowledgmentLight
Plan GenerationSigns off on trainingSigns off on targetsSigns off on recoveryPresents final planHeavy
Review & ActivationCommits to adjustmentsCommits to trackingCommits to check-insSeals the commitmentMedium

Legend:

  • Heavy: Multiple coaches actively analyzing with detailed feedback
  • Medium: 1-2 coaches providing focused feedback
  • Light: Quick confirmation, minimal analysis

Example: Goal Quantification Phase

User Goal: Lose 20 lbs in 12 weeks (195 → 175 lbs)

NOVA (Science & Insights):
"20 lbs in 12 weeks = 1.67 lbs/week. That's within the safe range of
1-2 lbs/week. At your starting weight, this represents 0.86% of
bodyweight weekly - optimal for fat loss while preserving muscle mass."
📊 Feasibility Score: 85/100

MAX (Training & Execution):
"To hit this target, you'll need 4 strength sessions and 2-3 cardio
sessions per week. I'll program compound lifts to maintain muscle
while you're in a deficit. No skipping leg day - that's where the
calorie burn is."

SAGE (Recovery & Lifestyle):
"At this deficit, recovery becomes critical. You'll need 7-8 hours
of sleep and at least 2 rest days per week. I'll include mobility
work to keep you feeling good. If stress spikes, we'll dial back
before burnout hits."

SAM (Personality Coach - The Buddy):
"The team says you're set up for success! 🎉 This is a solid,
achievable goal. You've got the experts behind you - Max will push
you, Nova will track your progress, and Sage will make sure you
don't burn out. And I'll be here cheering you on every step of
the way!"

Same Analysis, Different Personality

With REX (The Competitor):

"The experts have signed off. Nova says the numbers work, Max has your training locked in, and Sage will keep you from overdoing it. 20 lbs in 12 weeks - that's the target. Now let's see if you can beat it. Ready to compete?"

With ACE (The Minimalist):

"Goal approved. 12 weeks. 4 lift, 2-3 cardio, 2 rest. Sleep 7+ hours. Let's move to activities."


Chat Task

Open-ended conversation where any coach can respond based on context.

Coach Selection Logic

function selectCoachForChat(message: string, userCoach: string): string[] {
// If message is about training/exercises → Max
// If message is about data/science → Nova
// If message is about recovery/stress → Sage
// Otherwise → User's personality coach or Mo
}

Greeting Task

Daily motivational message from the personality coach.

Context Used

  • Time of day
  • Scheduled workout (if any)
  • Recent activity
  • Streak information
  • User's mood (if known)

Output Format

  • Brief (1-2 sentences)
  • Matches personality coach's voice
  • Actionable when relevant

Workout Coaching Task

In-workout guidance during active sessions.

Session Flow

PhaseCoachResponsibility
Warm-upSageMovement prep, activation
Main WorkoutMaxExercise guidance, form cues
Between SetsMaxRest timing, next set prep
Cool-downSageStretching, recovery
CompletionPersonalityCelebration, summary

Task Configuration Schema

interface TaskConfig {
taskId: string;
name: string;
description: string;

// Who responds
activeCoaches: CoachSlug[];
primaryCoach?: CoachSlug;

// What data is needed
requiredContext: string[];
optionalContext: string[];

// How to respond
outputFormat: {
maxTokens: number;
responseLength: 'brief' | 'moderate' | 'detailed';
};

// Multi-phase support
phases?: Record<string, TaskPhaseConfig>;
}

interface TaskPhaseConfig {
name: string;
activeCoaches: CoachSlug[];
primaryCoach?: CoachSlug;
outputFormat: OutputFormat;
}

Adding New Tasks

  1. Define task in lib/coaches/tasks.ts
  2. Add examples in lib/coaches/examples.ts
  3. Create API route that uses buildCoachPrompt()
// In tasks.ts
export const MY_NEW_TASK: TaskConfig = {
taskId: 'my-new-task',
name: 'My New Task',
description: 'What this task does',
activeCoaches: ['max', 'nova'],
requiredContext: ['userId', 'someData'],
outputFormat: {
maxTokens: 300,
responseLength: 'moderate',
},
};