We all hit a wall when coding. Error loops, stubborn bugs, and unhelpful AI assistants often push developers to the brink of keyboard-smashing frustration.
Baitrage is the intervention. It's an autonomous affective dashboard that sits in your workflow, tracks your emotional state via content-analysis, and automatically steps in with codebase-aware, cool-headed prompt synthesis before you lose your mind.
Baitrage operates a localized, privacy-first affective loop:
- Monitor: Uses Gemini Flash to analyze your speech transcription, facial expressions, and screen frames. It looks for genuine signs of frustration (profanity, exasperation), completely ignoring mere high volume.
- Ingest: Continuously watches your active files to build an abstract, up-to-date symbol map of your local project.
- Intervene: When the "circuit breaker" triggers, Baitrage locks your UI briefly to halt the frustration loop.
- Synthesize: It generates a highly optimized, context-aware prompt using Gemini Pro, ready to be pasted directly into your AI coding assistant to get you unstuck.
Requires Node.js v18+, a modern browser, and a Gemini API Key.
# 1. Install dependencies
npm install
# 2. Set up credentials
cp .env.example .env.local
# Add your GOOGLE_GENERATIVE_AI_API_KEY to .env.local
# 3. Start the dashboard
npm run dev- Launch: Open
http://localhost:3000in your browser. - Start Monitoring: Click the power button icon (top left of the screen panel) and grant camera/microphone permissions.
- Share Context: Click the monitor icon to share your IDE or AI chat window.
- Code Normally: As you work, Baitrage indexes your files into its symbol map.
- Get Frustrated: When you run into a bug, just talk out loud. "This stupid function keeps breaking, I've tried three times!"
- Pivot: Baitrage detects your frustration, triggers the circuit breaker, and generates a calm, context-aware prompt.
- Copy & Paste: Click "Copy" on the RESPONSE panel and paste it into your AI assistant.
Baitrage is powered by a concurrent, multi-agent architecture designed to separate high-frequency multimodal observation from deep, asynchronous code synthesis. Instead of relying on a single monolithic LLM call, Baitrage delegates tasks to a swarm of specialized agents.
graph TD
%% Ingestion Layer
subgraph Ingestion["1. Multimodal Ingestion Layer"]
Mic["Microphone\n(Web Speech API)"]
Cam["Camera\n(Video Frames)"]
Screen["Screen Share\n(Active Window)"]
FS["Codebase Watcher\n(Chokidar + SSE)"]
end
%% Intelligence Layer
subgraph Intelligence["2. The Observer Agent (Gemini Flash)"]
Analyze["/api/analyze Endpoint"]
Mic -->|Live Transcript| Analyze
Cam -->|Facial Affect| Analyze
Screen -->|Visual Context| Analyze
Eval["Frustration Evaluator"]
Analyze -->|v_strain, f_micro, p_looping| Eval
end
%% Orchestrator Layer
subgraph Orchestration["3. The Intervention Swarm (Gemini Pro)"]
Sentinel["Rage Sentinel"]
Miner["Intent Miner"]
Scout["Symbol Scout"]
Architect["Prompt Architect"]
Eval -->|> 0.35 Threshold| Sentinel
Sentinel --> Miner
FS -->|Local Symbol Map| Scout
Miner --> Architect
Scout --> Architect
end
%% UI Output
UI["Cinematic Mirror Dashboard"]
Architect -->|Optimized Prompt & Advice| UI
- Role: High-frequency multimodal state evaluator.
- Function: Every 5 seconds, this fast-inference agent processes an aggregated batch of live transcripts, camera frames, and screen context. Its sole responsibility is Affective Scoring. It evaluates the true emotional state based on content (e.g., cursing, exasperated phrasing) and micro-expressions, actively decoupling frustration detection from raw volume to prevent false positives.
When the Frustration Evaluator circuit breaker trips (> 0.35 threshold), the concurrent agent-orchestrator.ts spawns a swarm of specialized agents to execute the pivot strategy:
- Rage Sentinel (Gatekeeper): Makes a deterministic local decision on whether to intervene based on the ledger history, preventing intervention spam.
- Intent Miner (Analyst): Analyzes the transcript and screen grounding to infer the developer's exact current task, blocking issue, and failure mode.
- Symbol Scout (Context Fetcher): A Retrieval-Augmented Generation (RAG) agent that parses the local
symbol-map.json(built via Chokidar) to pull only the relevant function signatures, types, and variables needed to solve the issue. - Prompt Architect (Synthesizer): The final heavy-lifter. It combines the Intent Miner's task analysis with the Symbol Scout's codebase context to engineer a highly structured, cool-headed "Optimized Prompt". This prompt is designed to be pasted directly into the developer's IDE or AI coding assistant to break the error loop.
Empowering developers to step back, breathe, and let the codebase solve the problem.
