Overview
The VibeLearn worker is an Express.js HTTP server managed by Bun, running on port 37778. It handles:- Session lifecycle (init, observations)
- The 5-step analysis pipeline
- Upstream sync with retry queue
- System health and admin
Startup
The worker is started by theSessionStart hook if not already running:
plugin/scripts/worker-wrapper.cjs (Bun-managed). Environment variable VIBELEARN_MANAGED=true is set in the worker process.
API Endpoints
Session Management
| Method | Path | Description |
|---|---|---|
POST | /api/sessions/init | Initialize a new session |
POST | /api/sessions/observations | Store a tool observation |
GET | /api/sessions/:id/summary | Get session summary |
POST /api/sessions/init
POST /api/sessions/observations
VibeLearn Analysis Pipeline
| Method | Path | Description |
|---|---|---|
POST | /api/vibelearn/analyze/stack | Detect tech stack |
POST | /api/vibelearn/analyze/static | AST pattern analysis |
POST | /api/vibelearn/analyze/concepts | LLM concept extraction |
POST | /api/vibelearn/analyze/quiz | LLM quiz generation |
POST | /api/vibelearn/sync | Sync to vibelearn.dev |
{ contentSessionId }. The concepts endpoint also accepts { last_assistant_message }.
Concept extraction response:
VibeLearn Data
| Method | Path | Description |
|---|---|---|
GET | /api/vibelearn/profile | Developer mastery profile |
GET | /api/vibelearn/questions/pending | Unanswered quiz questions |
System
| Method | Path | Description |
|---|---|---|
GET | /api/health | Full health check |
GET | /api/readiness | Simple ready check (used by hooks) |
POST | /api/admin/restart | Restart worker (requires VIBELEARN_MANAGED=true) |
POST | /api/admin/shutdown | Shutdown worker |
Analysis Pipeline Implementation
Each analysis endpoint is implemented insrc/services/worker/http/routes/VibeLearnRoutes.ts:
LLM Provider Selection
createAgentRunner() in VibeLearnRoutes creates a (prompt: string) => Promise<string> function that tries providers in order:
- Gemini — if
VIBELEARN_GEMINI_API_KEYis set in settings - OpenRouter — if
VIBELEARN_OPENROUTER_API_KEYis set - Anthropic — direct HTTP to
api.anthropic.comusingANTHROPIC_API_KEY
Logs
VIBELEARN_LOG_LEVEL in settings (debug, info, warn, error).
Route Registration
Routes are registered inWorkerService.registerRoutes():

