Show HN: Breathe CLI – Paced resonance breathing in the macOS terminal

A terminal app that paces resonance breathing for vagal tone training. macOS only, single file, no dependencies.
A terminal app that paces resonance breathing for vagal tone training. macOS only, single file, no dependencies.
$ breathe
calm · 4-6 · 14:32 [●]
INHALE
██████████████░░░░░░░░░░░░░░░░
space pause · s mute · q quit
Resonance breathing — slow, paced breathing at around 6 breaths per minute — is one of the few non-pharmacological interventions shown to improve cardiac vagal tone. The mechanism is straightforward: slow breathing amplifies respiratory sinus arrhythmia (RSA), the natural heart-rate variation linked to the breath cycle. Stronger RSA means stronger vagal outflow, which in turn improves baroreceptor sensitivity and shifts autonomic balance away from sympathetic dominance.
This matters most for people with heart failure with reduced ejection fraction (HFrEF), where sympathetic overdrive is both a symptom and an accelerant of disease progression. Bernardi et al. (1998) demonstrated that slow breathing at 6 bpm improves oxygen saturation and exercise tolerance in CHF patients, with effects visible after a single session. A follow-up study (Bernardi et al. 2002) showed that slow breathing also increases arterial baroreflex sensitivity in CHF — a marker strongly associated with prognosis.
This app is a habit tool that makes daily practice frictionless: open terminal, run breathe, follow the bar. It is not a medical device.
Why 6 breaths per minute? The cardiovascular system has a resonance frequency — typically between 4.5 and 6.5 bpm in adults — at which heart rate oscillations are maximally amplified (Vaschillo et al. 2006). Breathing at or near this frequency produces the largest RSA swings, which drive the strongest vagal training stimulus. Individual resonance frequency varies and can only be identified precisely with HRV biofeedback hardware. Without it, 6 bpm is the best population-level default: it sits at the centre of the typical range and matches the rate used in the CHF clinical trials (Bernardi et al. 1998, 2002).
Why a longer exhale in the calm and extended presets? Cardiac vagal efferent activity is gated to the respiratory cycle — vagal outflow is stronger during expiration than inspiration. A longer exhale (4s in, 6s out) extends the phase of peak vagal drive within each breath, biasing the autonomic balance further toward parasympathetic tone (Russo et al. 2017, Lehrer & Gevirtz 2014). The total cycle is still 10 seconds (6 bpm). The balanced preset uses equal timing (5-5) as a neutral baseline; the calm and extended presets use the exhale-weighted ratio for parasympathetic emphasis.
Why these safety constraints? See the Design choices section below. Each constraint maps to a specific physiological risk that is elevated in cardiac patients.
The presets use 6 bpm because it works well for most people and matches the clinical trial protocols. But individual resonance frequency varies — typically between 4.5 and 6.5 bpm — and breathing at your resonance frequency produces a stronger vagal training stimulus than breathing at the population average (Vaschillo et al. 2006).
If you have HRV biofeedback hardware, you can find your personal optimum. If you don't, the 6 bpm default is a good choice — consistent daily practice matters more than nailing the exact frequency.
- A chest-strap heart rate monitor (e.g. Polar H10, Garmin HRM-Pro). Wrist-based optical sensors are not accurate enough for beat-to-beat HRV.
- Software that displays real-time R-R intervals or HRV metrics: Kubios, Elite HRV, HRV4Training, or a dedicated biofeedback system.
Run this test sitting upright in a quiet room, at the same time of day you normally practice. The whole procedure takes about 30 minutes.
Baseline (2 min). Breathe normally. Let your heart rate settle. Start your HRV recording.
Test rate 1: 6.0 bpm (3 min). Run breathe --ratio 5-5 -d 3 --no-log. Follow the pacer. At the end, note the average RMSSD (or, if your software shows a live heart rate trace, note how wide the oscillations are — peak-to-trough in bpm).
Rest (1–2 min). Breathe normally.
Test rate 2: 5.5 bpm (3 min). Run breathe --ratio 5-6 -d 3 --no-log. Note the same metric.
Rest (1–2 min).
Test rate 3: 5.0 bpm (3 min). Run breathe --ratio 6-6 -d 3 --no-log. Note the same metric.
Rest (1–2 min).
Test rate 4: 4.6 bpm (3 min). Run breathe --ratio 6-7 -d 3 --no-log. Note the same metric.
Interpreting results: The rate that produces the highest RMSSD, the highest LF power in the HRV spectrum, or the visibly widest heart rate oscillations is your resonance frequency. If two adjacent rates are close, pick the slower one — it's more comfortable for long sessions.
Limitations: Phase durations are whole seconds, so only certain BPMs are representable: 4.6, 5.0, 5.5, 6.0, 6.7, 7.5 bpm. Your true resonance might fall between two testable rates. Pick the closest one. The difference in training effect between 5.0 and 5.5 bpm is small.
Once you know your frequency, use --ratio to match it:
breathe --ratio 6-7 # 13s cycle = 4.6 bpm
breathe --ratio 6-6 # 12s cycle = 5.0 bpm
breathe --ratio 5-6 # 11s cycle = 5.5 bpm
breathe --ratio 5-5 # 10s cycle = 6.0 bpm (default)
You can also add exhale emphasis at your resonance frequency:
breathe --ratio 5-7 # 12s cycle = 5.0 bpm, exhale-weighted
breathe --ratio 4-7 # 11s cycle = 5.5 bpm, exhale-weighted
breathe --ratio 4-8 # 12s cycle = 5.0 bpm, strong exhale emphasis
- Bernardi L, Spadacini G, Bellwon J, et al. "Effect of breathing rate on oxygen saturation and exercise performance in chronic heart failure." Lancet. 1998;351(9112):1308-1311.
- Bernardi L, Porta C, Spicuzza L, et al. "Slow breathing increases arterial baroreflex sensitivity in patients with chronic heart failure." Circulation. 2002;105(2):143-145.
- Bernardi L, Sleight P, Bandinelli G, et al. "Effect of rosary prayer and yoga mantras on autonomic cardiovascular rhythms." BMJ. 2001;323:1446.
- Vaschillo EG, Vaschillo B, Lehrer PM. "Characteristics of resonance in heart rate variability stimulated by biofeedback." Appl Psychophysiol Biofeedback. 2006;31(2):129-142.
- Lehrer PM, Gevirtz R. "Heart rate variability biofeedback: how and why does it work?" Front Psychol. 2014;5:756.
- Russo MA, Santarelli DM, O'Rourke D. "The physiological effects of slow breathing in the healthy human." Breathe. 2017;13(4):298-309.
This app is deliberately constrained. Several common breathing-app features are excluded for safety and focus:
No breath retention. Breath holds (kumbhaka) raise intrathoracic pressure via a Valsalva-like mechanism and can trigger vasovagal syncope or arrhythmia in cardiac patients. The Bernardi protocols use continuous breathing with no hold phases. The app rejects three-number ratios like 4-7-8 with an explicit safety error.
No rapid breathing. Patterns faster than 7.5 bpm (cycles shorter than 8 seconds) move toward hyperventilation territory, reducing arterial CO2 and mobilising catecholamines — the opposite of the vagal intent (Russo et al. 2017). The app enforces a minimum cycle length of 8 seconds.
No breath holds between phases. There is no pause between inhale and exhale. The breath is continuous, matching the protocol in Bernardi et al. (1998, 2002).
Immediate exit, always. Pressing q or Ctrl+C ends the session within one frame. The terminal is always restored — cursor, colours, input mode — even if the app crashes. The finally block that does this is the most important code in the file.
No dependencies. Single Python file, stdlib only. Nothing to install, nothing to break. Runs on the Python that ships with macOS.
No curses. Direct ANSI escape codes only. The curses library has edge cases with non-default terminals on macOS Mojave.
- macOS (uses
/usr/bin/afplayfor audio cues) - Python 3.7+
# Clone or download breathe.py, then:
chmod +x breathe.py
# Option A: run directly
./breathe.py
Source: Hacker News


















