UC-7 Student consults the wellness guide
Ships flag-disabled for the pilot (WP_GUIDE_ENABLED off). The crisis-resources card is reachable regardless.
| Primary actor | Student |
| Priority | Must (the guardrails); the chat itself is off for the pilot |
| Satisfies | FR-E2, FR-E3, FR-E6, NFR-8 |
| Precondition | The student is signed in; the guide flag is on. |
| Trigger | The student opens the themed guide chat and sends a message. |
Main success scenario
- The message passes three deterministic guards in a fixed order: crisis detection, medical-request detection, and grounding against the cleared corpus.
- The guide replies by quoting a clinician-cleared excerpt for the matched topic, in the theme's persona, and nudges the next task.
- The reply passes a backstop check for medical advice before it is returned.
Extensions
- 1a. Crisis signal. A hard-coded crisis card is returned immediately: 988 first, then campus resources and SHS contact. No further processing happens.
- 1b. Medical request. A hard-coded refusal that points to SHS or a clinician.
- 1c. Off-topic. A grounding deflection; the guide only speaks from cleared topics.
- 3a. The reply reads as medical advice. It is discarded, not edited, and the refusal is returned instead.
- Flag off (pilot default). The chat route is not mounted (404);
GET /api/guide/crisis-resourcesand the crisis affordance in the app still work. - Rate limit. Guide messages are throttled per student; the crisis-resources route is never throttled.
Acceptance criteria (Gherkin)
| Feature file | Test module |
|---|---|
guide_guardrails.feature |
test_guide_guardrails_bdd.py |
guide_conversation.feature |
test_guide_conversation_bdd.py |
guide_dormant_for_pilot.feature and frontend/guide_dormant_for_pilot.feature |
test_guide_dormant_for_pilot_bdd.py |
Plain pytest: test_guide_safety.py, test_guide_guardrails.py, test_guide_conversation.py. Frontend: Guide.test.tsx, CrisisResources.test.tsx.
Views
- Process: UC-7 Guide guardrails and crisis routing
- Logical:
guide_safetyahead of theWellnessGuideseam in system components
Code: backend/app/services/guide_safety.py, backend/app/services/guide.py, backend/app/services/guide_corpus.py, backend/app/routers/guide.py, frontend/src/components/Guide/, frontend/src/components/CrisisResources/.