SKILL.md
SKILL.mdBrowse 4 files
4,395 tokens
16,401 bytes
Token encoding: o200k_base
Snapshot 24fd22b
1---2name: neuroskill-bci3description: "Use live BCI cognitive and mood state from NeuroSkill."4platforms: [linux, macos, windows]5version: 1.0.06author: Hermes Agent + Nous Research7license: MIT8metadata:9 hermes:10 tags: [BCI, neurofeedback, health, focus, EEG, cognitive-state, biometrics, neuroskill]11 category: health12 related_skills: []13---14 15# NeuroSkill BCI Integration16 17Connect Hermes to a running [NeuroSkill](https://neuroskill.com/) instance to read18real-time brain and body metrics from a BCI wearable. Use this to give19cognitively-aware responses, suggest interventions, and track mental performance20over time.21 22> **⚠️ Research Use Only** — NeuroSkill is an open-source research tool. It is23> NOT a medical device and has NOT been cleared by the FDA, CE, or any regulatory24> body. Never use these metrics for clinical diagnosis or treatment.25 26See `references/metrics.md` for the full metric reference, `references/protocols.md`27for intervention protocols, and `references/api.md` for the WebSocket/HTTP API.28 29---30 31## Prerequisites32 33- **Node.js 20+** installed (`node --version`)34- **NeuroSkill desktop app** running with a connected BCI device35- **BCI hardware**: Muse 2, Muse S, or OpenBCI (4-channel EEG + PPG + IMU via BLE)36- `npx neuroskill status` returns data without errors37 38### Verify Setup39```bash40node --version # Must be 20+41npx neuroskill status # Full system snapshot42npx neuroskill status --json # Machine-parseable JSON43```44 45If `npx neuroskill status` returns an error, tell the user:46- Make sure the NeuroSkill desktop app is open47- Ensure the BCI device is powered on and connected via Bluetooth48- Check signal quality — green indicators in NeuroSkill (≥0.7 per electrode)49- If `command not found`, install Node.js 20+50 51---52 53## CLI Reference: `npx neuroskill <command>`54 55All commands support `--json` (raw JSON, pipe-safe) and `--full` (human summary + JSON).56 57| Command | Description |58|---------|-------------|59| `status` | Full system snapshot: device, scores, bands, ratios, sleep, history |60| `session [N]` | Single session breakdown with first/second half trends (0=most recent) |61| `sessions` | List all recorded sessions across all days |62| `search` | ANN similarity search for neurally similar historical moments |63| `compare` | A/B session comparison with metric deltas and trend analysis |64| `sleep [N]` | Sleep stage classification (Wake/N1/N2/N3/REM) with analysis |65| `label "text"` | Create a timestamped annotation at the current moment |66| `search-labels "query"` | Semantic vector search over past labels |67| `interactive "query"` | Cross-modal 4-layer graph search (text → EXG → labels) |68| `listen` | Real-time event streaming (default 5s, set `--seconds N`) |69| `umap` | 3D UMAP projection of session embeddings |70| `calibrate` | Open calibration window and start a profile |71| `timer` | Launch focus timer (Pomodoro/Deep Work/Short Focus presets) |72| `notify "title" "body"` | Send an OS notification via the NeuroSkill app |73| `raw '{json}'` | Raw JSON passthrough to the server |74 75### Global Flags76| Flag | Description |77|------|-------------|78| `--json` | Raw JSON output (no ANSI, pipe-safe) |79| `--full` | Human summary + colorized JSON |80| `--port <N>` | Override server port (default: auto-discover, usually 8375) |81| `--ws` | Force WebSocket transport |82| `--http` | Force HTTP transport |83| `--k <N>` | Nearest neighbors count (search, search-labels) |84| `--seconds <N>` | Duration for listen (default: 5) |85| `--trends` | Show per-session metric trends (sessions) |86| `--dot` | Graphviz DOT output (interactive) |87 88---89 90## 1. Checking Current State91 92### Get Live Metrics93```bash94npx neuroskill status --json95```96 97**Always use `--json`** for reliable parsing. The default output is colorized98human-readable text.99 100### Key Fields in the Response101 102The `scores` object contains all live metrics (0–1 scale unless noted):103 104```jsonc105{106 "scores": {107 "focus": 0.70, // β / (α + θ) — sustained attention108 "relaxation": 0.40, // α / (β + θ) — calm wakefulness109 "engagement": 0.60, // active mental investment110 "meditation": 0.52, // alpha + stillness + HRV coherence111 "mood": 0.55, // composite from FAA, TAR, BAR112 "cognitive_load": 0.33, // frontal θ / temporal α · f(FAA, TBR)113 "drowsiness": 0.10, // TAR + TBR + falling spectral centroid114 "hr": 68.2, // heart rate in bpm (from PPG)115 "snr": 14.3, // signal-to-noise ratio in dB116 "stillness": 0.88, // 0–1; 1 = perfectly still117 "faa": 0.042, // Frontal Alpha Asymmetry (+ = approach)118 "tar": 0.56, // Theta/Alpha Ratio119 "bar": 0.53, // Beta/Alpha Ratio120 "tbr": 1.06, // Theta/Beta Ratio (ADHD proxy)121 "apf": 10.1, // Alpha Peak Frequency in Hz122 "coherence": 0.614, // inter-hemispheric coherence123 "bands": {124 "rel_delta": 0.28, "rel_theta": 0.18,125 "rel_alpha": 0.32, "rel_beta": 0.17, "rel_gamma": 0.05126 }127 }128}129```130 131Also includes: `device` (state, battery, firmware), `signal_quality` (per-electrode 0–1),132`session` (duration, epochs), `embeddings`, `labels`, `sleep` summary, and `history`.133 134### Interpreting the Output135 136Parse the JSON and translate metrics into natural language. Never report raw137numbers alone — always give them meaning:138 139**DO:**140> "Your focus is solid right now at 0.70 — that's flow state territory. Heart141> rate is steady at 68 bpm and your FAA is positive, which suggests good142> approach motivation. Great time to tackle something complex."143 144**DON'T:**145> "Focus: 0.70, Relaxation: 0.40, HR: 68"146 147Key interpretation thresholds (see `references/metrics.md` for the full guide):148- **Focus > 0.70** → flow state territory, protect it149- **Focus < 0.40** → suggest a break or protocol150- **Drowsiness > 0.60** → fatigue warning, micro-sleep risk151- **Relaxation < 0.30** → stress intervention needed152- **Cognitive Load > 0.70 sustained** → mind dump or break153- **TBR > 1.5** → theta-dominant, reduced executive control154- **FAA < 0** → withdrawal/negative affect — consider FAA rebalancing155- **SNR < 3 dB** → unreliable signal, suggest electrode repositioning156 157---158 159## 2. Session Analysis160 161### Single Session Breakdown162```bash163npx neuroskill session --json # most recent session164npx neuroskill session 1 --json # previous session165npx neuroskill session 0 --json | jq '{focus: .metrics.focus, trend: .trends.focus}'166```167 168Returns full metrics with **first-half vs second-half trends** (`"up"`, `"down"`, `"flat"`).169Use this to describe how a session evolved:170 171> "Your focus started at 0.64 and climbed to 0.76 by the end — a clear upward trend.172> Cognitive load dropped from 0.38 to 0.28, suggesting the task became more automatic173> as you settled in."174 175### List All Sessions176```bash177npx neuroskill sessions --json178npx neuroskill sessions --trends # show per-session metric trends179```180 181---182 183## 3. Historical Search184 185### Neural Similarity Search186```bash187npx neuroskill search --json # auto: last session, k=5188npx neuroskill search --k 10 --json # 10 nearest neighbors189npx neuroskill search --start <UTC> --end <UTC> --json190```191 192Finds moments in history that are neurally similar using HNSW approximate193nearest-neighbor search over 128-D ZUNA embeddings. Returns distance statistics,194temporal distribution (hour of day), and top matching days.195 196Use this when the user asks:197- "When was I last in a state like this?"198- "Find my best focus sessions"199- "When do I usually crash in the afternoon?"200 201### Semantic Label Search202```bash203npx neuroskill search-labels "deep focus" --k 10 --json204npx neuroskill search-labels "stress" --json | jq '[.results[].EXG_metrics.tbr]'205```206 207Searches label text using vector embeddings (Xenova/bge-small-en-v1.5). Returns208matching labels with their associated EXG metrics at the time of labeling.209 210### Cross-Modal Graph Search211```bash212npx neuroskill interactive "deep focus" --json213npx neuroskill interactive "deep focus" --dot | dot -Tsvg > graph.svg214```215 2164-layer graph: query → text labels → EXG points → nearby labels. Use `--k-text`,217`--k-EXG`, `--reach <minutes>` to tune.218 219---220 221## 4. Session Comparison222```bash223npx neuroskill compare --json # auto: last 2 sessions224npx neuroskill compare --a-start <UTC> --a-end <UTC> --b-start <UTC> --b-end <UTC> --json225```226 227Returns metric deltas with absolute change, percentage change, and direction for228~50 metrics. Also includes `insights.improved[]` and `insights.declined[]` arrays,229sleep staging for both sessions, and a UMAP job ID.230 231Interpret comparisons with context — mention trends, not just deltas:232> "Yesterday you had two strong focus blocks (10am and 2pm). Today you've had one233> starting around 11am that's still going. Your overall engagement is higher today234> but there have been more stress spikes — your stress index jumped 15% and235> FAA dipped negative more often."236 237```bash238# Sort metrics by improvement percentage239npx neuroskill compare --json | jq '.insights.deltas | to_entries | sort_by(.value.pct) | reverse'240```241 242---243 244## 5. Sleep Data245```bash246npx neuroskill sleep --json # last 24 hours247npx neuroskill sleep 0 --json # most recent sleep session248npx neuroskill sleep --start <UTC> --end <UTC> --json249```250 251Returns epoch-by-epoch sleep staging (5-second windows) with analysis:252- **Stage codes**: 0=Wake, 1=N1, 2=N2, 3=N3 (deep), 4=REM253- **Analysis**: efficiency_pct, onset_latency_min, rem_latency_min, bout counts254- **Healthy targets**: N3 15–25%, REM 20–25%, efficiency >85%, onset <20 min255 256```bash257npx neuroskill sleep --json | jq '.summary | {n3: .n3_epochs, rem: .rem_epochs}'258npx neuroskill sleep --json | jq '.analysis.efficiency_pct'259```260 261Use this when the user mentions sleep, tiredness, or recovery.262 263---264 265## 6. Labeling Moments266```bash267npx neuroskill label "breakthrough"268npx neuroskill label "studying algorithms"269npx neuroskill label "post-meditation"270npx neuroskill label --json "focus block start" # returns label_id271```272 273Auto-label moments when:274- User reports a breakthrough or insight275- User starts a new task type (e.g., "switching to code review")276- User completes a significant protocol277- User asks you to mark the current moment278- A notable state transition occurs (entering/leaving flow)279 280Labels are stored in a database and indexed for later retrieval via `search-labels`281and `interactive` commands.282 283---284 285## 7. Real-Time Streaming286```bash287npx neuroskill listen --seconds 30 --json288npx neuroskill listen --seconds 5 --json | jq '[.[] | select(.event == "scores")]'289```290 291Streams live WebSocket events (EXG, PPG, IMU, scores, labels) for the specified292duration. Requires WebSocket connection (not available with `--http`).293 294Use this for continuous monitoring scenarios or to observe metric changes in real-time295during a protocol.296 297---298 299## 8. UMAP Visualization300```bash301npx neuroskill umap --json # auto: last 2 sessions302npx neuroskill umap --a-start <UTC> --a-end <UTC> --b-start <UTC> --b-end <UTC> --json303```304 305GPU-accelerated 3D UMAP projection of ZUNA embeddings. The `separation_score`306indicates how neurally distinct two sessions are:307- **> 1.5** → Sessions are neurally distinct (different brain states)308- **< 0.5** → Similar brain states across both sessions309 310---311 312## 9. Proactive State Awareness313 314### Session Start Check315At the beginning of a session, optionally run a status check if the user mentions316they're wearing their device or asks about their state:317```bash318npx neuroskill status --json319```320 321Inject a brief state summary:322> "Quick check-in: focus is building at 0.62, relaxation is good at 0.55, and your323> FAA is positive — approach motivation is engaged. Looks like a solid start."324 325### When to Proactively Mention State326 327Mention cognitive state **only** when:328- User explicitly asks ("How am I doing?", "Check my focus")329- User reports difficulty concentrating, stress, or fatigue330- A critical threshold is crossed (drowsiness > 0.70, focus < 0.30 sustained)331- User is about to do something cognitively demanding and asks for readiness332 333**Do NOT** interrupt flow state to report metrics. If focus > 0.75, protect the334session — silence is the correct response.335 336---337 338## 10. Suggesting Protocols339 340When metrics indicate a need, suggest a protocol from `references/protocols.md`.341Always ask before starting — never interrupt flow state:342 343> "Your focus has been declining for the past 15 minutes and TBR is climbing past344> 1.5 — signs of theta dominance and mental fatigue. Want me to walk you through345> a Theta-Beta Neurofeedback Anchor? It's a 90-second exercise that uses rhythmic346> counting and breath to suppress theta and lift beta."347 348Key triggers:349- **Focus < 0.40, TBR > 1.5** → Theta-Beta Neurofeedback Anchor or Box Breathing350- **Relaxation < 0.30, stress_index high** → Cardiac Coherence or 4-7-8 Breathing351- **Cognitive Load > 0.70 sustained** → Cognitive Load Offload (mind dump)352- **Drowsiness > 0.60** → Ultradian Reset or Wake Reset353- **FAA < 0 (negative)** → FAA Rebalancing354- **Flow State (focus > 0.75, engagement > 0.70)** → Do NOT interrupt355- **High stillness + headache_index** → Neck Release Sequence356- **Low RMSSD (< 25ms)** → Vagal Toning357 358---359 360## 11. Additional Tools361 362### Focus Timer363```bash364npx neuroskill timer --json365```366Launches the Focus Timer window with Pomodoro (25/5), Deep Work (50/10), or367Short Focus (15/5) presets.368 369### Calibration370```bash371npx neuroskill calibrate372npx neuroskill calibrate --profile "Eyes Open"373```374Opens the calibration window. Useful when signal quality is poor or the user375wants to establish a personalized baseline.376 377### OS Notifications378```bash379npx neuroskill notify "Break Time" "Your focus has been declining for 20 minutes"380```381 382### Raw JSON Passthrough383```bash384npx neuroskill raw '{"command":"status"}' --json385```386For any server command not yet mapped to a CLI subcommand.387 388---389 390## Error Handling391 392| Error | Likely Cause | Fix |393|-------|-------------|-----|394| `npx neuroskill status` hangs | NeuroSkill app not running | Open NeuroSkill desktop app |395| `device.state: "disconnected"` | BCI device not connected | Check Bluetooth, device battery |396| All scores return 0 | Poor electrode contact | Reposition headband, moisten electrodes |397| `signal_quality` values < 0.7 | Loose electrodes | Adjust fit, clean electrode contacts |398| SNR < 3 dB | Noisy signal | Minimize head movement, check environment |399| `command not found: npx` | Node.js not installed | Install Node.js 20+ |400 401---402 403## Example Interactions404 405**"How am I doing right now?"**406```bash407npx neuroskill status --json408```409→ Interpret scores naturally, mentioning focus, relaxation, mood, and any notable410 ratios (FAA, TBR). Suggest an action only if metrics indicate a need.411 412**"I can't concentrate"**413```bash414npx neuroskill status --json415```416→ Check if metrics confirm it (high theta, low beta, rising TBR, high drowsiness).417→ If confirmed, suggest an appropriate protocol from `references/protocols.md`.418→ If metrics look fine, the issue may be motivational rather than neurological.419 420**"Compare my focus today vs yesterday"**421```bash422npx neuroskill compare --json423```424→ Interpret trends, not just numbers. Mention what improved, what declined, and425 possible causes.426 427**"When was I last in a flow state?"**428```bash429npx neuroskill search-labels "flow" --json430npx neuroskill search --json431```432→ Report timestamps, associated metrics, and what the user was doing (from labels).433 434**"How did I sleep?"**435```bash436npx neuroskill sleep --json437```438→ Report sleep architecture (N3%, REM%, efficiency), compare to healthy targets,439 and note any issues (high wake epochs, low REM).440 441**"Mark this moment — I just had a breakthrough"**442```bash443npx neuroskill label "breakthrough"444```445→ Confirm label saved. Optionally note the current metrics to remember the state.446 447---448 449## References450 451- [NeuroSkill Paper — arXiv:2603.03212](https://arxiv.org/abs/2603.03212) (Kosmyna & Hauptmann, MIT Media Lab)452- [NeuroSkill Desktop App](https://github.com/NeuroSkill-com/skill) (GPLv3)453- [NeuroLoop CLI Companion](https://github.com/NeuroSkill-com/neuroloop) (GPLv3)454- [MIT Media Lab Project](https://www.media.mit.edu/projects/neuroskill/overview/)455 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.