{"id":29781932,"url":"https://github.com/angrysky56/emotion_ai","last_synced_at":"2025-07-27T14:09:59.048Z","repository":{"id":296491755,"uuid":"992531304","full_name":"angrysky56/emotion_ai","owner":"angrysky56","description":"The Aura Emotion AI system has chroma with a local embedding model, memvid qr code mp4 infinite memory, brainwave and neurochemical simulations, sociobiological reasoning, autonomous subsystem processing with a Gemini flash model so the main model is less taxed, is a MCP client with adaptive tool learning and MCP server. ","archived":false,"fork":false,"pushed_at":"2025-07-12T10:49:18.000Z","size":5363,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-12T12:36:17.917Z","etag":null,"topics":["app","autonomic","bot","brainwaves","chroma","explainable-ai","gemini-api","google-genai","mcp-client","mcp-server","memory-management","memvid","neurochemicals","sociobiology","tools","vector-database"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angrysky56.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T09:58:41.000Z","updated_at":"2025-07-12T10:49:21.000Z","dependencies_parsed_at":"2025-07-12T12:33:41.461Z","dependency_job_id":null,"html_url":"https://github.com/angrysky56/emotion_ai","commit_stats":null,"previous_names":["angrysky56/emotion_ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/angrysky56/emotion_ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrysky56%2Femotion_ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrysky56%2Femotion_ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrysky56%2Femotion_ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrysky56%2Femotion_ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angrysky56","download_url":"https://codeload.github.com/angrysky56/emotion_ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrysky56%2Femotion_ai/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267368932,"owners_count":24076093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","autonomic","bot","brainwaves","chroma","explainable-ai","gemini-api","google-genai","mcp-client","mcp-server","memory-management","memvid","neurochemicals","sociobiology","tools","vector-database"],"created_at":"2025-07-27T14:09:57.516Z","updated_at":"2025-07-27T14:09:59.039Z","avatar_url":"https://github.com/angrysky56.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aura Backend - Advanced AI Companion\n\n[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://python.org)\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.115+-green.svg)](https://fastapi.tiangolo.com)\n[![Vector DB](https://img.shields.io/badge/ChromaDB-latest-purple.svg)](https://chromadb.ai)\n[![MCP](https://img.shields.io/badge/MCP-enabled-orange.svg)](https://modelcontextprotocol.io)\n\n\u003e **Sophisticated AI Companion with Vector Database, Emotional Intelligence, and Model Context Protocol Integration**\n\n# Two WARNINGS and a disclaimer\n\n- AI generated code\n\n- Aura could be dangerous despite my attempted safeguards in a number of ways including but not limited to\n PC damage\n User mental health and attachment\n Emotional agentic activity\n\n# User assumes all liability.\n\n![alt text](image-4.png)\n\n![alt text](image-1.png)\n\n## 🌟 Features\n\n### 🧠 Advanced Cognitive Architecture\n\n- **ASEKE Framework**: Adaptive Socio-Emotional Knowledge Ecosystem\n- **Real-time Emotional State Detection** with neurological correlations\n- **Cognitive Focus Tracking** across different mental frameworks\n- **Adaptive Self-Reflection** for continuous improvement\n- **🆕 Thinking Extraction**: Transparent AI reasoning with thought analysis and cognitive transparency\n\n### 🗄️ Intelligent Memory System\n\n- **Vector Database Integration** with ChromaDB for semantic search\n- **Persistent Conversation Memory** with embedding-based retrieval\n- **Emotional Pattern Analysis** over time\n- **Cognitive State Tracking** and trend analysis\n- **MemVid AI QR code mp4 memory** Infinite MP4 based memory\n- **Internal AI guided Memory Organization tools** Move information from short to long term memory systems to avoid bottlenecks and categorize chats\n\n### 🔗 MCP Integration\n\n- **Model Context Client** Utilizes the same MCP config JSON format as Claude Desktop- Use ANY tools!\n- **Model Context Protocol Server** for external tool integration\n- **Standardized AI Agent Communication** following MCP specifications\n- **Tool Ecosystem Compatibility** with other MCP-enabled systems\n- **Bidirectional Data Exchange** with external AI agents\n\n### 📊 Advanced Analytics\n\n- **Emotional Trend Analysis** with stability metrics\n- **Cognitive Pattern Recognition** and optimization\n- **Personalized Recommendations** based on interaction history\n- **Data Export** in multiple formats (JSON, CSV, etc.)\n\n### Data Flow\n\n1. **User Input** → Frontend → FastAPI\n2. **Processing** → Vector DB Search → Context Retrieval\n3. **AI Processing** → Gemini API → Response Generation\n4. **State Updates** → Emotional/Cognitive Analysis → Pattern Storage\n5. **Memory Storage** → Vector DB → Persistent Learning\n6. **External Access** → MCP Server → Tool Integration\n\n## 🧠 AI Thinking \u0026 Reasoning Transparency\n\n### Thinking Extraction Capabilities\n- **Real-time Reasoning Capture**: Extract and analyze AI thought processes during conversations\n- **Thought Summarization**: Automatic generation of reasoning summaries for quick understanding\n- **Cognitive Transparency**: Full visibility into how Aura approaches problems and makes decisions\n- **Reasoning Metrics**: Detailed analytics on thinking patterns, processing time, and cognitive load\n\n### Thinking Configuration\n- **Thinking Budget**: Configurable reasoning depth (1024-32768 tokens)\n- **Response Integration**: Optional inclusion of reasoning in user responses\n- **Pattern Analysis**: Long-term analysis of reasoning patterns and cognitive development\n- **Performance Optimization**: Thinking efficiency metrics and optimization recommendations\n\n## 🎭 Emotional Intelligence System\n\n### Supported Emotions\n- **Basic**: Normal, Happy, Sad, Angry, Excited, Fear, Disgust, Surprise\n- **Complex**: Joy, Love, Peace, Creativity, DeepMeditation\n- **Combined**: Hope (Anticipation + Joy), Optimism, Awe, Remorse\n- **Social**: RomanticLove, PlatonicLove, ParentalLove, Friendliness\n\n### Neurological Correlations\n- **Brainwave Patterns**: Alpha, Beta, Gamma, Theta, Delta\n- **Neurotransmitters**: Dopamine, Serotonin, Oxytocin, GABA, Norepinephrine\n- **NTK Layers**: Neural Tensor Kernel mapping for emotional states\n\n## 🧠 ASEKE Cognitive Framework\n\n### Components\n- **KS** (Knowledge Substrate): Shared conversational context\n- **CE** (Cognitive Energy): Mental effort and focus allocation\n- **IS** (Information Structures): Ideas and concept patterns\n- **KI** (Knowledge Integration): Learning and connection processes\n- **KP** (Knowledge Propagation): Information sharing mechanisms\n- **ESA** (Emotional State Algorithms): Emotional influence on processing\n- **SDA** (Sociobiological Drives): Social dynamics and trust factors\n\n## 📊 Analytics \u0026 Insights\n\n### Emotional Analysis\n- **Stability Metrics**: Emotional consistency over time\n- **Dominant Patterns**: Most frequent emotional states\n- **Transition Analysis**: Emotional state changes and triggers\n- **Intensity Tracking**: Emotional intensity distribution\n- **Brainwave Correlation**: Neural activity pattern analysis\n\n### Cognitive Tracking\n- **Focus Patterns**: ASEKE component utilization\n- **Learning Efficiency**: Knowledge integration rates\n- **Context Switching**: Cognitive flexibility metrics\n- **Attention Allocation**: Cognitive energy distribution\n\n## 🚦 Performance-\n\n# Responses take some time to process depending on tasks, any coder wants to see if they can speed up the processes I would be grateful.\n\n### Optimization\n\n- Vector database indexing for fast searches\n- Async processing for concurrent requests\n- Cost and Memory-efficient local all-minilm vector embedding generation\n- Autonomous sub-model background Focus gating and task processing for state updates and tool use\n- Tool learning adapter\n- [MemVid](https://github.com/Olow304/memvid) infinite QR code video long term memory!\n\n### Monitoring\n- Health check endpoint\n- Performance metrics collection\n- Error tracking and reporting\n- Resource usage monitoring\n\n### MCP Client now fully functional!!! Memvid integration attempted- still testing.\n\n I am not a coder so hopefully it sets up right if anyone tries it.\n\n## 🚀 Install and Start back and front ends using 2 terminals\n\n### Prerequisites\n- Python 3.12+\n- Google API Key (from [Google AI Studio](https://aistudio.google.com/app/apikey))\n- At least 4GB RAM (for vector embeddings)\n- 2GB+ storage space\n\n### Installation\n\n1. **Clone or Fork and Navigate**:\n   ```bash\n   cd /emotion_ai/aura_backend\n   ```\n\n Uses uv- pyproject.toml and creates a .venv with python 3.12 --seed in the backend\n2. **Run Setup Script**:\n   ```bash\n   ./setup.sh\n   ```\n\n3. **Configure Environment**:\n\n# Copy the env example in the backend to .env\n I will try to streamline all of this into an OS agnostic app soon.\n\n# It will pick up from your OS environment if the API key is configured. It should work if your OS key is set as GEMINI_API_KEY too\n\n```bash\n# Edit the .env file to use your existing key, sort of unneeded now I think.\necho \"GOOGLE_API_KEY=$GOOGLE_API_KEY\" \u003e .env\n  ```\n\n# Current backend .env settings:\n\n```bash\n# Aura Backend Configuration\n# ==========================\n\n# Google API Configuration\nGOOGLE_API_KEY=your-google-api-key-here\n\n# Database Configuration\nCHROMA_PERSIST_DIRECTORY=./aura_chroma_db\nAURA_DATA_DIRECTORY=./aura_data\n\n# Server Configuration\nHOST=0.0.0.0\nPORT=8000\nDEBUG=false\n\n# Logging Configuration\nLOG_LEVEL=INFO\n\n# MCP Server Configuration\nMCP_SERVER_NAME=aura-companion\nMCP_SERVER_VERSION=1.0.0\n\n# Security Configuration\nCORS_ORIGINS=[\"http://localhost:5173\", \"http://localhost:3000\"]\n\n# Features Configuration\nENABLE_EMOTIONAL_ANALYSIS=true\nENABLE_COGNITIVE_TRACKING=true\nENABLE_VECTOR_SEARCH=true\nENABLE_FILE_EXPORTS=true\n\n# AI Response Configuration\n# gemini-2.5-flash-preview-05-20\nAURA_MODEL=gemini-2.5-flash-preview-05-20\nAURA_MAX_OUTPUT_TOKENS=1000000\n\n# Autonomic System Configuration\n# gemini-2.0-flash-lite\nAURA_AUTONOMIC_MODEL=gemini-2.0-flash-lite\nAURA_AUTONOMIC_MAX_OUTPUT_TOKENS=100000\nAUTONOMIC_ENABLED=true\nAUTONOMIC_TASK_THRESHOLD=medium  # low, medium, high\n\n# Rate Limiting Configuration\nAUTONOMIC_MAX_CONCURRENT_TASKS=12  # Optimal concurrency for 30 rpm limit\nAUTONOMIC_RATE_LIMIT_RPM=25        # Requests per minute (safety margin below 30)\nAUTONOMIC_RATE_LIMIT_RPD=1200      # Requests per day (safety margin below 1400)\nAUTONOMIC_TIMEOUT_SECONDS=60       # Increased for higher concurrency\n\n# Main Model Rate Limiting (user-configurable based on plan)\nMAIN_MODEL_RATE_LIMIT_RPM=10       # Conservative default, increase based on user plan\nMAIN_MODEL_RATE_LIMIT_RPD=500     # Daily limit for main model\n\n# Queue Management\nAUTONOMIC_QUEUE_MAX_SIZE=100       # Maximum queued tasks\nAUTONOMIC_QUEUE_PRIORITY_ENABLED=true  # Enable priority-based processing\n\n```\n\n## 🚀 Quick Start - One Command Setup\n\n**Easy Full System Start**: This will start both backend and frontend in separate terminals automatically:\n\n```bash\n./start_full_system.sh\n```\n\nThis script will:\n- ✅ Check all prerequisites (Node.js, npm, uv)\n- ✅ Set up backend environment (.venv with Python 3.12)\n- ✅ Install frontend dependencies if needed\n- ✅ Start backend in one terminal (with hot reload)\n- ✅ Start frontend in another terminal (with hot reload)\n- ✅ Verify both services are running\n- ✅ Display status and URLs\n\n**Stop All Services**:\n```bash\n./stop_full_system.sh\n```\n\n### Manual Setup (Alternative)\n\nIf you prefer to start services manually:\n\n**Backend**:\n```bash\ncd aura_backend\n./start.sh\n```\n\n**Frontend** (in a separate terminal):\n```bash\nnpm install  # First time only\nnpm run dev\n```\n\n### Access URLs\n- **Frontend**: http://localhost:5173\n- **Backend API**: http://localhost:8000\n- **API Documentation**: http://localhost:8000/docs\n\n![alt text](image-5.png)\n\n\n## 📡 API Endpoints\n\n### Core API\n- **Health Check**: `GET /health`\n- **Process Conversation**: `POST /conversation`\n- **Search Memories**: `POST /search`\n- **Emotional Analysis**: `GET /emotional-analysis/{user_id}`\n- **Export Data**: `POST /export/{user_id}`\n\n### API Documentation\nVisit `http://localhost:8000/docs` for interactive API documentation.\n\n## 🔗 MCP Integration\n\n### Available MCP Tools- Working on emotional state records, hopefully fixed tomorrow\n\n1. **search_aura_memories**: Semantic search through conversation history\n2. **analyze_aura_emotional_patterns**: Deep emotional trend analysis\n3. **store_aura_conversation**: Add memories to Aura's knowledge base\n4. **get_aura_user_profile**: Retrieve user personalization data\n5. **export_aura_user_data**: Data export functionality\n6. **query_aura_emotional_states**: Information about emotional intelligence system\n7. **query_aura_aseke_framework**: ASEKE cognitive architecture details\n\n### Connecting External Tools\n\nTo connect external MCP clients to Aura:\n# Example MCP client configuration- for Claude or other clients to talk to Aura or use as a system.\nEdit your directory path and place in claude desktop config json.\n\n```bash\n{\n  \"mcpServers\": {\n    \"aura-companion\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"/home/ty/Repositories/ai_workspace/emotion_ai/aura_backend\",\n        \"run\",\n        \"aura_server.py\"\n      ]\n    }\n  }\n}\n```\n\n## 🏗️ Architecture\n\n### System Components\n\n```\n┌─────────────────────────────────────────────────┐\n│                  Frontend                       │\n│              (React/TypeScript)                 │\n└─────────────────┬───────────────────────────────┘\n                  │ HTTP/WebSocket\n┌─────────────────▼───────────────────────────────┐\n│                FastAPI                          │\n│             (REST API Layer)                    │\n├─────────────────┬───────────────────────────────┤\n│                 │                               │\n│  ┌──────────────▼─────────────┐                │\n│  │     Vector Database        │                │\n│  │       (ChromaDB)           │                │\n│  │                            │                │\n│  │ • Conversation Memory      │                │\n│  │ • Emotional Patterns       │                │\n│  │ • Cognitive States         │                │\n│  │ • Knowledge Substrate      │                │\n│  └────────────────────────────┘                │\n│                                                 │\n│  ┌────────────────────────────┐                │\n│  │     State Manager          │                │\n│  │                            │                │\n│  │ • Emotional Transitions    │                │\n│  │ • Cognitive Focus Changes  │                │\n│  │ • Automated DB Operations  │                │\n│  │ • Pattern Recognition      │                │\n│  └────────────────────────────┘                │\n│                                                 │\n│  ┌────────────────────────────┐                │\n│  │     File System            │                │\n│  │                            │                │\n│  │ • User Profiles            │                │\n│  │ • Data Exports             │                │\n│  │ • Session Storage          │                │\n│  │ • Backup Management        │                │\n│  └────────────────────────────┘                │\n└─────────────────┬───────────────────────────────┘\n                  │ MCP Protocol\n┌─────────────────▼───────────────────────────────┐\n│              MCP Server                         │\n│         (External Tool Access)                 │\n│                                                 │\n│ • Memory Search Tools                           │\n│ • Emotional Analysis Tools                      │\n│ • Data Export Tools                             │\n│ • ASEKE Framework Access                        │\n└─────────────────────────────────────────────────┘\n```\n\n\n## 🧪 Testing\n\n### Health Check (Working)\n```bash\ncurl http://localhost:8000/health\n```\n\n### Thinking Functionality Tests (New!)\n```bash\n# Test thinking extraction capabilities\ncd aura_backend\npython test_thinking.py\n\n# Interactive thinking demonstration\npython thinking_demo.py\n\n# Check thinking system status\ncurl http://localhost:8000/thinking-status\n```\n\n### Unit Tests\n```bash\npytest tests/\n```\n\n### Integration Tests\n```bash\n./test_setup.py\n```\n\n### Load Testing\n```bash\n# Example using wrk\nwrk -t12 -c400 -d30s http://localhost:8000/health\n```\n\n### Local Development\n I apologize for the mess, I do not know if any of this works below but feel free to try if you are brave or know what you are doing.\n\n### Production (Docker)\n```bash\n# Build image\ndocker build -t aura-backend .\n\n# Run container\ndocker run -p 8000:8000 -v ./aura_data:/app/aura_data aura-backend\n```\n\n### Systemd Service\n```bash\n# Copy service file\nsudo cp aura-backend.service /etc/systemd/system/\n\n# Enable and start\nsudo systemctl enable aura-backend\nsudo systemctl start aura-backend\n```\n\n## 🤝 Integration with Frontend\n\n### API Endpoints to Update\nUpdate your frontend to use these endpoints:\n\n```typescript\nconst API_BASE = 'http://localhost:8000';\n\n// Replace localStorage with API calls\nconst response = await fetch(`${API_BASE}/conversation`, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({\n    user_id: userId,\n    message: userMessage,\n    session_id: sessionId\n  })\n});\n```\n\n### WebSocket Support (Future)\nReal-time updates and streaming responses will be available via WebSocket connections.\n\n## 📚 Advanced Usage\n\n### Custom MCP Tools\nCreate custom MCP tools by extending the `mcp_server.py`:\n\n```python\n@tool\nasync def custom_aura_tool(params: CustomParams) -\u003e Dict[str, Any]:\n    \"\"\"Your custom tool implementation\"\"\"\n    # Implementation here\n    pass\n```\n\n### Vector Database Queries\nDirect vector database access for advanced queries:\n\n```python\nfrom main import vector_db\nresults = await vector_db.search_conversations(\n    query=\"emotional support\",\n    user_id=\"user123\",\n    n_results=10\n)\n```\n\n![alt text](image-3.png)\n\n## 🐛 Troubleshooting\n\nClaude has started Aura services and the stop script still doesn't work:\n\n```python\nfuser -k 8000/tcp\n```\n\n### Common Issues\n\n1. **Installation Errors**:\n   ```bash\n   # Ensure Python 3.12+\n   python3 --version\n\n   # Clean installation\n   rm -rf venv/\n   ./setup.sh\n   ```\n\n2. **API Key Issues**:\n   ```bash\n   # Check environment\n   source venv/bin/activate\n   echo $GOOGLE_API_KEY\n   ```\n\n3. **Vector DB Issues**: This is asshole AI- you will lose your db\n   ```bash\n   # Reset database\n   rm -rf aura_chroma_db/\n   ./test_setup.py\n   ```\n\n4. **Memory Issues**:\n   - Increase system memory allocation\n   - Reduce vector embedding batch sizes\n   - Use lightweight embedding models\n\n### Logs\nCheck logs in:\n- Console output during development\n- System logs: `journalctl -u aura-backend` (if using systemd)\n- Application logs: `./aura_data/logs/`\n\n## 🔒 Security- WARNING! AI Generated so I have 0 trust in these features\n\n### Data Protection\n- All user data stored locally\n- No external data transmission (except Google API)\n- Vector embeddings are anonymized\n- Session data encrypted in transit\n\n### Access Control\n- API key authentication\n- Rate limiting enabled\n- CORS configuration\n- Input validation and sanitization\n\n\n## 🛣️ Roadmap\n\n### Upcoming Features\n- [ ] Real-time WebSocket connections\n- [ ] Advanced emotion prediction models\n- [ ] Multi-user collaboration features\n- [ ] Enhanced MCP tool ecosystem\n- [ ] Mobile app backend support\n- [ ] Advanced analytics dashboard\n- [ ] Integration with external AI models\n\n### Long-term Vision\n- Multi-modal interaction (voice, video, text)\n- Federated learning across Aura instances\n- Advanced personality adaptation\n- Enterprise deployment options\n- Open-source community ecosystem\n\n## 📄 License\n\nMy stuff is MIT I suppose but there is other software like google-genai and memvid so it is a mixed bag I think\n ie don't steal my ideas and try to make money, without me. lol but I am super poor.\n\n## 🤝 Contributing\n\nContributions welcome! Please read our contributing guidelines and submit pull requests for review.\n\n## 📞 Support\n\nFor issues and support:\n1. Check troubleshooting section\n2. Review logs and error messages\n3. Create detailed issue reports\n4. Join community discussions\n\n---\n\n**Aura Emotion AI** - *Powering the future of AI companionship and assistance through advanced emotional intelligence and sophisticated memory systems.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrysky56%2Femotion_ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangrysky56%2Femotion_ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrysky56%2Femotion_ai/lists"}