Buddy AI — Live Neural Copilot
Buddy AI is the unified EEG and BCI copilot built directly into PiEEG Cloud (opens in a new tab). It combines the browser-native neural cascade from Buddy, the turn-based pattern training, Lab Notebook sessions, Jupyter notebook export, and dashboard actuators from PiEEG Agent, and grounded documentation retrieval (docs.pieeg.com) into a single right-hand drawer inside the dashboard.
Press C (or click Buddy AI in the dashboard header/sidebar) on any live hardware, Web Bluetooth, Web Serial, or simulated stream at cloud.pieeg.com (opens in a new tab) to open the copilot.
Buddy AI works out of the box with zero configuration using PiEEG Cloud AI (Turnkey), supports Bring Your Own Key (BYOK) for cloud and local LLMs (Ollama, LM Studio), and includes an offline Built-in Neural Analyst fallback that executes real tools on your live EEG and documentation without any network calls.
Getting started
Connect a board or start a demo at cloud.pieeg.com
Open cloud.pieeg.com (opens in a new tab) in a Chromium browser and pick any source in the Session Lobby:
- PiEEG Devices: IronBCI (8/16 ch BLE), PiEEG XR (8/16 ch BLE), Octopus 16 (BLE), Aura VR (8-ch EMG + IMU), IronBCI-32 (USB Serial), or Kraken-48 (USB Serial).
- BrainFlow Devices: 19 third-party WebBLE and WebSerial boards.
- PiEEG Server WebSocket:
ws://localhost:1616or a remote relay. - Simulated / Programmable Demo: 8, 16, 32 channels, Aura, or
/mockstudio — no hardware required.
Open the Buddy AI drawer
Click Buddy AI in the dashboard or press C. The drawer has three tabs:
- 💬 Copilot Chat — natural-language Q&A, guided pattern training, one-click prompt suggestions, and inline Jupyter
.ipynbdownloads. - 🧠 Brain & Patterns — live neural state meters, band powers, per-channel quality grid, trained pattern detectors, Lab Notebook sessions, connectivity, and recent artifacts.
- ⚙ Model — switch between Turnkey Cloud AI, BYOK providers, local Ollama / LM Studio, or the offline Built-in Neural Analyst, and toggle optional voice read-aloud (TTS) or webcam artifact tracking.
Ask, train, or control
Click a suggestion chip (for example "What is my brain doing right now?" or "Let's train a new pattern together") or type your own question. Buddy AI calls live tools against CloudNeuralEngine, shows each tool call inline, and streams its grounded answer.
Live Brain & Patterns tab
Buddy AI continuously distills the multichannel ring buffer inside your browser (CloudNeuralEngine) into structured, language-sized summaries:
| Card | What it shows |
|---|---|
| Live Neural State | Smoothed focus / relax / engagement indices (0–1, within-session relative), dominant band, overall signal quality, bad_channels, and a warming_up badge while baseline variance settles. |
| Frequency Bands | Relative Delta (δ), Theta (θ), Alpha (α), Beta (β), and Gamma (γ) power, plus a one-click Deep Spectrum → shortcut for IAF and 1/f slope analysis. |
| Trainable Pattern Detectors | Live activation probabilities (0–100%) for your trained classifiers, with leave-one-rep-out cross-validated balanced accuracy (CV), Explain, and + Train Pattern controls. |
| Lab Notebook Sessions | Saved experimental windows (for example eyes-closed-rest vs. mental-math) with one-click Analyze and Compare (Cohen's d) actions. |
| Channel Signal Quality | Per-channel status (good, flat, rail, noisy, line), RMS in µV, and 50/60 Hz mains line-noise ratio. |
| Functional Connectivity | Cross-channel amplitude coupling (Pearson r over log band-power envelopes), strongest electrode pairs, and mean coupling. |
| Recent Artifacts | Real-time time-domain transient log: single/double eye blinks, jaw clenches, and motion spikes, plus optional MediaPipe webcam face/blink context. |
Perception cascade
To bridge the rate mismatch between EEG (250–500 Hz) and LLM reasoning (~1 Hz), Buddy AI runs a 5-tier perception cascade in the browser. The model pulls compact summaries via tools on demand and is never sent raw EEG waveforms:
| Tier | Rate | Representation | LLM sees |
|---|---|---|---|
| T0 Raw | 250–500 Hz | Float32 µV samples in browser ring buffer | Never |
| T1 Features | ~4–8 Hz | Per-channel log band powers, RMS, line-length, quality | Via tools |
| T2 State | ~1 Hz | Smoothed focus / relax / engagement, dominant band | Via tools |
| T3 Events | Sparse | Debounced state transitions, blinks, clenches, pattern hits | Via tools |
| T4 Reason | On query | Multi-turn tool-calling loop + docs RAG + actuators | Compact JSON tool outputs |
Complete toolset (22 tools)
Buddy AI grounds every claim about your signal or hardware in a fresh tool call:
1. Live neural senses
| Tool | Description |
|---|---|
get_neural_state | Current smoothed focus, relax, and engagement indices (0–1, within-session), dominant band, relative band powers, signal quality, bad_channels, and warming_up. |
get_band_powers | Relative EEG band powers (Delta, Theta, Alpha, Beta, Gamma) averaged across channels, plus per-channel breakdown in µV²/Hz. |
analyze_spectrum | Deeper spectral analysis: individual alpha-peak frequency (IAF), aperiodic 1/f exponent & offset, theta/beta ratio, spectral entropy, and frontal alpha asymmetry (channel-average or single channel). |
find_artifacts | Recent discrete time-domain transients (blink, blink_double, jaw_clench, motion). |
get_recent_events | Recent debounced neural state transitions and signal-quality drops/recoveries. |
get_channel_quality | Per-channel verdicts (good, flat, rail, noisy, line) with RMS (µV), 50/60 Hz line-noise ratio, and 0–1 score. |
connectivity | Cross-channel functional connectivity (Pearson r over log band-power envelopes) for any band (Delta–Gamma) and window (2–30 s). |
get_video_context | Reads optional in-browser MediaPipe webcam face/artifact tracking (blinks, head motion, jaw movement) when enabled by the user. |
2. Trainable patterns & Lab Notebook sessions
| Tool | Description |
|---|---|
list_patterns | Lists all trained pattern detectors saved in the browser with their leave-one-rep-out cross-validated balanced accuracy. |
detect_patterns | Checks which trained patterns are firing right now, with smoothed 0–1 probabilities. |
explain_pattern | Explains a pattern detector: threshold, LORO-CV balanced accuracy, per-channel importance, and top separating features (Cohen's d). |
forget_pattern | Deletes a trained pattern detector from live memory and localStorage. |
start_pattern_training | Starts teaching a new pattern detector by example (e.g. eyes-closed, mental-math, jaw-clench). |
record_segment | Records one labelled segment (rest or active, 1–15 s) from the live stream. Enforces at most one segment per turn so you have time to switch mental states. |
finish_pattern_training | Fits the L2 + group-lasso logistic classifier across recorded reps, cross-validates by rep (LORO-CV), saves to localStorage, and starts live scoring. |
cancel_pattern_training | Cancels an in-progress pattern training session without saving. |
record_session | Records a labelled Lab Notebook session window (2–60 s) and saves its spectral, state, quality, and connectivity summary. |
list_sessions | Lists all saved Lab Notebook session summaries in the browser. |
analyze_session | Loads the full statistical summary of a saved Lab Notebook session by label. |
compare_sessions | Contrasts two saved sessions (a vs b) using within-session Cohen's d effect sizes across bands, state indices, and quality. |
forget_session | Deletes a saved Lab Notebook session summary. |
3. PiEEG documentation RAG, scientific literature & Jupyter notebooks
| Tool | Description |
|---|---|
search_docs | Searches the indexed PiEEG documentation corpus (/pieeg-docs-index.json) for hardware specs, ADS1299 registers, 10-20 electrode placement, noise elimination, Web Bluetooth, Local Bridge, and LSL, returning grounded excerpts with docs.pieeg.com citations. |
search_web | Searches Wikipedia or NCBI PubMed directly from the browser for neuroscience, EEG rhythms, ERPs (P300, SSVEP), and BCI research literature. |
create_notebook | Generates a downloadable .ipynb Jupyter Notebook preloaded with the live EEG snapshot, channel metadata, and custom Markdown + Python analysis/plotting cells. |
4. Dashboard inspection & control (actuators)
| Tool | Description |
|---|---|
get_dashboard_status | Reads the active PiEEG Cloud dashboard state: bandpass and 50/60 Hz notch filter settings, spike rejection, CSV recording status, visible analysis panels, sample rate, and channel count. |
control_dashboard | Executes safe UI actions on the live dashboard: set_bandpass, toggle_bandpass, set_notch, toggle_notch, start_recording, stop_recording, pause_stream, resume_stream, toggle_panel (fft, spectrogram, stats, mental_state), or navigate (dashboard, calibration, lab, wellness, experiences, library). |
Model providers (Turnkey, BYOK & Offline)
Configure your preferred model in the ⚙ Model tab of the Buddy AI drawer:
| Provider | Mode | API Key Required | Default Model | How it connects |
|---|---|---|---|---|
| PiEEG Cloud AI (Turnkey) | Default | No | claude-haiku-4-5 | Streams through the stateless /api/agent/chat Vercel Edge proxy (falls back automatically to the Built-in Neural Analyst if offline). |
| Anthropic (BYOK) | Cloud BYOK | Yes | claude-sonnet-4-6 | Direct browser SSE to api.anthropic.com |
| OpenAI (BYOK) | Cloud BYOK | Yes | gpt-4o-mini | Direct browser SSE to api.openai.com |
| Groq (BYOK) | Cloud BYOK | Yes | llama-3.3-70b-versatile | Direct browser SSE to api.groq.com |
| Together AI (BYOK) | Cloud BYOK | Yes | Llama-3.3-70B-Instruct-Turbo | Direct browser SSE to api.together.xyz |
| OpenRouter (BYOK) | Cloud BYOK | Yes | anthropic/claude-3.5-haiku | Direct browser SSE to openrouter.ai |
| Ollama (Local) | Local | No | llama3.1 | Direct to http://localhost:11434/v1 |
| LM Studio (Local) | Local | No | local-model | Direct to http://localhost:1234/v1 |
| Custom OpenAI Endpoint | Custom | Optional | gpt-4o-mini | Any OpenAI-compatible /v1/chat/completions URL |
| Built-in Neural Analyst | 100% Offline | No | pieeg-analyst-v1 | Runs locally in the browser; executes real tools on live EEG & docs and formats a grounded Markdown report with zero network traffic. |
Guided pattern training
Buddy AI trains personalized classifiers for any mental, visual, or motor state you can reproduce (for example eyes-closed, meditation, mental-math, or jaw-clench):
- Contrastive reps: You record alternating
rest(baseline) andactivesegments (4 seconds each across 3–5 reps), either via the + Train Pattern modal in the Brain & Patterns tab or step-by-step in chat (where quick-action buttons appear automatically for each rep). - Spatial group-lasso + L2 logistic classifier: Extracts per-channel log band powers (
logDelta..logGamma),logRMS, andlogLineLength, encouraging spatial sparsity across electrodes. - Honest cross-validation: Evaluated with Leave-One-Rep-Out Cross-Validation (LORO-CV) and balanced accuracy so temporal autocorrelation and class imbalance cannot inflate scores.
- Channel importance:
explain_patternreports per-channel weights and top Cohen's d features so you can verify whether a detector reads occipital alpha (O1/O2) or frontal muscle artifacts (Fp1/Fp2).
Buddy AI is a neuroscience research and engineering tool — not a medical device. All focus, relax, and engagement indices are normalized within the current session ("high or low for you right now"), never clinical or diagnostic measures.
Privacy & data handling
Buddy AI follows PiEEG Cloud's browser-first privacy model (see the full Privacy Page (opens in a new tab)):
- Raw EEG never leaves your device: Signal acquisition, DSP filtering, FFTs, artifact detection, connectivity, pattern training, and Lab Notebook session recording run 100% locally in your browser tab. Raw waveforms are never sent to any AI model.
- Compact numerical tool summaries only: When you chat with an LLM, only your conversation messages and the compact JSON summaries returned by tools (such as band-power ratios, channel quality scores, or artifact counts) are included in the prompt context.
- Stateless Turnkey proxy: When using PiEEG Cloud AI (Turnkey), chat requests are forwarded through our stateless Vercel Edge proxy (
/api/agent/chat) to Anthropic to stream the response. PiEEG does not log, store, or inspect your prompts, neural summaries, or responses. - Direct BYOK: When you provide your own API key, requests go directly from your browser to your selected provider. Your API key is stored only in your browser's
localStorage(if you keep Remember key in this browser enabled) and is never transmitted to PiEEG servers. - 100% local & offline options: Selecting Ollama, LM Studio, or the Built-in Neural Analyst (Offline) keeps all prompts and tool summaries entirely on your machine.
- Local webcam & local storage: Optional webcam artifact tracking runs locally via in-browser MediaPipe WASM/WebGL (video frames never leave your device). Conversations, trained patterns, and Lab Notebook sessions persist only in your browser's
localStorageand can be deleted at any time.
Buddy AI (Cloud) vs. PiEEG Agent (Python CLI / MCP)
| Buddy AI in PiEEG Cloud (opens in a new tab) | PiEEG Agent (Python CLI & MCP) | |
|---|---|---|
| Runtime | 100% in-browser at cloud.pieeg.com | Local Python process + pieeg-server --lsl |
| Install | None (open in Chrome / Edge) | pip / one-line installer |
| Hardware sources | Web Bluetooth, Web Serial, 19 BrainFlow boards, pieeg-server WS, Simulated | Lab Streaming Layer (LSL) streams |
| Default AI | Turnkey Cloud AI (no key needed) + BYOK + Offline Built-in Analyst | BYOK (ANTHROPIC_API_KEY, OPENAI_API_KEY, Ollama, etc.) |
| Senses & tools | State, spectrum (IAF, 1/f), artifacts, webcam context, connectivity, patterns, Lab Notebook sessions, PiEEG docs RAG, PubMed/Wikipedia, .ipynb export, dashboard actuators | State, spectrum, artifacts, connectivity, patterns, sessions, .ipynb export, server actuators |
| External MCP host | Built-in browser drawer | pieeg-agent mcp serves tools to Claude Desktop, Cursor, VS Code Copilot, Codex |