LabHelper (LabDefense Copilot) is an invisible, real-time AI prompter and study copilot for Windows, built for online lab defenses, technical interviews, exams, and live Q&A sessions over Zoom, Google Meet, Discord, and Microsoft Teams.
It captures audio directly from your system output (WASAPI Loopback) and/or microphone, pairs it with your indexed source code and lab report, and streams concise, natural spoken answers into a screen-share-invisible HUD overlay.
-
Stealth HUD Overlay (
WDA_EXCLUDEFROMCAPTURE)- Uses the native Windows
SetWindowDisplayAffinity(WDA_EXCLUDEFROMCAPTURE)API so the floating overlay is visible to you on your monitor, while completely invisible in Zoom, Google Meet, Discord, Teams, or OBS screen sharing. - Customizable opacity, window size, and font scaling, plus one-click copy for generated code blocks.
- Built-in line-reference verification (
AnswerParser) checksfile:linecitations against your loaded context and automatically hides hallucinated references.
- Uses the native Windows
-
Three Specialized Assistant Modes
Defense(Lab Prompter): Generates natural, spoken-word answers grounded in your actual lab code and report using a two-tier structure (Say Now for an immediate 1-sentence start, Add More for technical follow-up details, and Reference for verifiedfile:linepointers).Dub(Zero-File Live Prompter): Instant spoken answers for interviews, colloquiums, or oral exams without needing any loaded project files.Chat(AI Mentor): General-purpose programming, math, debugging, and code-review assistant.
-
Real-Time Audio Pipeline & Gemini Live API
- WASAPI Loopback + Microphone: Captures the instructor's voice directly from your speakers/headphones (no virtual audio cables required) with adaptive Voice Activity Detection (VAD).
- Optional Gemini Live WebSocket Mode: Supports real-time streaming transcription and native Live sessions (
gemini-3.5-transcribe-live,gemini-3.8-live,gemini-3.8-live-extended-thinking) with automaticsession_resumption.
-
Smart Multi-Model Router (
ModelRouter+ModelStats)- Parallel hedged fallback across Gemini 3.5, 3.6, 3.8, and Gemini 4 models (
gemini-3.5-flash-lite,gemini-3.1-flash-lite,gemini-3.6-flash,gemini-3.8-flash,gemini-4-hydrogen,gemini-4-argon,gemini-4-carbon). - Tracks real-world EWMA latency and decayed failure rates per model in
model_stats.json, automatically ranking healthy models and applying cooldowns on rate limits or overloads.
- Parallel hedged fallback across Gemini 3.5, 3.6, 3.8, and Gemini 4 models (
-
Context Indexing & Pre-Defense Tools
- Automatically indexes source code (
.py,.c,.cpp,.cs,.java,.js,.ts,.go,.rs,.ipynb, etc.) with exact 1:1 IDE line numbers, alongside reports (.md,.txt,.docx,.pdf). - Supports Saved Lab Profiles (
lab_profiles) for instant switching between subjects/labs. - Includes Screen Capture Q&A (
Ctrl+Shift+S), Clipboard Q&A (Ctrl+Shift+V), Speech-to-Text Dictation (Ctrl+Shift+D/🎙toggle into the input field), Question Wait Modes (Fast / Long / Manual), and Collapse / Always-on-Top (—/📌) controls.
- Automatically indexes source code (
-
Secure Credential Storage
- Stores your
GEMINI_API_KEYin Windows Credential Manager viakeyring(falling back to.env, never plaintext inconfig.json), guided by aFirstRunWizard.
- Stores your
flowchart LR
A["WASAPI Loopback / Mic"] --> B["AudioCapture (Adaptive VAD)"]
S["Screen / Clipboard / Text"] --> E["AIAssistant"]
C["Lab Code + Report (PDF/DOCX/MD)"] --> D["ContextLoader"]
B -->|"Audio WAV"| E
B -->|"PCM Stream"| L["LiveSessionManager (WebSocket)"]
D -->|"Indexed Context"| E
L -->|"Transcript / Live Answer"| E
E --> R["ModelRouter (Hedged Fallback + ModelStats)"]
R --> P["AnswerParser (Two-Tier + Line Verification)"]
P --> H["StealthHUD (WDA_EXCLUDEFROMCAPTURE)"]
- Windows 10 / 11 (required for WASAPI Loopback and
WDA_EXCLUDEFROMCAPTURE) - A Google Gemini API Key
- Python 3.12+ (only needed if running from source)
- Download
LabDefense.exefrom the Latest Release. - Place
LabDefense.exein its own folder and run it (no Python installation required). config.jsonandmodel_stats.jsonare created next toLabDefense.exe, and your Gemini API key is stored securely in Windows Credential Manager.
git clone https://github.com/Basiliksys/LabHelper.git
cd LabHelper
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python run.pyTo build dist/LabDefense.exe locally:
pip install pyinstaller
.\build_exe.bat- On first launch,
FirstRunWizardprompts for your Gemini API Key (saved securely in Windows Credential Manager). - Open Settings (⚙) to select your Lab Source Directory and optional Report File (
.md,.txt,.docx,.pdf), or save them as a reusable Lab Profile. - Choose your preferred Mode (
Defense,Dub, orChat), Audio Source (PC + Mic,PC only,Mic only), and optionally toggle Live Mode.
| Hotkey | Action |
|---|---|
Ctrl + Shift + H |
Show / hide the Stealth HUD overlay |
Ctrl + Shift + C |
Clear displayed answers and conversation history |
Ctrl + Shift + L |
Pause / resume audio listening |
Ctrl + Shift + Space |
Force immediate answer from the current speech buffer |
Ctrl + Shift + Q |
Focus the manual text question input |
Ctrl + Shift + V |
Ask a question directly from clipboard text |
Ctrl + Shift + S |
Capture screen and analyze visible code, errors, or tasks |
Ctrl + Shift + D |
Toggle Speech-to-Text dictation into the input field |
All hotkeys can be customized in config.json (see config.example.json).
LabHelper/
├── assets/
│ └── banner.svg # Dark-mode GitHub banner
├── labdefense/
│ ├── __init__.py
│ ├── ai_assistant.py # High-level AI facade, history & cancellation
│ ├── answer_parser.py # Two-tier parser & file:line verification
│ ├── audio_capture.py # WASAPI Loopback + Mic capture with adaptive VAD
│ ├── config.py # Config loader, keyring storage, lab profiles
│ ├── context_loader.py # Deterministic code indexer & PDF/DOCX/MD reader
│ ├── first_run.py # First-run API key & setup wizard
│ ├── live_client.py # Gemini Live API WebSocket session manager
│ ├── main.py # Application orchestrator & global hotkeys
│ ├── model_router.py # Hedged fallback, cooldowns & error classification
│ ├── model_stats.py # EWMA latency & failure rate tracker
│ ├── prompts.py # System instructions for Defense / Dub / Chat
│ └── stealth_hud.py # PyQt5 Stealth HUD with WDA_EXCLUDEFROMCAPTURE
├── tests/
│ ├── conftest.py
│ ├── test_answer_parser.py
│ ├── test_audio_pipeline.py
│ ├── test_config.py
│ ├── test_context_loader.py
│ ├── test_fallback.py
│ ├── test_hud.py
│ ├── test_live_mode.py
│ ├── test_model_stats.py
│ └── test_modes.py
├── .github/
│ ├── workflows/tests.yml # Windows CI running pytest
│ ├── ISSUE_TEMPLATE/
│ └── PULL_REQUEST_TEMPLATE.md
├── config.example.json # Sample non-secret configuration
├── requirements.txt
├── run.py # Application entry point
└── LICENSE # MIT License
pytest -qTests run headless in CI on windows-latest using QT_QPA_PLATFORM=offscreen.
This project is licensed under the MIT License — see LICENSE for details.