Problem Statement
DevTrack allows developers to set manual coding goals (e.g., commits, merged PRs). However, users often struggle to set realistic, challenging, and meaningful goals. They either set arbitrary targets that are trivial to pass, or overshoot and set unreachable goals, leading to low completion rates. There is currently no feature that looks at a user's actual historical coding output (such as most active repositories, languages, and WakaTime coding hours) and offers personalized, data-backed goals.
Proposed Solution
We should build an AI Goal Mentor feature that provides personalized goal suggestions based on the user's recent contribution history.
- AI API Route (
/api/goals/mentor-suggestions):
- Fetch the user's last 14-30 days of metrics, including commits by repository, total PRs, language breakdowns, and average coding hours.
- Format these metrics into a system prompt for the Groq/Gemini models.
- Ask the model to return 3 goal suggestions in a structured JSON schema:
{
"suggestions": [
{
"title": "Boost JavaScript contributions",
"target": 15,
"unit": "commits",
"repo": "owner/repo-name",
"recurrence": "weekly",
"reasoning": "You made 11 commits in JavaScript last week. Let's aim to push it to 15!"
}
]
}
- Caching:
- Store generated suggestions in the
ai_insights table under a new insight_type = 'goal_suggestions' with a 24-hour TTL (similar to /api/personality). This avoids repeating expensive model requests on page refreshes.
- Frontend UI Panel (
src/components/GoalTracker.tsx):
- Display a clean "AI Goal Mentor" section inside the goal-tracking page.
- Render the recommendations as interactive cards showing the suggested target, unit, and the AI's brief reasoning.
- Provide an "Accept Goal" action button that automatically fills and submits the goal creation form.
- Graceful Fallback:
- If
GROQ_API_KEY or GEMINI_API_KEY is not set, display a few standard rule-based recommendations (e.g., "Aim for 10 commits this week") and an educational message.
Feature Area
API / Backend
Alternatives Considered
- Simple Rule-Based Suggestion Engine:
- Approach: Calculate suggestions strictly with hardcoded math (e.g., target =
previous_week_commits * 1.2).
- Why not chosen: This lacks conversational encouragement and cannot combine cross-repository context (e.g., noticing a user switched focus to a new Rust repository and suggesting a goal for that specific repository).
- Scheduled Weekly Suggestions:
- Approach: Run a weekly cron job to calculate suggestions for all users and email them.
- Why not chosen: Causes massive API cost spikes and database overhead. Generating on-demand with a 24-hour cache is much more cost-effective and responsive.
Acceptance Criteria
Additional Context
No response
Problem Statement
DevTrack allows developers to set manual coding goals (e.g., commits, merged PRs). However, users often struggle to set realistic, challenging, and meaningful goals. They either set arbitrary targets that are trivial to pass, or overshoot and set unreachable goals, leading to low completion rates. There is currently no feature that looks at a user's actual historical coding output (such as most active repositories, languages, and WakaTime coding hours) and offers personalized, data-backed goals.
Proposed Solution
We should build an AI Goal Mentor feature that provides personalized goal suggestions based on the user's recent contribution history.
/api/goals/mentor-suggestions):{ "suggestions": [ { "title": "Boost JavaScript contributions", "target": 15, "unit": "commits", "repo": "owner/repo-name", "recurrence": "weekly", "reasoning": "You made 11 commits in JavaScript last week. Let's aim to push it to 15!" } ] }ai_insightstable under a newinsight_type = 'goal_suggestions'with a 24-hour TTL (similar to/api/personality). This avoids repeating expensive model requests on page refreshes.src/components/GoalTracker.tsx):GROQ_API_KEYorGEMINI_API_KEYis not set, display a few standard rule-based recommendations (e.g., "Aim for 10 commits this week") and an educational message.Feature Area
API / Backend
Alternatives Considered
previous_week_commits * 1.2).Acceptance Criteria
/api/goals/mentor-suggestionsis created and secure (requires an active NextAuth session).Additional Context
No response