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
POST /api/sessions/init
POST /api/sessions/observations
VibeLearn Analysis Pipeline
All analysis endpoints accept
{ contentSessionId }. The concepts endpoint also accepts { last_assistant_message }.
Concept extraction response:
VibeLearn Data
System
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():

