Spaces:
Sleeping
title: MindSphere Coach
emoji: π§
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
MindSphere Coach
An interactive coaching agent that uses Active Inference, Theory of Mind, and empathic planning to help people identify and overcome personal growth bottlenecks.
Unlike standard coaching chatbots, MindSphere maintains a computational model of the user's mind β it infers why a recommendation will or won't work, and adapts in real time.
How It Works
- Calibration β 10 adaptive questions assess 8 skill dimensions (focus, follow-through, social courage, emotional regulation, systems thinking, self-trust, task clarity, consistency)
- Visualization β an interactive radar chart ("MindSphere") shows your skill profile with dependency edges highlighting bottlenecks
- Coaching β the agent proposes personalized micro-interventions, predicts your response via Theory of Mind, and adapts based on your feedback
The agent is a companion first, coach second β it follows your lead, talks about anything, and weaves coaching insights naturally into conversation.
Architecture
Core Engine (Active Inference)
βββ Factored POMDP β 12 state factors, mean-field belief updates
βββ EFE action selection β pragmatic + epistemic drives
βββ Dirichlet parameter learning β A/B matrices refine with experience
Theory of Mind
βββ Particle filter β 50 particles over 7-dim user type space
βββ Reliability gating β entropy-based confidence threshold
βββ Empathic planning β G_social blending with counterfactuals
User Profile (Bayesian Network)
βββ LLM-extracted facts β life events, goals, challenges, context
βββ Causal edges β "breakup β emotional_stress β focus_impaired"
βββ Forward belief propagation β inferred states feed into POMDP
Emotional Inference (Circumplex Model)
βββ Predict β Observe β Update loop
βββ 8-state POMDP over valence Γ arousal
βββ Prediction error tracking
LLM Layer (Mistral)
βββ Dynamic system prompt β beliefs, ToM, emotions, profile injected
βββ Natural conversation β companion-style, not scripted
βββ Structured extraction β profile facts + causal links via JSON
Quick Start
Option 1: Double-click (Windows)
Just double-click START.bat β it checks for Python, installs dependencies, and opens the app in your browser.
Option 2: Command line
Prerequisites: Python 3.10+
# Clone
git clone https://github.com/mahault/mindsphere-coach.git
cd mindsphere-coach
# Install
pip install -e .
# (Optional) Add your Mistral API key for LLM-powered conversation
cp .env.example .env
# Edit .env and add: MISTRAL_API_KEY=your_key_here
# Run
python scripts/run_demo.py
Then open http://localhost:8000 in your browser.
API Key
The app works without an API key (template-based responses), but for natural LLM-powered conversation you need a Mistral API key:
- Copy
.env.exampleto.env - Replace
your_mistral_api_key_herewith your actual key
Project Structure
src/mindsphere/
βββ core/ # Active Inference engine
β βββ agent.py # Main orchestrator (~2100 lines)
β βββ model.py # Factored POMDP: A/B/C/D matrices
β βββ inference.py # Belief updates, EFE computation
β βββ user_profile.py # Bayesian network user model
β βββ emotional_state.py # Circumplex emotion POMDP
β βββ learning.py # Dirichlet parameter learning
β βββ dependency_graph.py # Skill dependency DAG
β
βββ tom/ # Theory of Mind module
β βββ particle_filter.py # User type inference
β βββ empathy_planner.py # G_social blending
β βββ trust.py # Reliability gating
β
βββ llm/ # Mistral LLM layer
β βββ client.py # API client
β βββ generator.py # Conversational engine
β βββ classifier.py # Structured classification
β
βββ content/ # Questions & interventions
βββ api/ # FastAPI + WebSocket backend
βββ viz/ # Plotly chart generation
βββ frontend/ # Vanilla JS + Plotly SPA
Running Tests
pip install -e ".[dev]"
pytest tests/ -v
102 tests covering the POMDP model, inference, particle filter, empathy planner, emotional state, and full integration pipeline.
License
MIT