Weekly Brief
The weekly brief is a short AI-generated message delivered every Monday morning. It summarises the previous week and sets the tone for the week ahead.
Delivery
- Generated by a Vercel cron job at
0 8 * * 1(Monday 08:00 UTC) - Route:
POST /api/cron/coach-brief - Protected by
CRON_SECRETheader - Generates a brief for every user with an active season
Data inputs
The brief generation function receives:
interface WeeklyBriefInput {
userId: string
seasonType: 'nord' | 'jari'
weekNumber: number // 1–13 within the 90-day season
streakDays: number
seasonScore: number // 0–100 percentage
habitsThisWeek: {
done: number
skip: number
miss: number
total: number
}
promptResponses: { // from DailyPromptLog
gratitude: string[]
creativity: string[]
reflection: string[]
}
previousBrief: string | null // last week's coach message
}
Output format
The brief is a short text block — 3 to 6 sentences. It does not use headers or bullet points. It reads as a direct message from the coach, not a report.
Storing briefs
// Saved as a CoachMessage with role='assistant' and weekKey='YYYY-WNN'
await prisma.coachMessage.create({
data: {
userId,
role: 'assistant',
content: brief,
weekKey: `${year}-W${String(weekNum).padStart(2, '0')}`,
}
})
The weekKey allows deduplication — only one brief per user per week is generated.
Chat continuation
After reading the brief, users can reply in the Coach page chat. Replies are stored as role='user' messages. The full conversation history (filtered to the current week) is sent to Claude on each turn.
Model
Coach messages use claude-sonnet-4-20250514. The model is called server-side only — the Anthropic API key is never exposed to the client.