-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme
More file actions
463 lines (333 loc) · 17.4 KB
/
Readme
File metadata and controls
463 lines (333 loc) · 17.4 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<old_str># Neuro v2 - Persistent Cognitive Agent & Platform
Neuro v2 is a full-stack, interactive cognitive agent platform. It features a modern web-based chatbot that simulates an evolving, AI-powered mind, with persistent memory, emotional intelligence, and a rich set of features for both users and developers. Neuro v2 now includes a robust backend, advanced frontend, and integration capabilities for real-world applications.
## ✨ Key Features
### Cognitive Agent & Chatbot
- **Persistent Memory:** Remembers all interactions, beliefs, and mood across browser sessions and server restarts.
- **Dual-Mode Operation:**
- **Demo Mode:** Built-in, context-aware responses (no external API required).
- **LLM-Connected Mode:** Connects to OpenAI GPT-4 via user API key for generative, dynamic conversations.
- **Evolving Personality:** Learns and adapts beliefs, mood, and conversational style based on ongoing dialogue.
- **Emotional Analysis:** Assigns and visualizes emotional scores to user input, influencing agent mood and responses.
- **Cognitive State Dashboard:** Real-time display of agent's mind, including mood, recent memories, and evolving beliefs.
- **Import/Export State:** Download or upload the agent's full cognitive state (JSON) for backup, sharing, or restoration.
- **Modern, Responsive UI:** Clean, mobile-friendly interface with typing indicator, timestamps, collapsible settings, and theme support.
### Full-Stack Platform
- **Backend API (Python/FastAPI):**
- User authentication and session management
- Persistent database for chat logs, user profiles, and agent state
- RESTful endpoints for agent interaction, state management, and analytics
- **Frontend (React + TypeScript + Tailwind):**
- Rich chat interface with file upload, voice features, message reactions, and shared conversations
- Theme switching and accessibility options
- Real-time updates and dashboard integration
- **Server Utilities (Node.js):**
- Database connectivity and utility scripts
### Advanced Capabilities
- **Multi-User Support:** Each user has a unique agent state and secure login
- **File Uploads:** Attach files to conversations for context or memory
- **Voice Features:** Speech-to-text and text-to-speech integration
- **Message Reactions:** React to messages with emojis and feedback
- **Shared Conversations:** Share and view conversations with other users
- **Theme Provider:** Switch between light/dark modes and custom themes
- **Asset Management:** Upload and serve images, files, and other assets
## 🧩 Use Cases
- **Research & Experimentation:** Study cognitive agent behavior, memory, and adaptation in a controlled environment.
- **Education:** Teach concepts of AI, memory, emotion, and personality in classrooms or workshops.
- **Mental Health & Wellness:** Provide a safe, persistent conversational partner for journaling, mood tracking, or self-reflection.
- **Creative Writing & Storytelling:** Collaborate with the agent to generate stories, characters, or world-building ideas.
- **Customer Support & FAQ:** Deploy as a persistent, context-aware chatbot for user support and information retrieval.
- **Team Collaboration:** Share conversations, files, and ideas among team members with persistent context.
- **Personal Assistant:** Use as a memory-keeping, context-aware assistant for daily tasks and reminders.
- **Plugin Platform:** Extend with custom skills, analytics, or integrations for specialized domains.
## 🚀 How to Use
### Local Demo (Frontend Only)
1. Open `index.html` in any modern browser (Chrome, Firefox, Edge)
2. Start chatting immediately in Demo Mode
### Full Platform (Frontend + Backend)
1. Start the backend server (`backend/main.py`) with Python (see `pyproject.toml` for dependencies)
2. Start the frontend (React app in `frontend/`)
3. Access the full dashboard, login, and advanced features
### Connecting to GPT-4 (Optional)
- Click the settings icon (⚙️) in the chat UI
- Enter your OpenAI API key
- Click "Connect" to enable LLM-powered responses
### Managing Agent State
- Use settings panel to Export/Import agent state
- Reset memory to start fresh
## 🛠️ Technical Breakdown
### Backend (`backend/`)
- **Python (FastAPI):** Auth, database, API endpoints
- **Database:** Persistent storage for users, chat logs, agent state
### Frontend (`frontend/`)
- **React + TypeScript:** Main chat UI, dashboard, file upload, voice, reactions
- **Tailwind CSS:** Modern, responsive design
- **Vite:** Fast development/build tooling
### Server (`server/`)
- **Node.js:** Database utilities, server scripts
### Core Agent Logic
- **EnhancedCognitiveAgent:** Orchestrates perception, reflection, memory, adaptation
- **EnhancedLLMReflector:** Manages OpenAI API connection and response generation
- **MoodRegulator:** Tracks and adjusts agent mood
- **ThemeTracker:** Identifies and records key conversational themes
- **KnowledgeGraph:** Forms relationships between discussed concepts
- **Persistence:** Serializes agent state to JSON/localStorage/database
## 📁 Project Structure
- `backend/` - Python FastAPI backend
- `frontend/` - React/TypeScript frontend
- `server/` - Node.js utilities
- `attached_assets/` - Uploaded files and assets
- `index.html` - Standalone demo
## 📚 Documentation & Setup
- See `LOCAL_SETUP.md` for local installation and development
- See `replit.md` for Replit cloud setup
- See `Readme` for feature overview
## 🧑💻 Contributing
Pull requests and issues are welcome! See the frontend and backend folders for modular code and extension points.
## 🏁 Roadmap
- Multi-agent support
- Advanced analytics dashboard
- Plugin system for custom agent skills
- More LLM integrations
---
Neuro v2 is a next-generation cognitive agent platform for research, education, and creative applications. Try it out, extend it, and help shape the future of AI-powered conversation!</old_str>
<new_str># Neuro v2 - Advanced Cognitive Agent & Mental Health Platform
Neuro v2 is a comprehensive, full-stack cognitive agent platform featuring advanced AI capabilities, persistent memory, emotional intelligence, and specialized mental health support systems. Built with modern web technologies and sophisticated cognitive architectures.
## ✨ Core Capabilities
### 🧠 Advanced Cognitive Architecture
- **Associative Recall System:** Surfaces relevant past information contextually
- Semantic memory clustering using concept hierarchies
- Cross-domain knowledge bridging
- Dormant concept reactivation for creative insights
- Pattern-based memory retrieval
- **Context-Sensitive Response Adaptation:**
- Real-time emotional state detection and adaptation
- Communication style matching based on user preferences
- Historical context integration for personalized responses
- Dynamic personality adjustment based on interaction patterns
- **Contradiction Detection & Belief Revision:**
- Cognitive distortion identification (all-or-nothing thinking, overgeneralization, etc.)
- Gentle contradiction pointing with supportive guidance
- Progressive belief updating as users demonstrate growth
- Self-perception pattern analysis
### 🎯 Mental Health & Wellness Support
- **Emotional Trajectory Tracking:**
- Long-term emotional pattern analysis
- Early warning system for concerning trends
- Valence and arousal tracking over time
- Intervention effectiveness monitoring
- **Pattern Recognition:**
- Escalating distress detection
- Persistent sadness monitoring
- Social isolation indicators
- Anger escalation patterns
- Self-harm ideation alerts (immediate attention triggers)
- **Personalized Mental Health Insights:**
- Evidence-based recommendations
- Topics that help vs. harm specific users
- Crisis resource integration
- Professional help guidance
### 🔬 Causal Reasoning & Project Intelligence
- **Cause-Effect Relationship Mapping:**
- Project outcome analysis: "When you simplified the interface, engagement increased 40%"
- Automatic pattern extraction from project descriptions
- Success factor identification
- **Analogical Thinking:**
- Cross-project solution mapping
- Domain transfer insights: "This mobile app challenge is similar to your web redesign"
- Historical solution retrieval
- **Consequence Prediction:**
- Unintended outcome forecasting
- Risk assessment for proposed changes
- Mitigation strategy suggestions
### 🎨 Hypothesis Formation & Meta-Memory
- **User Pattern Analysis:**
- Behavioral preference detection
- Decision-making style identification
- Problem-solving approach mapping
- Technical complexity preferences
- **Idea Evolution Tracking:**
- Catalyst identification (frustration, inspiration, constraints)
- Concept development timelines
- Novelty and feasibility scoring
- Influence relationship mapping
- **Meta-Memory Systems:**
- How ideas developed, not just final results
- Memory of memory formation
- Belief revision tracking
### 🏗️ Goal Management & Progress Tracking
- **Intelligent Goal Detection:**
- Automatic goal extraction from conversations
- Category classification (career, health, learning, relationships, financial)
- Priority assessment and due date management
- **Progress Monitoring:**
- Conversation-based progress detection
- Automatic completion percentage updates
- Milestone recognition and celebration
- Follow-up suggestions for stalled goals
- **Goal Relationship Mapping:**
- Cross-goal influence tracking
- Conversation topic linking
- Update timeline visualization
### 🔄 Real-Time Cognitive Processing
- **Streaming Response Generation:**
- Token-by-token response streaming
- Real-time cognitive state updates
- WebSocket-based live updates
- Performance-optimized caching
- **Multi-Modal Analysis:**
- File upload and analysis
- Image processing capabilities
- Document content extraction
- Code analysis features
## 🎵 Planned Voice Integration: ElevenLabs
### Voice Synthesis Capabilities
- **Natural Voice Generation:** High-quality text-to-speech using ElevenLabs API
- **Emotional Voice Adaptation:** Voice tone matching cognitive state
- **Multiple Voice Models:** Selectable voice personalities
- **Real-time Audio Streaming:** Low-latency voice response generation
### Implementation Plan
1. **Backend Integration:**
- ElevenLabs API client integration
- Audio file generation and caching
- Voice model management
- Streaming audio response endpoints
2. **Frontend Audio Features:**
- Audio playback controls
- Voice model selection interface
- Audio waveform visualization
- Background audio generation toggle
3. **Voice Personalization:**
- User voice preference learning
- Emotional state-aware voice adaptation
- Context-appropriate speaking style
- Voice speed and tone customization
## 🏗️ Technical Architecture
### Backend (Python/FastAPI)
- **Advanced Cognitive Processors:**
- `CognitiveProcessor`: Memory, learning, preference tracking
- `EmotionalTrajectoryTracker`: Mental health pattern analysis
- `ContradictionDetector`: Belief revision and distortion detection
- `CausalReasoningEngine`: Project analysis and analogical thinking
- `HypothesisFormationEngine`: Pattern analysis and idea tracking
- `ConceptHierarchy`: Semantic memory and creative insight generation
- **Database Architecture:**
- User management with personality settings
- Conversation and message storage with cognitive state tracking
- Goal management with progress tracking
- Emotional state and pattern storage
- Mental health insights and recommendations
- Hypothesis and evidence tracking
- Idea evolution timeline storage
- **Performance Optimizations:**
- Response caching system
- Database query optimization
- WebSocket connection management
- Streaming response generation
### Frontend (React/TypeScript/Tailwind)
- **Modern Chat Interface:**
- Real-time message streaming
- Cognitive state visualization
- File upload with preview
- Message reactions and feedback
- Theme switching (light/dark)
- **Advanced Features:**
- Voice recording and playback
- Shared conversation spaces
- Mental health dashboard
- Goal tracking interface
- Analytics and insights panels
### Database Schema
- **Core Tables:** Users, Conversations, Messages, Memories
- **Goal Management:** Goals, GoalUpdates, ConversationTopics
- **Mental Health:** EmotionalStates, EmotionalPatterns, MentalHealthInsights
- **Intelligence:** Hypotheses, HypothesisEvidence, IdeaEvolutions
- **Preferences:** UserPreferences, InteractionPatterns
## 🚀 Quick Start
### Development Setup
```bash
# Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# Frontend
cd frontend
npm install
npm run dev -- --host 0.0.0.0 --port 5000
```
### Environment Variables
```env
# Required for full functionality
OPENAI_API_KEY=your_openai_api_key
ELEVENLABS_API_KEY=your_elevenlabs_api_key # For voice features
JWT_SECRET_KEY=your_secret_key
DATABASE_URL=your_database_url # Optional, defaults to SQLite
```
### API Endpoints Overview
- **Authentication:** `/api/auth/register`, `/api/auth/login`
- **Chat:** `/api/chat/stream` (streaming responses)
- **Goals:** `/api/goals/` (CRUD operations)
- **Mental Health:** `/api/mental-health/trajectory`, `/api/mental-health/patterns`
- **Intelligence:** `/api/hypothesis-formation/`, `/api/causal-reasoning/`
- **Testing:** Various `/test` endpoints for capability demonstration
## 🧪 Advanced Testing Features
The platform includes comprehensive testing endpoints for all cognitive capabilities:
- **Associative Recall Testing:** `/api/associative-recall/test`
- **Contradiction Detection:** `/api/contradiction-detection/test`
- **Semantic Memory Clustering:** `/api/semantic-memory/test`
- **Causal Reasoning Analysis:** `/api/causal-reasoning/extract-relationships`
- **Hypothesis Formation:** `/api/hypothesis-formation/analyze-patterns`
- **Mental Health Monitoring:** `/api/mental-health/dashboard`
## 📊 Analytics & Monitoring
- **User Behavior Analytics:** Interaction patterns, session analysis
- **Mental Health Metrics:** Emotional trajectory trends, intervention effectiveness
- **Cognitive Performance:** Memory accuracy, pattern recognition success rates
- **Goal Achievement Tracking:** Completion rates, progress trends
- **System Performance:** Response times, cache hit rates, connection stability
## 🎯 Use Cases
### Personal Development
- **Mental Health Support:** Depression/anxiety monitoring, cognitive therapy assistance
- **Goal Achievement:** Project management, habit formation, progress tracking
- **Learning Assistant:** Knowledge retention, concept connection, skill development
- **Creative Partner:** Idea development, creative writing, brainstorming support
### Professional Applications
- **Project Management:** Pattern analysis, risk prediction, solution recommendation
- **Team Collaboration:** Shared insights, conversation spaces, knowledge sharing
- **Customer Support:** Context-aware assistance, emotional intelligence, escalation detection
- **Research Platform:** Cognitive behavior studies, AI interaction research
### Educational Settings
- **AI Education:** Demonstrate cognitive architectures, memory systems, learning algorithms
- **Psychology Training:** Cognitive distortion recognition, therapeutic conversation techniques
- **Computer Science:** Advanced AI systems, natural language processing, machine learning
## 🔧 Customization & Extensions
### Plugin System (Planned)
- **Custom Cognitive Processors:** Extend analysis capabilities
- **Integration Modules:** Connect to external services and APIs
- **Specialized Domains:** Medical, legal, technical expertise modules
- **Custom UI Components:** Tailored interfaces for specific use cases
### Configuration Options
- **Personality Settings:** Creativity, empathy, formality levels
- **Response Styles:** Detailed vs. concise, technical vs. conversational
- **Privacy Controls:** Data retention, sharing permissions, anonymization
- **Feature Toggles:** Enable/disable specific cognitive capabilities
## 🔒 Privacy & Security
- **Data Encryption:** All sensitive data encrypted at rest and in transit
- **User Isolation:** Complete separation of user data and cognitive states
- **Configurable Retention:** User-controlled data retention policies
- **Export Controls:** Full data portability and deletion capabilities
- **HIPAA Considerations:** Mental health data protection compliance planning
## 🌟 Future Roadmap
### Q1 2025
- **ElevenLabs Voice Integration:** Natural speech synthesis with emotional adaptation
- **Mobile App:** Native iOS/Android applications
- **Advanced Analytics Dashboard:** Comprehensive insights and trends
### Q2 2025
- **Multi-Agent Collaboration:** Agent-to-agent communication and shared learning
- **Plugin Marketplace:** Community-driven extensions and integrations
- **Enterprise Features:** Team management, admin controls, compliance tools
### Q3 2025
- **Federated Learning:** Privacy-preserving collaborative model improvement
- **Advanced Memory Systems:** Episodic memory, working memory simulation
- **Specialized Clinical Modules:** Licensed therapeutic assistance features
---
**Neuro v2** represents the cutting edge of cognitive AI platforms, combining advanced machine learning with thoughtful human-centered design. Built for researchers, therapists, educators, and individuals seeking a truly intelligent conversational partner.
**Ready to explore the future of AI-human interaction? Start with our demo mode or deploy your own instance on Replit today.**</new_str>