Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: show projected death date with +LEV badge and fix lifestyle BMI validation

Adam Eivye34acb6e6f03
diff --git a/.changelog/v1.13.x.md b/.changelog/v1.13.x.md
index 187f3bb668..268631dd91 100644
--- a/.changelog/v1.13.x.md
+++ b/.changelog/v1.13.x.md
@@ -11,6 +11,14 @@ Redesigned MeatSpace overview as a compact grid dashboard surfacing all health d
- **MeatSpace overview dashboard redesign** — compact 3-row grid layout replacing the tall single-column stack: hero row with inline death clock countdown + LEV tracker, vitals row with age/remaining/healthy years, and 7 clickable health tiles (Alcohol, Body, Blood, Epigenetic, Eyes, Lifestyle, Data) that navigate to their respective tabs
- **Expanded data fetching** — overview now calls 6 endpoints in parallel (overview, alcohol, body, blood, epigenetic, eyes) to populate health tiles with live metrics
+## Improvements
+
+- **Death clock date + LEV badge** — overview countdown now shows the projected death date inline, with a green "+LEV" indicator when life expectancy exceeds longevity escape velocity
+
+## Fixes
+
+- **Lifestyle BMI validation** — `bmi: null` no longer causes validation error when saving lifestyle questionnaire (Zod schema now accepts `.nullable()`)
+
## Removed
- **Nutrition tracking** — removed NutritionTab component, sidebar nav item, page tab, API endpoints (`/meatspace/nutrition`, `/meatspace/nutrition/daily`), server service functions, and associated tests; sparse historical data was not being actively tracked
diff --git a/PLAN.md b/PLAN.md
index eda6c0ebbb..e85de352da 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -79,11 +79,38 @@ pm2 logs
- [ ] **M42 P5**: Unified Digital Twin Identity System - Cross-Insights Engine. See [Identity System](./docs/features/identity-system.md)
- [x] **M44 P1-P5**: MeatSpace - Health tracker with death clock, LEV 2045 tracker, alcohol logging, blood/body/epigenetic tracking, lifestyle questionnaire, TSV import, dashboard widget, compact grid overview
- [ ] **M44 P6**: MeatSpace - Genome/Epigenetic Migration from Digital Twin to MeatSpace
+- [ ] **M44 P7**: MeatSpace - Apple Health Integration (live sync via Health Auto Export app + bulk XML import)
---
## Planned Feature Details
+### M44 P7: Apple Health Integration
+
+Bring Apple Health data into MeatSpace via two complementary paths: live sync from the [Health Auto Export](https://apps.apple.com/us/app/health-auto-export-json-csv/id1115567069) iOS app (~$4) and bulk historical import from Apple Health XML exports.
+
+**Live Sync (Health Auto Export)**
+- `POST /api/health/ingest` — accepts Health Auto Export JSON payload (metrics, workouts, sleep, ECG, medications)
+- Validate payload with Zod, deduplicate by metric name + timestamp
+- Persist to `data/health/YYYY-MM-DD.json` (one file per day, append/merge)
+- Configure app to POST to `http://<tailscale-ip>:5554/api/health/ingest` on 15-60 min interval
+- Support custom auth header for basic request validation
+- 150+ metric types: steps, heart rate, HRV, VO2 max, sleep stages, blood pressure, workouts with GPS routes, etc.
+- Reference: [health-auto-export-server](https://github.com/HealthyApps/health-auto-export-server), [payload schema](https://github.com/Lybron/health-auto-export)
+
+**Bulk Historical Import (XML Export)**
+- `POST /api/health/import-xml` — accepts Apple Health export ZIP upload
+- Stream-parse `export.xml` using `xml-stream` (files can be 500MB+), extract records into same `data/health/YYYY-MM-DD.json` format
+- Progress reporting via WebSocket during import
+- Reference: [apple-health-parser](https://github.com/cvyl/apple-health-parser)
+
+**MeatSpace Dashboard Integration**
+- New dashboard cards for key Apple Health metrics (steps, heart rate, sleep, HRV trends)
+- Correlate with existing MeatSpace data (alcohol intake vs. HRV/sleep, blood work trends vs. activity)
+- Time-series charts with configurable date ranges
+
+*Touches: server/routes/health.js, server/services/healthIngest.js, MeatSpace UI, data/health/*
+
### Tier 1: Identity Integration (aligns with M42 direction)
- **Chronotype-Aware Scheduling** — Derive peak-focus windows from genome sleep markers; schedule deep-work tasks during peak hours, routine tasks during low-energy. Display energy curve on Schedule tab. *Touches: taskSchedule.js, genome.js, CoS Schedule tab*
diff --git a/client/src/components/meatspace/tabs/OverviewTab.jsx b/client/src/components/meatspace/tabs/OverviewTab.jsx
index a9ddd110fc..ef5c43bcf6 100644
--- a/client/src/components/meatspace/tabs/OverviewTab.jsx
+++ b/client/src/components/meatspace/tabs/OverviewTab.jsx
@@ -29,7 +29,7 @@ function HealthTile({ icon: Icon, iconColor, label, metrics, onClick }) {
);
}
-function CompactCountdown({ deathDate, lifeExpectancy, percentComplete }) {
+function CompactCountdown({ deathDate, lifeExpectancy, percentComplete, lev }) {
const countdown = useDeathClock(deathDate);
if (!countdown) {
@@ -52,7 +52,15 @@ function CompactCountdown({ deathDate, lifeExpectancy, percentComplete }) {
return (
<div>
- <h3 className="text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Time Remaining</h3>
+ <div className="flex items-baseline gap-2 mb-2">
+ <h3 className="text-xs font-medium text-gray-400 uppercase tracking-wider">Time Remaining</h3>
+ {deathDate && (
+ <span className="text-xs text-gray-500">
+ ({new Date(deathDate).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })})
+ {lev?.onTrack && <span className="text-port-success font-medium"> +LEV</span>}
+ </span>
+ )}
+ </div>
<div className="flex items-baseline gap-1 flex-wrap mb-3">
{units.map((u, i) => (
<span key={i} className="whitespace-nowrap">
@@ -212,6 +220,7 @@ export default function OverviewTab() {
deathDate={deathClock?.deathDate}
lifeExpectancy={deathClock?.lifeExpectancy}
percentComplete={deathClock?.percentComplete}
+ lev={lev}
/>
)}
</div>
diff --git a/package-lock.json b/package-lock.json
index 9260a87fa6..c4ee0fba90 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "portos",
- "version": "1.13.0",
+ "version": "1.13.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "portos",
- "version": "1.13.0",
+ "version": "1.13.1",
"license": "MIT",
"dependencies": {
"express": "^4.21.2",
diff --git a/package.json b/package.json
index e00f657cfb..73dbd62753 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "1.13.0",
+ "version": "1.13.1",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",
diff --git a/server/lib/meatspaceValidation.js b/server/lib/meatspaceValidation.js
index 9ea1dfd2ef..0ec4b59a80 100644
--- a/server/lib/meatspaceValidation.js
+++ b/server/lib/meatspaceValidation.js
@@ -15,7 +15,7 @@ export const lifestyleSchema = z.object({
sleepHoursPerNight: z.number().min(0).max(24).optional().default(7.5),
dietQuality: dietQualitySchema.optional().default('good'),
stressLevel: stressLevelSchema.optional().default('moderate'),
- bmi: z.number().min(10).max(80).optional(),
+ bmi: z.number().min(10).max(80).nullable().optional(),
chronicConditions: z.array(z.string().max(100)).optional().default([])
});