-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathproject-intent-and-objectives.txt
More file actions
112 lines (88 loc) · 5.67 KB
/
project-intent-and-objectives.txt
File metadata and controls
112 lines (88 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Solace-AI System Architecture
Project Overview
Solace-AI is an advanced AI-powered mental health companion backend platform that provides:
- Evidence-based therapeutic interventions (CBT, DBT, ACT, Mindfulness, MI)
- Dynamic mental health diagnosis using multi-agent systems inspired by Google DeepMind's AMIE
- Personality-aware communication using Big Five (OCEAN) traits
- Persistent therapeutic context across sessions via sophisticated memory management
---
Core Architecture Components (5 Modules)
| Module | Purpose | Key Features |
|------------------------|-------------------------------|-------------------------------------------------------------------------------------|
| 00-System Integration | Platform orchestration | Multi-agent LangGraph, Safety-first, HIPAA/SOC2 compliance, Event-driven + Sync API |
| 01-Diagnosis & Insight | Mental health assessment | AMIE-inspired 4-agent system, Chain-of-Reasoning, Anti-sycophancy, DSM-5-TR + HiTOP |
| 02-Therapy | Evidence-based interventions | Hybrid Rules+LLM, 5-component framework, Stepped Care (4 levels), CBT/DBT/ACT/MI |
| 03-Personality | Communication personalization | Big Five OCEAN detection, MoEL empathy, Style adaptation (r>0.85) |
| 04-Memory & Context | Persistent context | 5-tier cognitive hierarchy, Agentic RAG, Ebbinghaus decay with safety override |
---
Key Architectural Decisions
1. Multi-Agent Orchestration (LangGraph)
Priority 0: Safety Agent (Always monitors, can override any agent)
Priority 1: Supervisor Agent (Routes, coordinates, quality control)
Priority 2: Clinical Agents (Diagnosis, Therapy, Assessment)
Priority 3: Support Agents (Personality, Emotion, Chat)
2. Diagnosis Module - 4-Step Chain-of-Reasoning
1. ANALYZE - Extract symptoms, timeline, context
2. HYPOTHESIZE - Generate differential diagnosis (DSM-5-TR + HiTOP)
3. CHALLENGE - Devil's Advocate agent prevents confirmation bias
4. SYNTHESIZE - Calibrate confidence, generate response
3. Therapy Module - Hybrid Architecture
- Rules-based: Treatment protocols, session structure, safety guardrails
- LLM-generated: Empathic responses, personalized examples, Socratic questions
- Stepped Care: PHQ-9 severity determines intensity (0-4 levels)
- Techniques: CBT, DBT (4 modules), ACT (6 processes), MI (OARS), Mindfulness
4. Personality Module - Big Five Detection
- OCEAN: Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism
- Detection: Ensemble (Fine-tuned RoBERTa + LLM zero-shot + LIWC)
- Multimodal: Text + Voice + Behavioral signals (Late Fusion)
- Empathy: MoEL (Mixture of Empathetic Listeners) with 32 emotion classes
5. Memory Module - 5-Tier Cognitive Hierarchy
| Tier | Name | Storage | Access Time |
|------|-----------------|---------------------|-------------|
| 1 | Input Buffer | In-memory | <1ms |
| 2 | Working Memory | Redis | <10ms |
| 3 | Session Memory | Redis+PostgreSQL | <50ms |
| 4 | Episodic Memory | PostgreSQL+Weaviate | <200ms |
| 5 | Semantic Memory | Weaviate+PostgreSQL | Permanent |
---
Safety Architecture - 4 Layers
1. Layer 1: Input Gate (<10ms) - Crisis keyword detection
2. Layer 2: Processing Guard (<100ms) - Contraindication checking
3. Layer 3: Output Filter (<500ms) - Response safety validation
4. Layer 4: Continuous Monitor - Session trajectory tracking
Crisis Levels (C-SSRS Mapping):
- 🟢 Level 0-1: Continue/Check-in
- 🟡 Level 2-3: Safety assessment/planning
- 🔴 Level 4-5: Crisis protocol (988 Lifeline, stay engaged, alert clinician)
---
Technology Stack
| Layer | Technology |
|---------------|-------------------------------------------|
| Orchestration | LangGraph (Multi-agent) |
| Backend | Python/FastAPI |
| LLM | Anthropic Claude/OpenAI GPT/Google Gemini |
| Vector DB | Weaviate (Hybrid BM25 + Semantic) |
| Relational DB | PostgreSQL |
| Cache | Redis Cluster |
| Events | Kafka |
| Container | Kubernetes |
| Service Mesh | Istio (mTLS) |
| Compliance | HIPAA, SOC2, Zero Trust |
---
Data Flow Summary
User Input → Safety Gate → Orchestrator → [Memory Context Load]
→ [Parallel: Diagnosis + Therapy + Personality]
→ Response Aggregation
→ Personality Style Application
→ Safety Post-check
→ [Memory Update]
→ Final Response
---
Key Design Patterns Used
1. Anti-Sycophancy Framework - Devil's Advocate agent challenges every diagnosis
2. Sample Consistency Confidence - Multiple LLM samples to calibrate confidence
3. Agentic Corrective RAG - Self-correcting retrieval with document grading
4. Ebbinghaus Decay + Safety Override - Natural memory decay, but crisis info NEVER decays
5. Hybrid Content Generation - Rules for clinical fidelity + LLM for conversational warmth
6. Stepped Care Routing - Severity-appropriate treatment intensity
7. MoEL Empathy - 32 specialized emotion listeners with soft combination