hermes-agent/optional-skills/health/neuroskill-bci/references/protocols.md
teknium1 8a3e7e15c6 feat(skills): add NeuroSkill BCI integration as optional built-in skill
Complete rewrite of the neuroskill-bci skill based on actual source material
from the NeuroSkill desktop app and NeuroLoop CLI repos. Supersedes PR #708.

Key improvements over #708:
- All CLI commands verified against actual NeuroSkill/NeuroLoop source
- Added --json flag usage throughout (critical for reliable parsing)
- Fixed metric formulas: Focus = σ(β/(α+θ)), Relaxation = σ(α/(β+θ))
- Scores are 0-1 scale (not 0-100 as in #708)
- Added all 40+ metrics: FAA, TAR, BAR, TBR, APF, SNR, coherence,
  consciousness (LZC, wakefulness, integration), complexity (PE, HFD, DFA),
  cardiac (RMSSD, SDNN, pNN50, LF/HF, stress index, SpO2),
  motion (stillness, blinks, jaw clenches, nods, shakes)
- Added all missing CLI subcommands: session, search-labels, interactive,
  listen, umap, calibrate, timer, notify, raw
- Protocols sourced from actual NeuroLoop protocol repertoire (70+)
  organized by category (attention, stress, emotional, sleep, somatic,
  digital, dietary, motivation)
- Added full WebSocket/HTTP API reference with all endpoints and
  JSON response formats
- Fixed gamma range: 30-50 Hz (not 30-100)
- Added signal quality per electrode with thresholds
- Added composite state patterns (flow, fatigue, anxiety, creative, etc.)
- Added ZUNA embedding documentation
- Placed as optional built-in skill (not bundled by default)

Files:
- optional-skills/health/DESCRIPTION.md (new category)
- optional-skills/health/neuroskill-bci/SKILL.md (main skill)
- optional-skills/health/neuroskill-bci/references/metrics.md
- optional-skills/health/neuroskill-bci/references/protocols.md
- optional-skills/health/neuroskill-bci/references/api.md

Refs: #694, #708
2026-03-12 21:56:07 -07:00

452 lines
16 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# NeuroSkill Guided Protocols
Over 70 mind-body practices triggered by specific biometric (EXG) signals. These
are sourced from NeuroLoop's protocol repertoire and are designed to be suggested
when the system detects specific cognitive or physiological states.
> **⚠️ Contraindication**: Wim Hof and hyperventilation-style breathwork are
> unsuitable for epilepsy_risk > 30, known cardiac conditions, or pregnancy.
---
## When to Suggest Protocols
**Always ask before starting.** Match ONE protocol to the single most salient
metric signal. Explain the metric connection to the user.
| User State | Recommended Protocol |
|------------|---------------------|
| Focus < 0.40, TBR > 1.5 | Theta-Beta Neurofeedback Anchor or Box Breathing |
| Low engagement, session start | WOOP or Pre-Task Priming |
| Relaxation < 0.30, stress_index high | Cardiac Coherence or 4-7-8 Breathing |
| Cognitive Load > 0.70 sustained | Cognitive Load Offload (Mind Dump) |
| Engagement < 0.30 for > 20 min | Novel Stimulation Burst or Environment Change |
| Flow State (focus > 0.75, engagement > 0.70) | **Do NOT interrupt — protect the session** |
| Drowsiness > 0.60, post-lunch | Ultradian Reset or Power Nap |
| FAA < 0, depression_index elevated | FAA Rebalancing |
| Low RMSSD (< 25ms) | Vagal Toning |
| High stillness + headache signals | Neck Release Sequence |
| Pre-sleep, HRV low | Sleep Wind-Down |
| Post-social-media, low mood | Envy & Comparison Alchemy |
---
## Attention & Focus Protocols
### Theta-Beta Neurofeedback Anchor
**Duration**: ~90 seconds
**Trigger**: High TBR (> 1.5) and low focus
**Instructions**:
1. Close your eyes
2. Breathe slowly — 4s inhale, 6s exhale
3. Count rhythmically from 1 to 10, matching your breath
4. Focus on the counting — if you lose count, restart from 1
5. Open your eyes after 45 full cycles
**Effect**: Suppresses theta dominance and lifts beta activity
### Focus Reset
**Duration**: 90 seconds
**Trigger**: Scattered engagement, difficulty settling into task
**Instructions**:
1. Close your eyes completely
2. Take 5 slow, deep breaths
3. Mentally state your intention for the next work block
4. Open your eyes and begin immediately
**Effect**: Resets attentional baseline
### Working Memory Primer
**Duration**: 3 minutes
**Trigger**: Low PAC θ-γ (theta-gamma coupling), low sample entropy
**Instructions**:
1. Breathe at theta pace: 4s inhale, 6s exhale, 2s hold
2. While breathing, do a verbal 3-back task: listen to or read a sequence
of numbers, say which number appeared 3 positions back
3. Continue for 3 minutes
**Effect**: Lifts theta-gamma coupling and working memory engagement
### Creativity Unlock
**Duration**: 5 minutes
**Trigger**: High beta, low rel_alpha — system is too analytically locked
**Instructions**:
1. Stop all structured work
2. Let your mind wander without a goal
3. Doodle, look out the window, or listen to ambient sound
4. Don't force any outcome — just observe what arises
5. After 5 minutes, jot down any ideas that surfaced
**Effect**: Promotes alpha and theta activity for creative ideation
### Dual-N-Back Warm-Up
**Duration**: 3 minutes
**Trigger**: Low PAC θ-γ, low sample entropy
**Instructions**:
1. Read or listen to a sequence of spoken numbers
2. Track which number appeared 2 positions back (2-back)
3. If comfortable, increase to 3-back
**Effect**: Activates prefrontal cortex, lifts executive function
### Novel Stimulation Burst
**Duration**: 23 minutes
**Trigger**: Low APF (< 9 Hz), dementia_index > 30
**Instructions**:
1. Pick up an unusual object nearby and describe it in detail
2. Name 5 things you can see, 4 you can touch, 3 you can hear
3. Try a quick riddle or lateral thinking puzzle
**Effect**: Counters cortical slowing, raises alpha peak frequency
---
## Autonomic & Stress Regulation Protocols
### Box Breathing (4-4-4-4)
**Duration**: 24 minutes
**Trigger**: High BAR, high anxiety_index, acute stress
**Instructions**:
1. Inhale for 4 counts
2. Hold for 4 counts
3. Exhale for 4 counts
4. Hold for 4 counts
5. Repeat 48 cycles
**Effect**: Engages parasympathetic nervous system, reduces beta activity
### Extended Exhale (4-7-8)
**Duration**: 35 minutes
**Trigger**: Acute stress spikes, racing thoughts, high sympathetic activation
**Instructions**:
1. Exhale completely through mouth
2. Inhale through nose for 4 counts
3. Hold for 7 counts
4. Exhale through mouth for 8 counts
5. Repeat 4 cycles
**Effect**: Fastest parasympathetic trigger for acute stress
### Cardiac Coherence
**Duration**: 5 minutes
**Trigger**: Low RMSSD (< 30 ms), high stress_index
**Instructions**:
1. Breathe evenly: 5-second inhale, 5-second exhale
2. Focus on the area around your heart
3. Recall a positive memory or feeling of appreciation
4. Maintain for 5 minutes
**Effect**: Maximizes HRV, creates coherent heart rhythm pattern
### Physiological Sigh
**Duration**: 30 seconds (13 cycles)
**Trigger**: Rapid overwhelm, acute panic
**Instructions**:
1. Take a quick double inhale through the nose (sniff-sniff)
2. Follow with a long, slow exhale through the mouth
3. Repeat 13 times
**Effect**: Rapid parasympathetic activation, immediate calming
### Alpha Induction (Open Focus)
**Duration**: 5 minutes
**Trigger**: High beta, low relaxation cannot relax
**Instructions**:
1. Soften your gaze don't focus on any single object
2. Notice the space between and around objects
3. Expand your awareness to peripheral vision
4. Maintain this "open focus" for 5 minutes
**Effect**: Promotes alpha wave production, reduces beta dominance
### Open Monitoring
**Duration**: 510 minutes
**Trigger**: Low LZC (< 40 on 0-100 scale) neural complexity too low
**Instructions**:
1. Sit comfortably with eyes closed or softly focused
2. Don't direct attention to anything specific
3. Simply notice whatever arises thoughts, sounds, sensations
4. Let each observation pass without engagement
**Effect**: Raises neural complexity and consciousness metrics
### Vagal Toning
**Duration**: 3 minutes
**Trigger**: Low RMSSD (< 25 ms) weak vagal tone
**Instructions**:
1. Hum a long, steady note on each exhale for 30 seconds
2. Alternatively: gargle cold water for 30 seconds
3. Repeat 35 times
**Effect**: Directly stimulates the vagus nerve, increases parasympathetic tone
---
## Emotional Regulation Protocols
### FAA Rebalancing
**Duration**: 5 minutes
**Trigger**: Negative FAA (right-hemisphere dominant), high depression_index
**Instructions**:
1. Think of something you're genuinely looking forward to (approach motivation)
2. Visualize yourself successfully completing a meaningful goal
3. Squeeze your left hand into a fist for 10 seconds, release
4. Repeat the visualization + left-hand squeeze 34 times
**Effect**: Activates left prefrontal cortex, shifts FAA positive
### Loving-Kindness (Metta)
**Duration**: 510 minutes
**Trigger**: Loneliness signals, shame, low mood
**Instructions**:
1. Close your eyes and think of someone you care about
2. Silently repeat: "May you be happy. May you be healthy. May you be safe."
3. Extend the same wishes to yourself
4. Extend to a neutral person, then gradually to someone difficult
**Effect**: Reduces withdrawal motivation, increases positive affect
### Emotional Discharge
**Duration**: 2 minutes
**Trigger**: High bipolar_index or extreme FAA swings
**Instructions**:
1. Take 30 seconds of vigorous, fast breathing (safely)
2. Stop and take 3 slow, deep breaths
3. Do a 60-second body scan notice where tension is held
4. Shake out your hands and arms for 15 seconds
**Effect**: Releases trapped sympathetic energy, recalibrates
### Havening Touch
**Duration**: 35 minutes
**Trigger**: Acute distress, trauma activation, overwhelming anxiety
**Instructions**:
1. Gently stroke your arms from shoulder to elbow, palms down
2. Rub your palms together slowly
3. Gently touch your forehead, temples
4. Continue for 35 minutes while breathing slowly
**Effect**: Disrupts amygdala-cortex encoding loop, reduces distress
### Anxiety Surfing
**Duration**: ~8 minutes
**Trigger**: Rising anxiety without clear cause
**Instructions**:
1. Notice where anxiety lives in your body chest? stomach? throat?
2. Describe the sensation without judging it (tight? hot? buzzing?)
3. Breathe into that area for 3 breaths
4. Notice: is it getting bigger, smaller, or changing shape?
5. Continue observing for 58 minutes anxiety typically peaks then subsides
### Anger: Palm-Press Discharge
**Duration**: 2 minutes
**Trigger**: Anger signals, high BAR + elevated HR
**Instructions**:
1. Press your palms together firmly for 10 seconds
2. Release and take 3 extended exhales (4s in, 8s out)
3. Repeat 34 times
### Envy & Comparison Alchemy
**Duration**: 3 minutes
**Trigger**: Post-social-media, envy signals
**Instructions**:
1. Name the envy: "I feel envious of ___"
2. Ask: "What does this envy tell me I actually want?"
3. Convert: "My next step toward that is ___"
**Effect**: Converts envy into a desire-signal that identifies personal values
### Awe Induction
**Duration**: 35 minutes
**Trigger**: Existential flatness, low engagement, loss of meaning
**Instructions**:
1. Imagine standing at the edge of the Grand Canyon, or beneath a starry sky
2. Let yourself feel the scale you are small, and that's beautiful
3. Recall a moment of genuine wonder from your past
4. Notice what changes in your body
**Effect**: Counters hedonic adaptation, restores sense of meaning
---
## Sleep & Recovery Protocols
### Ultradian Reset
**Duration**: 20 minutes
**Trigger**: End of a 90-minute focus block, drowsiness rising
**Instructions**:
1. Set a timer for 20 minutes
2. No agenda just rest (don't force sleep)
3. Dim lights if possible, close eyes
4. Let mind wander without structure
**Effect**: Aligns with 90-minute ultradian rhythm, restores cognitive resources
### Wake Reset
**Duration**: 5 minutes
**Trigger**: narcolepsy_index > 40, severe drowsiness
**Instructions**:
1. Splash cold water on your face and wrists
2. Do 20 seconds of Kapalabhati breath (sharp nasal exhales)
3. Expose yourself to bright light for 23 minutes
**Effect**: Acute arousal response, suppresses drowsiness
### NSDR (Non-Sleep Deep Rest / Yoga Nidra)
**Duration**: 2030 minutes
**Trigger**: Accumulated fatigue, need deep recovery without sleeping
**Instructions**:
1. Lie on your back, palms up
2. Close your eyes and do a slow body scan from toes to crown
3. At each body part, notice sensation without changing anything
4. If you fall asleep, that's fine — set an alarm
**Effect**: Restores dopamine and cognitive resources without sleep inertia
### Power Nap
**Duration**: 1020 minutes (set alarm!)
**Trigger**: Drowsiness > 0.70, post-lunch slump, Theta dominant
**Instructions**:
1. Set alarm for 20 minutes maximum (avoids N3 sleep inertia)
2. Lie down or recline
3. Even if you don't fully sleep, rest with eyes closed
4. On waking: 30 seconds of stretching before resuming work
**Effect**: Restores focus and alertness for 23 hours
### Sleep Wind-Down
**Duration**: 60 minutes before bed
**Trigger**: Evening session, rising drowsiness, pre-sleep
**Instructions**:
1. Dim all screens to night mode
2. Stop new learning or complex tasks
3. Do a mind dump of tomorrow's tasks
4. 10 minutes of progressive relaxation or 4-7-8 breathing
5. Keep room cool (6568°F / 1820°C)
---
## Somatic & Physical Protocols
### Progressive Muscle Relaxation (PMR)
**Duration**: 10 minutes
**Trigger**: Relaxation < 0.25, HRV declining over session
**Instructions**:
1. Start with feet tense for 5 seconds, release for 810 seconds
2. Move upward: calves thighs abdomen hands arms shoulders face
3. Hold each tension 5 seconds, release 810 seconds
4. End with 3 deep breaths
### Grounding (5-4-3-2-1)
**Duration**: 3 minutes
**Trigger**: Panic, dissociation, acute anxiety spike
**Instructions**:
1. Name 5 things you can see
2. Name 4 things you can touch
3. Name 3 things you can hear
4. Name 2 things you can smell
5. Name 1 thing you can taste
### 20-20-20 Vision Reset
**Duration**: 20 seconds
**Trigger**: Extended screen time, eye strain
**Instructions**:
1. Every 20 minutes of screen time
2. Look at something 20 feet away
3. For 20 seconds
### Neck Release Sequence
**Duration**: 3 minutes
**Trigger**: High stillness (> 0.85) + headache_index elevated
**Instructions**:
1. Ear-to-shoulder tilt — hold 15 seconds each side
2. Chin tucks — 10 reps (pull chin straight back)
3. Gentle neck circles — 5 each direction
4. Shoulder shrugs — 10 reps (squeeze up, release)
### Motor Cortex Activation
**Duration**: 2 minutes
**Trigger**: Very high stillness, prolonged static sitting
**Instructions**:
1. Cross-body movements: touch right hand to left knee, alternate 10 times
2. Shake out hands and feet for 15 seconds
3. Roll ankles and wrists 5 times each direction
**Effect**: Resets proprioception, activates motor cortex
### Cognitive Load Offload (Mind Dump)
**Duration**: 5 minutes
**Trigger**: Cognitive load > 0.70 sustained, racing thoughts, high beta
**Instructions**:
1. Open a blank document or grab paper
2. Write everything on your mind without filtering or organizing
3. Brain-dump worries, tasks, ideas — anything occupying working memory
4. Close the document (review later if needed)
**Effect**: Externalizing working memory can reduce cognitive load by 2040%
---
## Digital & Lifestyle Protocols
### Craving Surf
**Duration**: 90 seconds
**Trigger**: Phone addiction signals, urge to check social media
**Instructions**:
1. Notice the urge to check your phone
2. Don't act on it — just observe for 90 seconds
3. Notice: does the urge peak and then fade?
4. Resume what you were doing
**Effect**: Breaks automatic dopamine-seeking loop
### Dopamine Palette Reset
**Duration**: Ongoing
**Trigger**: Flatness from short-form content spikes
**Instructions**:
1. Identify activities that provide sustained reward (reading, cooking, walking)
2. Replace 15 minutes of scrolling with one sustained-reward activity
3. Track mood before/after for 3 days
### Digital Sunset
**Duration**: 6090 minutes before bed
**Trigger**: Evening, pre-sleep routine
**Instructions**:
1. Hard stop on all screens 6090 minutes before bed
2. Switch to non-screen activities: reading, conversation, stretching
3. If screens are necessary, use night mode at minimum brightness
---
## Dietary Protocols
### Caffeine Timing
**Trigger**: Morning routine, anxiety_index
**Guidelines**:
- Consume caffeine 90120 minutes after waking (cortisol has already peaked)
- None after 2 PM (half-life ~6 hours)
- If anxiety_index > 50, stack with L-theanine (200mg) to smooth the curve
### Post-Meal Energy Crash
**Trigger**: Post-lunch drowsiness spike
**Instructions**:
1. 5-minute brisk walk immediately after eating
2. 10 minutes of sunlight exposure
**Effect**: Counters post-prandial drowsiness
---
## Motivation & Planning Protocols
### WOOP (Wish, Outcome, Obstacle, Plan)
**Duration**: 5 minutes
**Trigger**: Low engagement before a task
**Instructions**:
1. **Wish**: What do you want to accomplish in this session?
2. **Outcome**: What's the best possible result? Visualize it.
3. **Obstacle**: What internal obstacle might get in the way?
4. **Plan**: "If [obstacle], then I will [action]."
**Effect**: Mental contrasting improves follow-through by 23x
### Pre-Task Priming
**Duration**: 3 minutes
**Trigger**: Low engagement at session start, drowsiness < 0.50
**Instructions**:
1. Set a clear intention for the next work block
2. Write down the single most important task
3. Do 10 jumping jacks or 20 deep breaths
4. Start with the easiest sub-task to build momentum
---
## Protocol Execution Guidelines
When guiding the user through a protocol:
1. **Match one protocol** to the single most salient metric signal
2. **Explain the metric connection** why this protocol for this state
3. **Ask permission** never start without the user's consent
4. **Announce each step** clearly with timing
5. **Check in after** run `npx neuroskill status --json` to see if metrics improved
6. **Label the moment** `npx neuroskill label "post-protocol: [name]"` for tracking
### Timing Guidelines for Step-by-Step Guidance
- Breath inhale: 35 seconds
- Breath hold: 24 seconds
- Breath exhale: 48 seconds
- Muscle tense: 5 seconds
- Muscle release: 810 seconds
- Body-scan region: 1015 seconds