by thetahealth
Your Data, Your AI — Health, Finance & More. Open Source, Privacy-First.
# Add to your Claude Code skills
git clone https://github.com/thetahealth/mirobodyYour Data, Your AI — Health, Finance & More. Open Source, Privacy-First.
Self-hosted data platform that bridges your personal data with the latest AI capabilities
AI Engine:
Health Data:
No comments yet. Be the first to share your thoughts!
Forget about complex JSON schemas, manual bindings, or router configurations. In Mirobody, your Python code is the only definition required.
MCP_PUBLIC_URL to expose your MCP server over HTTPS for ChatGPT Apps and other remote integrations.Mirobody is built for Personal Intelligence, not just local storage. We believe the next frontier of AI is not knowing more about the world, but knowing more about you.
skills/ directory - Mirobody will automatically discover and expose them.Mirobody provides three agent types for different use cases:
| Agent | Description | Use Case | | ----------------------- | ------------------------------- | ------------------------------------------------------ | | DeepAgent | Single-model tool orchestration | Complex queries requiring data retrieval and analysis | | MixAgent | Two-phase model fusion | Optimized cost/quality balance with specialized models | | BaselineAgent | Direct LLM conversation | Simple Q&A without tool calls |
Inspired by LangChain DeepAgents, DeepAgent is our primary agent for tool-assisted conversations. Key features:
ALLOWED_TOOLS / DISALLOWED_TOOLSA two-phase model fusion architecture that separates tool orchestration from response generation:
This architecture optimizes for both cost and quality by using expensive models only where necessary.
A lightweight agent for direct LLM conversations without tool access. Ideal for:
📁 Secure File Operations: File tools (
ls,read_file,write_file,edit_file,glob,grep) are backed by PostgreSQL for data persistence and auditability. Seemirobody/pub/tools/file_read_service.pyandfile_write_service.pyfor implementation details.🧪 Sandbox Code Execution: The
executetool runs shell commands in isolated E2B cloud sandboxes for data analysis and computation. RequiresE2B_API_KEYconfiguration. See CONFIG for setup details.👉 See CONFIG for detailed agent configuration guide.
| Module | Path | Description |
|--------|------|-------------|
| Chat Service | mirobody/chat/ | Session management, conversation history, streaming adapters (HTTP/WebSocket), memory integration |
| Agent Implementations | mirobody/pub/agents/ | DeepAgent (LangChain), MixAgent (two-phase fusion), BaselineAgent |
| LLM Clients | mirobody/utils/llm/ | Multi-provider adapter (OpenAI, Gemini, Azure OpenAI, Volcengine, Dashscope), HIPAA-compliant routing |
| MCP Server | mirobody/mcp/ | JSON-RPC 2.0 tool/resource server, local + HTTP remote access |
| Tools | mirobody/pub/tools/ | Built-in tools: file ops, charts, code execution (E2B sandbox), memory |
| Embeddings | mirobody/utils/utils_embedding.py | text-embedding-3-small via OpenAI/Azure, pgvector semantic search |
| Prompt Templates | prompts/ | Jinja2 system prompts with dynamic context injection (user timezone, tools, health profile) |
| Skills | skills/ | Claude Agent Skills (SKILL.md + metadata.json), auto-discovery |
| Module | Path | Description |
|--------|------|-------------|
| FHIR Mapping | mirobody/pulse/core/fhir_mapping.py | In-memory cache of indicator → FHIR code, optional auto-registration of new codes |
| Indicator Registry | mirobody/pulse/core/indicators_info.py | 400+ StandardIndicator enum, multi-source (Vital, Apple Health, Garmin, Whoop, Renpho) |
| Unit Conversion | mirobody/pulse/core/units.py | Bidirectional conversion: kg/lbs, °C/°F, mg·dL⁻¹/mmol·L⁻¹, mmHg/kPa, etc. |
| Indicator Search | mirobody/indicator/ | Embedding-based free-text → indicator code, concept graph expansion (LOINC / SNOMED CT / RxNorm bridges) |
| Medical Code Mapping | health_tools/ | SNOMED-CT code mapping, health indicator classification |
| Module | Path | Description |
|--------|------|-------------|
| Platform Manager | mirobody/pulse/ | Platform–Provider plugin architecture, data normalization to StandardPulseData |
| Theta Platform | mirobody/pulse/theta/ | Direct device integrations: Garmin, Whoop, Oura, Renpho, PostgreSQL |
| Apple Health | mirobody/pulse/apple/ | Apple Health import, CDA (Clinical Document Architecture) processing |
| Data Upload | mirobody/pulse/data_upload/ | StandardPulseData → th_series_data write pipeline |
| File Parser | mirobody/pulse/file_parser/ | Multi-format: PDF, CSV, Excel, audio, image, genetic data; LLM-powered indicator extraction |
| Aggregation | mirobody/pulse/core/aggregate_indicator/ | Series → daily summaries, derived metrics, sleep 18:00–18:00 window |
| Health Insights | mirobody/pulse/core/insight/ | AI-powered trend detection, anomaly analysis, pattern recipes (multi-signal, recovery, glucose) |
| Module | Path | Description |
|--------|------|-------------|
| Configuration | mirobody/utils/config/ | YAML + env var layered config, Fernet encryption, multi-storage backend (Local / S3 / Aliyun OSS) |
| Auth & User | mirobody/user/ | JWT, OAuth (Google / Apple), WebAuthn / FIDO2, email verification |
| Server | mirobody/server/ | Starlette ASGI, JWT middleware, rate limiting |
| Database | mirobody/utils/db.py | Async PostgreSQL (psycopg), Redis cache/session store |
| Directory | Purpose |
|-----------|---------|
| tools/ | Drop-in Python tools — auto-discovered as MCP tools |
| skills/ | Claude Agent Skills (SKILL.md + metadata.json) |
| agents/ | Custom agent implementations |
| providers/ | Custom Theta data providers |
| prompts/ | Jinja2 prompt templates |
| resources/ | Static resources (HTML, JSON) exposed via MCP |