···11+# BrainWaves — Claude Code Rules
22+33+## Project Overview
44+BrainWaves is an Electron + React desktop application for running EEG experiments. It uses electron-vite for bundling, Redux + redux-observable for state management, and Pyodide (WASM) for in-app Python data analysis. Its primary usecase is making EEG data collection and analysis easy for students
55+66+## Background
77+This app is fairly complex in that it involves communicating with external EEG devices over bluetooth, with high precision and speed goals, and doing scientific computing within a frontier python-in-the-browser environment.
88+Reliability and visibility of these different sources of complexity is thus most important for developers.
99+The UI of the app should have a lighthearted and fun feel, since its target audience is students.
1010+Redux Observables are hard to learn, but powerful. They help encapsulate complex temporally sensitive logic into functions. They should be maintained as an approach going forward, at least until a refactor is made.
1111+A priority for this codebase is extensibility modularity and hackability. There are many features on the horizon such as swapping out hard-coded analysis for block-based programming, or even an embedd notebook environment. As such, effort should be taken not to hard-code things or cut corners by leaking abstractions.
1212+1313+## Stack
1414+- **Runtime**: Electron (main) + React 18 (renderer)
1515+- **Bundler**: electron-vite / Vite
1616+- **State**: Redux Toolkit + redux-observable (RxJS epics)
1717+- **Language**: TypeScript (strict)
1818+- **Styling**: Semantic UI React + SCSS
1919+- **Testing**: Jest
2020+- **Linting**: ESLint + Prettier (single quotes, ES5 trailing commas)
2121+2222+## Key Directories
2323+- `src/main/` — Electron main process
2424+- `src/renderer/` — React renderer process
2525+- `src/preload/` — Electron preload scripts
2626+- `src/renderer/experiments/` — Lab.js experiment files
2727+- `src/renderer/utils/pyodide/` — Pyodide WASM Python runtime
2828+2929+## Dev Workflow
3030+```bash
3131+npm run dev # Start dev server (patches deps first)
3232+npm run build # Build all processes
3333+npm test # Run Jest tests
3434+npm run typecheck # TypeScript check (no emit)
3535+npm run lint # ESLint
3636+npm run lint-fix # ESLint + Prettier auto-fix
3737+npm run package # Build + package for current platform
3838+```
3939+4040+## Conventions
4141+- Use TypeScript; avoid `any` unless strictly necessary
4242+- Redux state changes go through RTK slices or typed actions via `typesafe-actions`
4343+- Side effects belong in RxJS epics (`redux-observable`)
4444+- Do not commit secrets or device credentials
4545+- Keep Electron main/renderer separation strict — use preload IPC bridges
4646+4747+## Out of Scope
4848+- Do not modify `src/renderer/utils/pyodide/src/` directly; it is managed by `InstallPyodide.js`
4949+- Do not alter `electron-builder` publish config without confirming release intent
5050+5151+## LLM Context
5252+Shared context for agents and developers lives in `.llms/`:
5353+- `.llms/CLAUDE.md` — this file; stable conventions and architecture
5454+- `.llms/learnings.md` — accumulated codebase insights from agents and developers
5555+5656+When you discover something non-obvious about the codebase (a gotcha, a hidden dependency, a tricky pattern), add it to `.llms/learnings.md` so future agents and developers benefit.
+10
.llms/learnings.md
···11+# BrainWaves — Codebase Learnings
22+33+Accumulated insights from agents and developers working on this codebase.
44+Add entries here when you discover something non-obvious — gotchas, hidden dependencies, tricky patterns, debugging tips.
55+66+Format: brief heading + explanation + (optional) relevant file paths.
77+88+---
99+1010+<!-- Add entries below this line -->