MukulRay commited on
Commit
c5c9d5b
·
1 Parent(s): 3b6fcce

Docs: README routing/feature note, ERROR_ANALYSIS Category 7 (session-state + intent + new routes)

Browse files

- README: 14 -> 16 routes in architecture diagram; planner box now
also names substance-use and privacy-confidentiality. Added a
second-hardening-pass paragraph documenting session isolation,
natural-language intent detection, and the two new routes.

- ERROR_ANALYSIS: new Category 7 (six entries) for the gaps caught
during the pre-recording audit (stale session_id, multi-word
affirm bypass, greeting-consumed slot, turn_index saturation,
substance-use unsurfaced, confidentiality deflection). Renumbered
the previous "what we cannot do" section to Category 8.

Files changed (2) hide show
  1. README.md +4 -2
  2. docs/research/ERROR_ANALYSIS.md +45 -5
README.md CHANGED
@@ -87,10 +87,10 @@ flowchart TB
87
  CAP -->|under cap| S1{Stage-1 lexical<br/>safety check<br/>~5ms, no network}
88
 
89
  S1 -->|crisis detected| CR[Crisis intercept<br/>988 plus UMD Counseling<br/>or 911 plus UMD CARE for DV<br/>LLM never invoked]
90
- S1 -->|pass| ROUTE[Hybrid route and tier classifier<br/>14 routes, 4 safety tiers]
91
 
92
  ROUTE --> REG[Resource registry filter<br/>34 verified UMD and national entries]
93
- REG --> PLAN[Stage-aware planner<br/>LISTEN, PERMISSION, OFFER, CLARIFY<br/>F-1 awareness, authority-misconduct route]
94
 
95
  PLAN -.->|template plus context| LLM[LLM rephraser<br/>Groq Llama 3.3 70B primary<br/>Anthropic Claude Haiku 4.5 fallback]
96
  LLM -.->|paraphrased candidate| VFY{Post-rephrase trust boundary<br/>scope drift, fabrication,<br/>sycophancy, minimization}
@@ -176,6 +176,8 @@ The planner sends a template, the user message, and recent history to the langua
176
 
177
  Subsequent polish added: response streaming, support-plan export (Markdown and PDF), voice input via Whisper, ISSS document side-panel, an authority-misconduct route, a sycophancy guard, F-1 session decay, prompt-injection auditing, per-layer ablation evaluation, the same-model unguarded baseline, in-UI safety pipeline visualization, mobile CSS, and HIPAA / privacy gap documentation.
178
 
 
 
179
  <br>
180
 
181
  ---
 
87
  CAP -->|under cap| S1{Stage-1 lexical<br/>safety check<br/>~5ms, no network}
88
 
89
  S1 -->|crisis detected| CR[Crisis intercept<br/>988 plus UMD Counseling<br/>or 911 plus UMD CARE for DV<br/>LLM never invoked]
90
+ S1 -->|pass| ROUTE[Hybrid route and tier classifier<br/>16 routes, 4 safety tiers]
91
 
92
  ROUTE --> REG[Resource registry filter<br/>34 verified UMD and national entries]
93
+ REG --> PLAN[Stage-aware planner<br/>LISTEN, PERMISSION, OFFER, CLARIFY<br/>F-1 awareness, authority-misconduct,<br/>substance-use, privacy-confidentiality]
94
 
95
  PLAN -.->|template plus context| LLM[LLM rephraser<br/>Groq Llama 3.3 70B primary<br/>Anthropic Claude Haiku 4.5 fallback]
96
  LLM -.->|paraphrased candidate| VFY{Post-rephrase trust boundary<br/>scope drift, fabrication,<br/>sycophancy, minimization}
 
176
 
177
  Subsequent polish added: response streaming, support-plan export (Markdown and PDF), voice input via Whisper, ISSS document side-panel, an authority-misconduct route, a sycophancy guard, F-1 session decay, prompt-injection auditing, per-layer ablation evaluation, the same-model unguarded baseline, in-UI safety pipeline visualization, mobile CSS, and HIPAA / privacy gap documentation.
178
 
179
+ A second hardening pass added a session-isolated state machine for the consent loop (a "yes" after an offer advances instead of re-rendering), natural-language intent detection for affirmations (`yeah that would help` / `sure, sounds good` / `yes please` all recognized, with pivots like `yeah but i'm an F-1 student` correctly deferred to the planner), and two new routes — `substance_use_concern` (UHC Psychiatry and SUIT, non-punitive framing) and `privacy_confidentiality` (factual orientation on FERPA and Counseling Center confidentiality, with mandatory-disclosure caveat). End-to-end session state now flows from the UI through the pipeline to the core; the "↺ New conversation" button actually resets every state dict.
180
+
181
  <br>
182
 
183
  ---
docs/research/ERROR_ANALYSIS.md CHANGED
@@ -130,18 +130,58 @@ LLM names ISSS / ADS / Counseling Center when the planner template did not. **Ca
130
  ### 6.5 AI-tells
131
  Em-dashes, "I understand", "let me reframe", "as your therapist" — patterns that read as chatbot-y or clinical positioning. **Caught at:** `verify_rephrased_safety.scope_drift` + AI-tell patterns in system prompt.
132
 
133
- ## Category 7: What we explicitly cannot do
134
 
135
- ### 7.1 Real clinical assessment
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  We are not a therapist. We do not assess symptoms, risk, suicidality severity, or treatment fit. We intercept crisis language and redirect; we do not assess.
137
 
138
- ### 7.2 Multilingual conversation
139
  Voice input handles 90+ languages via Whisper. Text input through the planner is English-only. F-1 students whose first language isn't English get planner-mediated responses in English; their input passes through but doesn't get an L1 reflection. Multilingual openers are on the next-iteration backlog.
140
 
141
- ### 7.3 Persistent memory across sessions
142
  Browser refresh = lose conversation. Server-side persistence requires auth + encryption + retention policy; deferred until the CC pilot conversation.
143
 
144
- ### 7.4 Cultural cross-cutting beyond F-1
145
  Queer, undocumented, parenting, Black, first-gen students aren't layered the way F-1 is. They route generically.
146
 
147
  ## How this connects to the architecture
 
130
  ### 6.5 AI-tells
131
  Em-dashes, "I understand", "let me reframe", "as your therapist" — patterns that read as chatbot-y or clinical positioning. **Caught at:** `verify_rephrased_safety.scope_drift` + AI-tell patterns in system prompt.
132
 
133
+ ## Category 7: Session-state and intent-detection gaps (fixed during pre-recording audit)
134
 
135
+ ### 7.1 Stale session state shared across users
136
+
137
+ **Observed:** Pre-recording dry runs showed the rephraser referring to prior-conversation context ("You're still feeling...") on what should have been Turn 1 of a fresh session.
138
+
139
+ **Why:** `FastDemoPipeline.run()` hardcoded `session_id="demo"` regardless of the UI's per-session uuid. Every conversation across browsers, refreshes, and reset clicks shared one state entry in `EmpathRAGCore`.
140
+
141
+ **Architectural fix:** Threaded session_id end-to-end from the UI through `FastDemoPipeline` to `EmpathRAGCore`. The reset handler now calls `pipeline.reset_session(prev_sid)` so it actually clears every state dict for the old key.
142
+
143
+ ### 7.2 Multi-word affirmation bypassed the consent flow
144
+
145
+ **Observed:** `yeah that would help` after an OFFER fell through to substantive content and re-rendered the OFFER instead of advancing to consent_acknowledged.
146
+
147
+ **Architectural fix:** Replaced exact-string membership in `_MINIMAL_AFFIRM` with a leading-token regex plus pivot-rejection. Natural variants (`sure, sounds good`, `yes please`, `that works`, `let's start`) match; pivots (`yeah but i'm an F-1 student`) and wh-questions (`ok so what do i do?`) correctly defer to the planner.
148
+
149
+ ### 7.3 Greeting consumed the listening-layer turn slot
150
+
151
+ **Observed:** A student who opened with `Hi` then said something substantive landed at PERMISSION, not LISTEN — invisible to anyone trying to demo the listening layer.
152
+
153
+ **Architectural fix:** Added `session_substantive_count` that increments only on LISTEN / PERMISSION / OFFER stages. CLARIFY turns no longer consume the slot.
154
+
155
+ ### 7.4 Consent flow saturated past turn 4
156
+
157
+ **Observed:** The consent flow recency check (`current_turn - offer_turn in 1..2`) silently failed past the fourth turn because `tier_history` is a rolling deque of size 3 and `turn_index` saturated at 4.
158
+
159
+ **Architectural fix:** Added monotonic `session_seq` counter for diff-based recency comparisons; `turn_index` keeps its original semantics for the safety tracker.
160
+
161
+ ### 7.5 Substance-use signals not surfaced
162
+
163
+ **Observed:** `i was high and hungover` routed to `academic_setback`. UMD UHC Psychiatry and Substance Use Services exists in the registry but never surfaced because no route bound to it.
164
+
165
+ **Architectural fix:** New `substance_use_concern` route fires on strong substance signals (drunk / wasted / hungover / blackout / stoned / got high). `high` alone stays ambiguous so `high anxiety` / `high stress` do not false-positive. Template names UHC Psychiatry and SUIT, non-punitive framing.
166
+
167
+ ### 7.6 Confidentiality questions deflected
168
+
169
+ **Observed:** `Is it safe? Will they report to my parents?` got the standard counseling-navigation template, never answered the actual question.
170
+
171
+ **Architectural fix:** New ALWAYS_DIRECT `privacy_confidentiality` route. Template answers factually (UMD CC sessions generally confidential, FERPA basics, mandatory-disclosure caveat, redirect to Dean of Students for records-level concerns) with explicit non-legal-advice disclaimer.
172
+
173
+ ## Category 8: What we explicitly cannot do
174
+
175
+ ### 8.1 Real clinical assessment
176
  We are not a therapist. We do not assess symptoms, risk, suicidality severity, or treatment fit. We intercept crisis language and redirect; we do not assess.
177
 
178
+ ### 8.2 Multilingual conversation
179
  Voice input handles 90+ languages via Whisper. Text input through the planner is English-only. F-1 students whose first language isn't English get planner-mediated responses in English; their input passes through but doesn't get an L1 reflection. Multilingual openers are on the next-iteration backlog.
180
 
181
+ ### 8.3 Persistent memory across sessions
182
  Browser refresh = lose conversation. Server-side persistence requires auth + encryption + retention policy; deferred until the CC pilot conversation.
183
 
184
+ ### 8.4 Cultural cross-cutting beyond F-1
185
  Queer, undocumented, parenting, Black, first-gen students aren't layered the way F-1 is. They route generically.
186
 
187
  ## How this connects to the architecture