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 ID | Name | Active Coaches | Description |
|---|---|---|---|
plan-feedback | Plan Feedback | max, nova, sage | MoPlan wizard feedback (multi-phase) |
chat | Open Chat | all | Free-form coach conversations |
greeting | Daily Greeting | personality | Morning motivation |
check-in | Check-in | personality | Recovery and mood check-ins |
workout-coaching | Workout Coaching | max, sage | In-workout guidance |
contextual-tips | Contextual Tips | varies | Context-aware tips |
progress-review | Progress Review | nova | Weekly/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
| Phase | Max | Nova | Sage | Personality | Intensity |
|---|---|---|---|---|---|
| Goal Selection | Comments on training fit | Validates feasibility | Notes recovery implications | Summarizes team reaction | Medium |
| Goal Quantification | Outlines training requirements | Primary: Feasibility score, projections | Highlights recovery demands | Presents verdict | Heavy |
| Activity Selection | Primary: Comments on activity fit | Silent (defers to Max) | Suggests recovery activities | Encourages choices | Medium |
| Frequency & Schedule | Primary: Validates volume | Checks against timeline | Primary: Warns if overtraining | Mediates conflicts | Heavy |
| Equipment & Constraints | Primary: Confirms programming | Silent | Notes injury accommodations | Brief acknowledgment | Light |
| Plan Generation | Signs off on training | Signs off on targets | Signs off on recovery | Presents final plan | Heavy |
| Review & Activation | Commits to adjustments | Commits to tracking | Commits to check-ins | Seals the commitment | Medium |
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
| Phase | Coach | Responsibility |
|---|---|---|
| Warm-up | Sage | Movement prep, activation |
| Main Workout | Max | Exercise guidance, form cues |
| Between Sets | Max | Rest timing, next set prep |
| Cool-down | Sage | Stretching, recovery |
| Completion | Personality | Celebration, 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
- Define task in
lib/coaches/tasks.ts - Add examples in
lib/coaches/examples.ts - 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',
},
};