Catcher Navigator Algorithm v7.0
Boston Neuromind LLC Β· 2026
CNA v7 is a clinical decision support system for 5 beta clients (part-time therapy clients).
v7 Core Additions (Round 7-10): - Differential Diagnosis Engine (DDE): Client data β Bayesian differential diagnosis (ADHD/GAD/MDD) - Comorbidity Decomposition: Decompose clinical scores by diagnostic source - Cognitive Simulator: Counterfactual simulation of clinical outcomes when cognitive axes change - Adaptive Re-routing: Auto-reconstruct diagnosis from 4-week outcome
Core Functions:
| Mapping / Algorithm | Clinical Evidence |
|---|---|
| Working Memory β Learning (r=0.43) | Meta-analysis, n=7947 |
| Emotional Intelligence β Academic (r=0.39) | EI-AP meta-analysis 2023 |
| Emotion Regulation training (d=0.605) | Aldao et al. 2010 |
| Rumination β Depression (bidirectional) | Nolen-Hoeksema response styles |
| Active Inference clinical application | Friston 2010-2025 |
| Adult ADHD comorbidity 50-80% | Frontiers 2025 |
| ADHD-anxiety 25-50%, ADHD-depression ~50% | Postgraduate Med 2014 |
| Differential key = temporal pattern | ADHD chronic/pervasive vs anxiety/depression episodic |
| Unrecognized ADHD + SSRI alone = fails | McIntosh et al. 2009 |
Measurable cognitive abilities:
| Axis | Measurement Tool | Normal Range |
|---|---|---|
| Sustained Attention | CPT (Continuous Performance Test) | Omissions Z = -0.5 to +0.5 |
| Working Memory | N-back (2-back, 3-back) | Accuracy 70-85% |
| Emotional Regulation | HRV RMSSD + VSR | RMSSD 25-50ms |
| Time Awareness | Time estimation task | Error 5-15% |
| Self-Awareness | OMR (Observable Model Refinement) | Response depth |
Fischer Level: L7.0 ~ L13.0 (adult typical range)
Client-selectable treatment areas:
| Area | Primary Measurements |
|---|---|
| Attention | CPT, ASRS |
| Learning | N-back, learning retention |
| Peak Performance | Time estimation, HRV |
| Anxiety | HRV, GAD-7 |
| Depression | PHQ-9, BA count |
Each card scored on 6 components:
Weights auto-adjust based on client phase: - New client: epistemic priority (data gathering) - Stable client: pragmatic priority (efficacy) - Emergency client (priority tier): emergency phase auto-activates, pragmatic highest priority
# 1. Unzip
unzip cna_v7_final.zip
cd cna_v7
# 2. Create virtual environment (one-time)
python -m venv venv
# 3. Activate
source venv/bin/activate # Mac/Linux
# or
venv\Scripts\activate # Windows
# 4. Install packages
pip install pydantic numpy pyyaml fastapi uvicorn
# 5. Run integration test
python tests/test_integration.py
Tests pass: "β Integration tests passed" message appears.
cna_v7/
βββ config/ # User-editable
β βββ cognitive_clinical_mapping.yaml
β βββ free_energy_weights.yaml
β βββ diagnostic_patterns.yaml # v7 NEW
βββ cna_core/ # Core logic
β βββ types.py
β βββ cognitive_clinical_mapper.py
β βββ free_energy_scorer.py
β βββ biomarker_normalization.py
β βββ clinical_report.py
β βββ card_deck.py
β βββ crisis_detection.py
β βββ protocol_generator.py
β βββ variational_update.py
β βββ differential_diagnosis.py # v7 NEW
β βββ comorbidity_decomposition.py # v7 NEW
β βββ cognitive_simulator.py # v7 NEW
β βββ adaptive_rerouting.py # v7 NEW
β βββ orchestrator.py
βββ tests/test_integration.py
βββ cli/run_assessment.py
βββ api/main.py # FastAPI server
βββ supabase/schema.sql
βββ README.md
Use paper measurement sheets. Five measurements:
DDE accuracy's foundation. Detailed guide in Section 6. Core 8 questions:
onset_ageonset_categorycourseduration_monthspervasivenessstress_triggeredfamily_historyprior_treatment_responsecd cna_v7
source venv/bin/activate
python cli/run_assessment.py
Answer interactive prompts. Or use JSON file:
python cli/run_assessment.py --json client_001.json
client_001.json example:
{
"client_id": "AK001",
"cognitive_levels": {
"sustained_attention": 8.5,
"working_memory": 9.0,
"emotional_regulation": 8.5,
"time_awareness": 9.0,
"self_awareness": 9.5
},
"biomarkers": {
"cpt_omissions_zscore": -0.5,
"hrv_rmssd": 30.0,
"nback_accuracy": 0.75,
"time_estimation_error_pct": 15.0
},
"symptoms": {
"inattention": 0.4,
"distractibility": 0.35,
"executive_dysfunction": 0.3,
"anxiety_somatic": 0.3,
"anxiety_cognitive": 0.3,
"low_mood": 0.2,
"low_motivation": 0.2
},
"temporal_history": {
"onset_age": 8,
"onset_category": "childhood",
"course": "chronic",
"duration_months": 240,
"pervasiveness": "cross_setting",
"stress_triggered": false,
"family_history": ["father_ADHD"],
"prior_treatment_response": {}
},
"primary_axis": "learning",
"motivation": 0.7,
"n_sessions": 0
}
temporal_history field (v7 NEW) β Critical for DDE accuracy. See Section 6.
System outputs: 1. Clinical 5-Axis Prediction Table β review with client 2. 5-Axis Relationship Table β collateral effects 3. Differential Diagnosis (v7 NEW) β Primary/Secondary + Comorbidity pattern 4. Comorbidity Decomposition Table (v7 NEW) β Per-axis source contributions 5. Intervention Priority Table (v7 NEW) β Which cognitive axis is most effective? 6. Target Level Recommendations (v7 NEW) β Required levels to reach clinical target 7. Top 3 System Recommendations β clinician review 8. 8-Week Protocol Preview β client consent + effect simulation (v7 NEW)
Results auto-save to outputs/{client_id}_{timestamp}.json.
Procedure: - Instruct: "Raise hand when you think 30 seconds have passed" - Repeat 5 times - Calculate error % per trial - Average error % β time_awareness Level
Interpretation: | Avg Error | Fischer Level | Clinical Note | |-----------|---------------|---------------| | 0-5% | L11+ | Highly accurate | | 5-12% | L9-10 | Normal | | 12-25% | L8 | Weak | | 25%+ | L7 or below | Clinical attention |
Procedure: - Use Polar H10 or Apple Watch - 5-min resting breathing (seated) - Auto-calculate RMSSD - Record LF/HF ratio also
Interpretation: | RMSSD (ms) | Status | |------------|--------| | 50+ | Very good | | 35-50 | Good | | 25-35 | Average | | 15-25 | Weak | | < 15 | Clinical attention |
Procedure: - Use Conners CPT, IVA-2, or custom tool - 15-min standard protocol - Results: omissions, commissions, RT variability
Z-score Conversion: - Norm mean = 0, SD = 1 - Client score β Z-score (positive = better) - Omissions Z < -1.5 = clinical concern
Procedure: - 2-back 5 min, 3-back 5 min - Record accuracy % - Calculate d-prime
Interpretation: | 2-back Accuracy | Fischer Level | |-----------------|---------------| | 90%+ | L11+ | | 75-90% | L9-10 | | 60-75% | L8 | | < 60% | L7 |
DDE's 4-source likelihood weights temporal at 30%. Missing temporal info drops differential accuracy significantly.
Clinical basis: Differentiating ADHD vs GAD vs MDD hinges on temporal patterns. - ADHD: Childhood onset (< 12 yo), chronic, consistent across settings - GAD: Adult onset possible, 6+ months, stress-triggered - MDD: 2+ week episodes, pervasive environmental impact
"childhood" | "adolescence" | "adult" | "any_age""chronic" | "episodic" | "fluctuating""cross_setting" β all environments (ADHD signal)"context_dependent" β specific situations only (anxiety signal)"all_setting" β depression presentationtrue | false["father_ADHD", "mother_GAD"]){"SSRI": "no_response", "stimulant": "good_response"})from cna_core import TemporalHistory
temporal = TemporalHistory(
onset_age=8,
onset_category="childhood",
course="chronic",
duration_months=240,
pervasiveness="cross_setting",
stress_triggered=False,
family_history=["father_ADHD"],
prior_treatment_response={"SSRI": "no_response"},
)
γ Clinical 5-Axis Predictions γ
Area Score Tier Priority Top Contributing
Attention 0.39 Caution β #1 Sustained Attn (+0.05)
Anxiety 0.14 Priority β β #2 Emotional Reg (-0.27)
...
Score Interpretation: - 0.75+ : Excellent (no intervention needed) - 0.60-0.75: Good (maintenance) - 0.45-0.60: Average (observation) - 0.30-0.45: Caution (consider intervention) - < 0.30: Priority (immediate intervention)
Priority: - #1: Client-selected area (autonomy priority) - #2: Priority tier (< 0.30) - #3: High-leverage areas - #4: Weak areas - #5: Stable areas
γ 5-Axis Relationships (by Leverage) γ
Axis A Relation Axis B Strength Leverage
Anxiety ββ Co-vary Mood Stability 0.65 0.62
...
Relationship Types: - Co-vary (ββ): One improves, other improves - Inverse (ββ): One improves, other worsens (rare)
Leverage Score: - 0.5+: Very large collateral effect - 0.3-0.5: Medium collateral - < 0.3: Weak collateral
Clinical Application: - Intervention on leverage 0.5+ areas = efficient - When client selects, show leverage data for informed choice
γ Differential Diagnosis γ
Primary: adhd_inattentive
Secondary: ['mdd', 'gad']
Comorbidity pattern: adhd_plus_gad
Confidence: 0.64
Treatment: ADHD + GAD standard. 30% coverage rate clinical pattern.
Diagnostic Hypothesis Ranking:
β
Primary: ADHD Inattentive Type (P=57%)
Symptom match: 0.99, Cognitive: 0.99, Biomarker: 0.98, Temporal: 0.95
β Met: Cross-setting consistency, Onset before age 12
β’ Secondary: MDD (P=21%)
β’ Secondary: GAD (P=21%)
Primary Thresholds: - Posterior > 40%: strong signal, primary confirmed - Posterior 30-40%: primary but review recommended - Posterior < 30%: primary uncertain (review required)
Secondary: Posterior > 20%
Confidence: - 0.7+: very reliable - 0.5-0.7: moderately reliable - < 0.5: additional evaluation needed
| Source | Weight | Description |
|---|---|---|
| Symptom match | 40% | Client complaint vs diagnosis pattern |
| Cognitive match | 20% | Cognitive 5-axis weakness pattern |
| Biomarker match | 10% | CPT/HRV/N-back etc. objective measures |
| Temporal match | 30% | Temporal info (differential's key) |
Key insight: Symptom + Temporal = 70%. These two are most decisive.
DSM-5-TR criteria auto-checked per diagnosis:
ADHD Inattentive: - β Cross-setting consistency (pervasiveness == "cross_setting") - β Onset before age 12 (onset_age < 12) - β Not better explained by mood/anxiety (symptom pattern analysis)
GAD: - β Excessive worry 6+ months (duration >= 6) - β Worry > attention deficit (anxiety > inattention) - β HRV RMSSD < 25ms
MDD: - β Anhedonia or low mood 2+ weeks - β Rumination (vs ADHD distractibility) - β Cognitive slowing (vs ADHD inconsistency)
γ Comorbidity Decomposition γ
βΆ Attention
Original score: 0.38 (impairment 0.62)
Explanatory power: 83%
β
ADHD Inattentive Contribution 0.234 (posterior 57%)
β’ MDD Contribution 0.087 (posterior 21%)
β’ GAD Contribution 0.087 (posterior 21%)
Residual (unexplained): 0.105
Treatment target: primary_first
Contribution Interpretation: - ADHD 0.234 β 23.4% of attention impairment from ADHD source - MDD 0.087 β 8.7% from depression-induced secondary - Residual 0.105 β unexplained (individual variance, other factors)
Treatment Target:
- primary_first: Primary diagnosis treatment first
- concurrent: Concurrent treatment (Comorbidity pattern)
- monitor: Observe
System auto-recommends review when: - Low diagnostic certainty (top posterior < 40%) - Insufficient temporal info (onset/course unknown) - Difficult differential (1st vs 2nd gap < 10%) - ADHD suspicion but onset age unconfirmed
When flagged, clinician makes final decision (not system auto-decide).
γ Intervention Priority γ
#1 working_memory L8.2βL9.2 | Total +0.085 | Main effect: learning
#2 sustained_attention L7.8βL8.8 | Total +0.062 | Main effect: attention
...
Compares effect of +1.0 Level boost per cognitive axis. #1 = most efficient.
| Area | Duration | Sessions/Week | Progression |
|---|---|---|---|
| Attention | 4 weeks | 3 | Complexity ramp |
| Learning | 4 weeks | 4 | Consolidation |
| Peak Performance | 4 weeks | 3 | Skill stacking |
| Anxiety | 4 weeks | 5 | Exposure gradient |
| Depression | 8 weeks | 4 | Behavioral activation |
When system recommendation is clinically inappropriate: - Clinician can select different card - Override rationale must be recorded (learning signal) - System weighs this Γ2 in learning
System auto-catches 10 crisis types:
| Type | Severity | Immediate Action |
|---|---|---|
| Passive suicidal ideation | moderate | Continue + safety check |
| Active suicidal ideation | high | Stop + Columbia SSRS |
| Suicide plan/means | imminent | 911 + don't leave alone |
| Recent self-harm | high | Stop + safety plan |
| Homicidal ideation | imminent | Tarasoff duty + law enforcement |
| Active psychosis | high | Psychiatric referral |
| Acute intoxication | high | Reschedule + safe transport |
| Active DV | imminent | DV Hotline + DCF (if children) |
| Child abuse disclosure | imminent | MA DCF 800-792-5200 immediately |
| Severe dissociation | moderate | Grounding + PTSD/DID eval |
Important: BCN + PhD clinicians = MA M.G.L. c. 119 Β§51A "allied mental health professional" category.
Obligations: 1. Immediate verbal report: MA DCF Emergency Line 1-800-792-5200 2. Written report within 48 hours: 51A form (online portal) 3. Penalties: $1,000 first violation, $5,000 thereafter
PHQ-9 Item 9 auto-detected: - β₯1: passive ideation activated - β₯2: active ideation activated - β₯3: plan/means possibility
4-8 weeks after session end:
python cli/run_assessment.py --outcome
Enter: - Episode ID (from previous session) - Outcome score (-1.0 to +1.0, 0 = no change) - Cognitive 5-axis after (cognitive_after) - Clinical 5-axis after (clinical_after) - Measurement variance (data reliability) - Primary intervention axis - Intervention card IDs
When outcome recorded:
Base Learning (v6): 1. Weights auto-adjust (variational update) 2. Mapping matrix calibration 3. Prediction error accumulation 4. Crisis FN/FP tracking
Adaptive Re-routing (v7 NEW): 5. Expected vs actual response comparison 6. Mismatch β auto DDE re-run (weakened prior) 7. Diagnosis change detection (no_change | secondary_added | primary_swap | diagnosis_dropped)
γ Diagnostic Re-routing Decision γ
Primary: adhd_inattentive β gad
Secondary: [] β [adhd_inattentive]
Changed: yes
Change type: primary_swap
Response pattern: primary_no_response_secondary_improved_anxiety
Posterior change: 0.35
β Clinician review needed
Change Types:
- no_change: Diagnosis maintained (response fit 0.60+)
- secondary_added: New comorbid diagnosis
- primary_swap: Primary diagnosis changed (e.g., ADHD β GAD)
- diagnosis_dropped: Previous diagnosis excluded
Response Patterns:
- expected_response_strong: Primary target responds well (>+0.15)
- partial_response: Partial response
- primary_no_response_secondary_improved_*: Primary unresponsive + only other axis improved β diagnosis doubt
- treatment_no_response: No response at all
- diagnosis_revision_from_response: Response matches different diagnosis pattern
Scenario A: ADHD primary β stimulant card β no effect, anxiety worsens - System catches: "Expected ADHD primary but stimulant non-response + anxiety increase" - Re-routing: Change primary to GAD, ADHD secondary - Clinical meaning: GAD caused ADHD-like symptoms (Eysenck ACT)
Scenario B: MDD primary β BA card β no mood change, only HRV improves - System catches: "MDD treatment with no depression response" - Re-routing: GAD secondary likelihood β - Clinical meaning: Chronic anxiety more primary than depression
Scenario C: ADHD primary β stimulant card β attention β, learning β - System catches: "Response as expected (response fit 0.85+)" - Re-routing: No change, diagnosis confidence β
File: config/cognitive_clinical_mapping.yaml
positive_loading:
sustained_attention:
attention: 0.45 # β modify this
learning: 0.20
peak_performance: 0.20
anxiety: 0.05
depression: 0.10
Rules:
1. Keep row sum = 1.0
2. Don't modify row/column structure
3. YAML-only edit, no code changes
4. After modification, run test:
bash
python tests/test_integration.py
Immune to learning updates:
imperturbable:
protected_cells:
- [emotional_regulation, anxiety]
- [working_memory, learning]
- [sustained_attention, attention]
- [emotional_regulation, depression]
Strong clinical evidence cells. Modify with caution.
cd cna_v7
source venv/bin/activate
uvicorn api.main:app --reload --port 8000
Browse: http://localhost:8000/docs
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | System status |
/cards |
GET | Card data |
/full-cycle |
POST | Full cycle in one call |
/assess |
POST | Loop 1-2 assessment |
/protocol/generate |
POST | Protocol generation |
/safety/check |
POST | Crisis check |
/system/state |
GET | Learning state |
curl -X POST "http://localhost:8000/full-cycle" \
-H "Content-Type: application/json" \
-d '{
"client_id": "AK001",
"cognitive_levels": {
"sustained_attention": 8.5,
"working_memory": 9.0,
"emotional_regulation": 8.5,
"time_awareness": 9.0,
"self_awareness": 9.5
},
"symptom_vector": {"inattention": 0.4},
"biomarkers": {"hrv_rmssd": 30.0},
"primary_clinical_axis": "learning",
"motivation": 0.7,
"n_sessions": 0
}'
CORS auto-enabled for:
- https://learning.neurocatchers.com
- https://neurocatchers.com
- https://bostonneuromind.com
JavaScript example:
const response = await fetch('https://cna-api.example.com/full-cycle', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(clientData)
});
const result = await response.json();
Symptom: ModuleNotFoundError: No module named 'pydantic'
pip install --upgrade pydantic numpy pyyaml fastapi uvicorn --break-system-packages
# 1. Verify venv active
source venv/bin/activate
# 2. Reinstall packages
pip install -r requirements.txt
# 3. Check config files
python -c "import yaml; yaml.safe_load(open('config/cognitive_clinical_mapping.yaml'))"
python -c "
import yaml
cfg = yaml.safe_load(open('config/cognitive_clinical_mapping.yaml'))
for axis, row in cfg['positive_loading'].items():
total = sum(row.values())
print(f'{axis}: {total:.4f}')
"
Each row = 1.0 Β± 0.001.
Add new Card object to cna_core/card_deck.py:
Card(
id="att-007",
target_symptoms={"inattention": 0.6},
target_fischer_levels={"sustained_attention": 9.0},
target_clinical_axes=["attention"],
evidence_d=0.5,
text_ko="New card description",
text_en="New card description",
cost_minutes=15,
expected_outcome=0.55,
),
Before beta start:
1. Create Supabase Project (Pro $25/month)
2. Execute supabase/schema.sql
3. Verify RLS policies
4. Apply for HIPAA BAA
| Item | Effect Size | Source |
|---|---|---|
| Working Memory β Learning | r=0.43 | Meta-analysis, n=7947 |
| Emotional Intelligence β Academic | r=0.39 | EI-AP meta-analysis 2023 |
| Emotion Regulation training | d=0.605 | Aldao et al. 2010 |
| Rumination β Depression | r=0.42 | Nolen-Hoeksema response styles |
| HRV biofeedback (anxiety) | d=0.70 | Lehrer et al. meta-analysis |
| Behavioral Activation (depression) | d=0.74 | Dimidjian et al. 2006 |
| Adult ADHD comorbidity 50-80% | Frontiers 2025 | |
| ADHD-anxiety 25-50% / ADHD-depression ~50% | Postgraduate Med 2014 | |
| Differential key = temporal pattern | Multiple | |
| Unrecognized ADHD + SSRI fails | McIntosh et al. 2009 |
Version: CNA v7.0.0
Last Updated: 2026-05-21
License: Proprietary, Boston Neuromind LLC