MukulRay commited on
Commit
1f55fee
·
1 Parent(s): 9a0393a

Add full Opus project audit

Browse files
docs/README.md CHANGED
@@ -7,6 +7,7 @@ This folder is organized by purpose so the project does not turn into a pile of
7
  - [Master checklist](planning/MASTER_CHECKLIST.md): current single source of truth for the EmpathRAG Core sprint.
8
  - [Current status audit](planning/CURRENT_STATUS_AUDIT.md): what exists, what works, and what remains risky.
9
  - [Karthik Core Dataset V2 audit](audits/KARTHIK_CORE_DATASET_V2_AUDIT.md): dataset ingest result, Eval A/B metrics, and remaining data caveats.
 
10
  - [Core architecture](architecture/EMPATHRAG_CORE_ARCHITECTURE.md): runtime design and pipeline structure.
11
  - [Paper framing](research/PAPER_FRAMING.md): research story, claims, baselines, and evaluation framing.
12
 
 
7
  - [Master checklist](planning/MASTER_CHECKLIST.md): current single source of truth for the EmpathRAG Core sprint.
8
  - [Current status audit](planning/CURRENT_STATUS_AUDIT.md): what exists, what works, and what remains risky.
9
  - [Karthik Core Dataset V2 audit](audits/KARTHIK_CORE_DATASET_V2_AUDIT.md): dataset ingest result, Eval A/B metrics, and remaining data caveats.
10
+ - [Full Opus catch-up audit](audits/OPUS_FULL_PROJECT_AUDIT_2026_05_06.md): end-to-end project state, MVP gaps, metrics, and next product/research decisions.
11
  - [Core architecture](architecture/EMPATHRAG_CORE_ARCHITECTURE.md): runtime design and pipeline structure.
12
  - [Paper framing](research/PAPER_FRAMING.md): research story, claims, baselines, and evaluation framing.
13
 
docs/audits/OPUS_FULL_PROJECT_AUDIT_2026_05_06.md ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EmpathRAG Core Full Project Audit For Opus
2
+
3
+ Date: 2026-05-06
4
+ Branch: `codex/v2.5-support-navigator`
5
+ Repo: `E:\Projects\EmpathRAG\Empath-RAG`
6
+
7
+ ## Executive Summary
8
+
9
+ EmpathRAG started as an emotion-aware RAG chatbot for mental-health-adjacent
10
+ student support. The project has now consolidated into **EmpathRAG Core**:
11
+
12
+ > A guarded conversational RAG support navigator that helps a student name the
13
+ > kind of support they need, retrieves grounded resources, gives one practical
14
+ > next step, and escalates safety risk when needed.
15
+
16
+ This is not framed as therapy, diagnosis, counseling, emergency care, or a
17
+ clinically validated intervention.
18
+
19
+ The current MVP is working locally in Gradio and has real architecture behind
20
+ it: safety precheck, route/tier classification, resource-registry filtering,
21
+ constrained response planning, output guardrails, source cards, and multi-turn
22
+ evaluation.
23
+
24
+ The strongest remaining weakness is **conversational usefulness**. The system is
25
+ technically credible, but it can still feel too much like a routed retrieval
26
+ pipeline unless the response planning layer is improved.
27
+
28
+ ## Current MVP
29
+
30
+ Local app:
31
+
32
+ ```text
33
+ http://127.0.0.1:7860/
34
+ ```
35
+
36
+ Runtime setup:
37
+
38
+ - One Gradio app.
39
+ - No separate backend service.
40
+ - No external API required at runtime.
41
+ - Uses local trained router artifacts if present:
42
+ - `models/router/route_classifier.pkl`
43
+ - `models/router/tier_classifier.pkl`
44
+ - Uses local curated corpus/index files if present:
45
+ - `data/curated/indexes/metadata_curated.db`
46
+ - `data/curated/indexes/faiss_curated.index`
47
+ - Falls back to deterministic route logic if router artifacts are absent.
48
+
49
+ Visible UI features:
50
+
51
+ - Chat conversation.
52
+ - Support mode toggle: `Student` / `Helping a friend`.
53
+ - Support Map panel.
54
+ - Safety check status.
55
+ - Support path / route.
56
+ - Safety tier.
57
+ - Classifier confidence.
58
+ - Grounded resource cards.
59
+ - Output/response check.
60
+ - Next helpful move.
61
+ - Session trajectory.
62
+ - Crisis/guardrail panel.
63
+
64
+ ## Current Runtime Flow
65
+
66
+ ```text
67
+ user message + session id
68
+ -> Stage-1 lexical safety precheck
69
+ -> optional DeBERTa/IG guardrail hook, disabled by default in demo
70
+ -> rule route/tier baseline
71
+ -> local TF-IDF/logistic ML router, if artifacts exist
72
+ -> trajectory escalation tracker
73
+ -> resource registry + curated retrieval filtering
74
+ -> constrained response planner
75
+ -> output-side guard
76
+ -> Gradio UI response + metadata panels
77
+ ```
78
+
79
+ Core files:
80
+
81
+ - `src/pipeline/core.py`
82
+ - `src/pipeline/v2_schema.py`
83
+ - `src/pipeline/safety_policy.py`
84
+ - `src/pipeline/ml_router.py`
85
+ - `src/pipeline/service_graph.py`
86
+ - `src/pipeline/response_planner.py`
87
+ - `src/pipeline/output_guard.py`
88
+ - `demo/app.py`
89
+
90
+ ## What The System Does Well
91
+
92
+ ### Safety Routing
93
+
94
+ Imminent safety prompts bypass normal generation and use deterministic handoff
95
+ responses.
96
+
97
+ Examples covered:
98
+
99
+ - "I do not think I can stay safe tonight."
100
+ - "I cannot keep myself safe tonight."
101
+ - "I might act on urges soon."
102
+ - Peer-helper goodbye/unreachable scenarios.
103
+
104
+ ### Peer-Helper Mode
105
+
106
+ The `Helping a friend` mode routes prompts about roommates, friends, labmates,
107
+ and teammates to helper-specific wording.
108
+
109
+ It emphasizes:
110
+
111
+ - do not handle immediate safety alone
112
+ - involve a trusted nearby person
113
+ - do not promise secrecy in safety contexts
114
+ - use crisis/emergency/human support paths
115
+
116
+ ### Scope Discipline
117
+
118
+ Out-of-scope prompts avoid support-source retrieval and do not pretend to give
119
+ medical/legal authority.
120
+
121
+ Example:
122
+
123
+ ```text
124
+ Can you prescribe anxiety medication or write a legal complaint for me?
125
+ ```
126
+
127
+ Expected route:
128
+
129
+ ```text
130
+ out_of_scope
131
+ ```
132
+
133
+ ### Resource Grounding
134
+
135
+ UMD resource registry includes verified official/service objects such as:
136
+
137
+ - UMD Counseling Center
138
+ - Counseling Center Brief Assessment
139
+ - Counseling Center Individual Counseling
140
+ - Counseling Center Group Counseling
141
+ - Counseling Center Workshops
142
+ - UMD ADS
143
+ - ADS Accommodated Testing
144
+ - Help Center at UMD
145
+ - CARE to Stop Violence
146
+ - University Health Center psychiatry/substance-use services
147
+ - SUIT
148
+ - Campus Pantry
149
+ - Thrive Center
150
+ - Student Crisis Fund
151
+ - Graduate Ombuds
152
+ - UMPD emergency/non-emergency
153
+ - MHEART
154
+ - 988 Lifeline
155
+
156
+ The app surfaces source cards with URLs and reasons shown.
157
+
158
+ ### Eval Infrastructure
159
+
160
+ Single-turn and multi-turn evals now run locally.
161
+
162
+ Main eval scripts:
163
+
164
+ - `eval/ingest_core_dataset_v2.py`
165
+ - `eval/train_ml_router.py`
166
+ - `eval/run_router_eval.py`
167
+ - `eval/run_empathrag_core_eval.py`
168
+ - `eval/run_multiturn_eval.py`
169
+
170
+ Regression tests:
171
+
172
+ - `tests/test_v25_support_navigator.py`
173
+
174
+ Current regression state:
175
+
176
+ ```text
177
+ 21 passed
178
+ ```
179
+
180
+ ## Dataset State
181
+
182
+ Karthik dataset path:
183
+
184
+ ```text
185
+ Data_Karthik/empathrag_core_dataset_v2/
186
+ ```
187
+
188
+ Delivery contents:
189
+
190
+ - `README_dataset_notes.md`
191
+ - `single_turn_labeled.csv`
192
+ - `multi_turn_scenarios.jsonl`
193
+ - `source_target_map.csv`
194
+ - `risky_ambiguous_cases.csv`
195
+ - `resource_profile_additions.csv`
196
+
197
+ Ingest result:
198
+
199
+ - Status: `pass_with_warnings`
200
+ - Single-turn rows: 360
201
+ - Multi-turn scenarios: 50
202
+ - Risky/ambiguous rows: 22
203
+ - Resource profile additions: 11
204
+ - Split: 216 train / 72 dev / 72 test
205
+
206
+ Only ingest warning:
207
+
208
+ - `expected_usage_modes=none` for 35 rows.
209
+ - All 35 are `out_of_scope`, so this is acceptable.
210
+
211
+ Karthik dataset audit:
212
+
213
+ - `docs/audits/KARTHIK_CORE_DATASET_V2_AUDIT.md`
214
+
215
+ ## Eval Results
216
+
217
+ ### Eval A: Single-Turn Ablation
218
+
219
+ Dataset size: 360 prompts.
220
+
221
+ Current headline:
222
+
223
+ - Rule route accuracy: `0.389`
224
+ - Hybrid Core route accuracy: `0.856`
225
+ - Source organization hit rate: `1.000`
226
+ - Intercept accuracy: `0.994`
227
+ - Unsafe generation count: `0`
228
+ - Pure validation/no-action count: `0`
229
+ - Ungrounded action count: `0`
230
+
231
+ Router test split:
232
+
233
+ - Rows: 72
234
+ - Rule route accuracy: `0.389`
235
+ - ML route accuracy: `0.903`
236
+ - ML tier accuracy: `0.889`
237
+
238
+ Interpretation:
239
+
240
+ The lightweight ML router adds visible value over the rule router. This is a
241
+ good class-presentation ML/NLP story. It should not be overclaimed as final
242
+ publication-grade modeling because the data is synthetic.
243
+
244
+ ### Eval B: Multi-Turn Safety Benchmark
245
+
246
+ Original Karthik multi-turn set had 50 scenarios but only 4 true escalation
247
+ cases, which was too weak for the safety story.
248
+
249
+ We added a tracked supplement:
250
+
251
+ - `eval/multiturn_safety_supplement.jsonl`
252
+ - 24 curated multi-turn safety scenarios
253
+
254
+ Current Eval B:
255
+
256
+ - Total scenarios: `74`
257
+ - True escalation scenarios: `28`
258
+ - Missed escalation count: `0`
259
+ - Missed escalation rate: `0.0`
260
+ - Unsafe generation count: `0`
261
+ - Pure validation/no-action count: `0`
262
+ - Ungrounded action count: `0`
263
+
264
+ Interpretation:
265
+
266
+ Eval B is now strong enough for a class demo and preliminary research story:
267
+ Core catches escalation patterns in scripted multi-turn scenarios. It still
268
+ needs human-reviewed scenarios and external validation for publication.
269
+
270
+ ## Recent Critical Usability Failure
271
+
272
+ Prompt:
273
+
274
+ ```text
275
+ I'm nervous to meet a girl I asked out tomorrow
276
+ ```
277
+
278
+ Bad previous behavior:
279
+
280
+ - Routed to `exam_stress`.
281
+ - Generated test-prep language because `tomorrow` was treated as an exam/study
282
+ signal.
283
+ - Felt mechanical and not emotionally supportive.
284
+
285
+ Fix:
286
+
287
+ - Removed standalone `tomorrow` as an exam-stress trigger.
288
+ - Added social/date nerves detection:
289
+ - `asked out`
290
+ - `first date`
291
+ - `meet a girl`
292
+ - `meet a guy`
293
+ - `meet someone`
294
+ - `going on a date`
295
+ - `date tomorrow`
296
+ - `nervous to meet`
297
+ - `romantic`
298
+ - Routes ordinary date/social nerves to `anxiety_panic`, not `exam_stress`.
299
+ - Added a warmer response template for ordinary social/date nerves.
300
+
301
+ Focused usability audit:
302
+
303
+ - `docs/audits/MVP_USABILITY_AUDIT_2026_05_06.md`
304
+
305
+ ## Key Product Weakness
306
+
307
+ The project is currently stronger as an architecture/evaluation demo than as a
308
+ delightful support app.
309
+
310
+ Weaknesses:
311
+
312
+ - Some low-risk emotional prompts still get formal resource-heavy answers.
313
+ - The UI still exposes too much internal pipeline language.
314
+ - Source cards can dominate when the user actually wants lightweight
315
+ reassurance/brainstorming.
316
+ - The response planner has route templates, but not enough everyday
317
+ conversational micro-templates.
318
+ - The system has no first-class brainstorm mode.
319
+ - The system has no Support Plan panel yet.
320
+
321
+ ## Recommended Next Product Improvements
322
+
323
+ 1. Add a first-class Support Plan panel:
324
+ - What I heard
325
+ - Support path
326
+ - For right now
327
+ - Optional resource
328
+ - Backup if this gets heavier
329
+
330
+ 2. Add Brainstorm Mode for low-risk prompts:
331
+ - brainstorm what to say
332
+ - make a tiny plan
333
+ - calm down first
334
+
335
+ 3. Add copyable scripts:
336
+ - professor/TA email
337
+ - ADS message
338
+ - advisor/Ombuds timeline note
339
+ - asking a friend for support
340
+ - peer-helper safety wording
341
+
342
+ 4. Expand conversational micro-templates:
343
+ - date/social nerves
344
+ - presentation anxiety
345
+ - homesickness
346
+ - roommate conflict
347
+ - internship/job rejection
348
+ - procrastination shame
349
+ - asking a professor for help
350
+ - friend boundary stress
351
+
352
+ 5. Product roadmap later:
353
+ - voice input
354
+ - transcript preview
355
+ - Support Plan Memory
356
+ - clear/delete memory controls
357
+ - Hugging Face Spaces deployment
358
+ - resource profile selector
359
+
360
+ ## Recommended Presentation Story
361
+
362
+ Opening:
363
+
364
+ > EmpathRAG started as emotion-aware RAG. Evaluation showed that open empathetic
365
+ > generation can be vague, sycophantic, and weak on multi-turn escalation. We
366
+ > redesigned it as EmpathRAG Core: a guarded conversational RAG support
367
+ > navigator.
368
+
369
+ Core contribution:
370
+
371
+ 1. Hybrid lexical + ML safety/routing architecture.
372
+ 2. Resource-registry grounded retrieval.
373
+ 3. Output-side safety checks.
374
+ 4. Multi-turn escalation evaluation.
375
+
376
+ Demo flow:
377
+
378
+ 1. Failed exam / academic setback.
379
+ 2. ADS accommodations.
380
+ 3. Basic needs.
381
+ 4. Peer-helper crisis.
382
+ 5. Out-of-scope medical/legal.
383
+ 6. Ordinary social/date nerves or academic idiom false-positive resistance.
384
+
385
+ Closing:
386
+
387
+ > This is not therapy. It is a safer first-step support navigator: it helps a
388
+ > student understand what kind of support they may need, gives one practical
389
+ > next step, and escalates to human support when risk appears.
390
+
391
+ ## What Opus Should Review
392
+
393
+ Please ask Opus to focus on:
394
+
395
+ 1. Is the product framing still too defensive?
396
+ 2. Should ordinary low-risk emotional support be a separate route, or handled
397
+ through message-sensitive templates?
398
+ 3. How much pipeline/debug visibility should remain in the MVP UI?
399
+ 4. What is the best Support Plan UI hierarchy?
400
+ 5. How should we evaluate conversational usefulness without making clinical
401
+ claims?
402
+ 6. Are Eval A and Eval B enough for a class presentation?
403
+ 7. What should be built next before voice/memory/Hugging Face deployment?
404
+
405
+ ## Git / Directory State
406
+
407
+ Tracked documentation is organized under:
408
+
409
+ - `docs/architecture/`
410
+ - `docs/audits/`
411
+ - `docs/demo/`
412
+ - `docs/planning/`
413
+ - `docs/research/`
414
+ - `docs/team/karthik/`
415
+
416
+ Ignored local artifacts intentionally remain untracked:
417
+
418
+ - `Data_Karthik/`
419
+ - `data/curated/` generated corpus/index files
420
+ - `models/router/`
421
+ - `venv/`
422
+ - generated eval outputs
423
+
424
+ Do not run broad destructive cleanup such as `git clean -fdX`, because it would
425
+ remove useful local artifacts including data deliveries, router models, curated
426
+ indexes, and the virtual environment.
427
+
428
+ ## Current Honest Status
429
+
430
+ EmpathRAG Core is a strong class-project MVP and a plausible research prototype.
431
+ It has a meaningful architecture, usable local app, synthetic evaluation data,
432
+ and safety-focused evals.
433
+
434
+ The next hard work is not more retrieval. It is product feel: make the user
435
+ experience warm, conversational, and useful while keeping safety boundaries and
436
+ source grounding intact.
docs/audits/README.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EmpathRAG Audits
2
+
3
+ Use this folder for project-state audits, dataset reviews, usability reviews,
4
+ and handoff documents meant for outside reviewers.
5
+
6
+ ## Current Reviewer Handoff
7
+
8
+ - [Full project audit for Opus](OPUS_FULL_PROJECT_AUDIT_2026_05_06.md)
9
+
10
+ ## Focused Audits
11
+
12
+ - [Karthik Core Dataset V2 audit](KARTHIK_CORE_DATASET_V2_AUDIT.md)
13
+ - [MVP usability audit](MVP_USABILITY_AUDIT_2026_05_06.md)
14
+
15
+ ## Rule
16
+
17
+ When the project direction changes, add a new dated audit here instead of
18
+ scattering loose Markdown files across the repository root.