Status: AI endpoints are currently stubs and return
501 Not Implemented. Implementation is planned for Phase 2 (see BACKEND_STATUS.md).Get AI Insights
Authentication
Required. User can only access their own insights.Planned Features
- Pattern Detection: Identify trends in successful applications (e.g., “Companies with ‘remote-first’ in description have 3x higher response rate”)
- Recommendations: Suggest high-potential jobs based on match score and historical success
- Market Analysis: Compare your application stats to anonymized aggregate data
- Success Prediction: Estimate likelihood of getting an interview based on job characteristics
Query Parameters (Planned)
Insight type to generate.Values:
daily_digest— Daily summary of activitypattern_detection— Identify success patternsrecommendation— Job recommendationsweekly_summary— Weekly overviewmarket_analysis— Market trends
Maximum insights to return.
Response (Planned)
Array of insight objects.
Whether more insights are available.
Example Response (Planned)
Implementation Plan
AI Service: Gemini 1.5 Pro (Google AI) Workflow:- Fetch user’s jobs + events from database
- Build structured prompt with:
- Job data (company, title, status, timestamps)
- Application patterns (success rate by source, response times)
- Recent activity
- Call Gemini API with few-shot examples
- Parse response and store in
insightstable - Return cached insights if fresh (< 1 hour old)
Status: ❌ Not Implemented
Currently returns:app/api/ai/insights/route.ts:5 and docs/backend/06-AI.md for implementation details.
Generate Digest
Authentication
Required. User can only generate their own digest.Planned Features
- Daily Digest: Summary of yesterday’s activity (applications sent, responses received, upcoming interviews)
- Weekly Summary: Week in review with stats and insights
- Smart Prioritization: Highlight time-sensitive actions (e.g., “3 applications need follow-up”)
- Encouragement: Motivational messaging based on progress
Query Parameters (Planned)
Digest type.Values:
daily_digest— Last 24 hoursweekly_summary— Last 7 days
Include job recommendations in digest.
Response (Planned)
Digest insight object (same schema as Get AI Insights).
Example Response (Planned)
Implementation Plan
AI Service: Claude 3.5 Sonnet (Anthropic) Workflow:- Fetch recent events (last 24h for daily, 7d for weekly)
- Aggregate stats:
- Applications sent
- Status changes
- Upcoming interviews (from
interview_atfield) - Response times
- Build structured prompt with context
- Call Claude API for natural language generation
- Store generated digest in
insightstable - Optionally send via Discord webhook or email
Status: ❌ Not Implemented
Currently returns:app/api/ai/digest/route.ts:5 and docs/backend/06-AI.md for implementation details.
Job Scoring (Planned)
While not exposed as a direct API endpoint, job scoring happens automatically:When Jobs Are Scored
- New job created — Scored asynchronously after creation
- Job updated — Re-scored if description or requirements change
- Manual trigger — User can request re-scoring from UI
Scoring Algorithm (Planned)
AI Model: Gemini 1.5 Flash (fast + cost-effective) Input:- Job description
- Company name
- User’s profile (extracted from past applications)
- User’s resume (if uploaded)
ai_match_score(0-100)ai_reasoning(explanation)ai_parsed_data(extracted skills, salary, experience level)
Database Updates
Scoring automatically updates:jobs.ai_match_scorejobs.ai_reasoningjobs.ai_parsed_data- Creates
ai_scoredevent
Status: ❌ Not Implemented
AI scoring is planned for Phase 2. Seedocs/backend/06-AI.md for full specification.
Errors
All AI endpoints return standard error responses:Common Errors (Planned)
- 401 Unauthorized — Missing or invalid auth token
- 429 Rate Limited — Exceeded 20 requests/hour limit
- 500 AI Service Error — Gemini/Claude API error
- 501 Not Implemented — Current stub response
- 503 Service Unavailable — AI service temporarily down
Example Error Response
Rate Limiting
AI endpoints have strict rate limits due to API costs:- Standard Users: 20 requests/hour
- Reset: Top of each hour (UTC)
- Headers: Rate limit info included in response:
Exceeding Limits
When rate limited:Implementation Timeline
AI features are planned for Phase 2 (Week 2):| Feature | Priority | Estimated Effort |
|---|---|---|
| Job Scoring (Gemini) | 🔴 High | 4-6 hours |
| Daily Digest (Claude) | 🟡 Medium | 3-4 hours |
| Pattern Detection | 🟢 Low | 4-6 hours |
| Market Analysis | 🟢 Low | 4-6 hours |
- API keys (Google AI, Anthropic)
- Jobs API must be complete first
- User profile data for personalization
docs/backend/06-AI.md and BACKEND_STATUS.md for full implementation plan.