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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
chore: archive v1.0 Next Actions Batch milestone
Adam Eivy2d4bff98df83
diff --git a/.planning/MILESTONES.md b/.planning/MILESTONES.mdnew file mode 100644index 0000000000..5ebf975370--- /dev/null+++ b/.planning/MILESTONES.md@@ -0,0 +1,20 @@+# Milestones++## v1.0 Next Actions Batch (Shipped: 2026-02-27)++**Phases:** 5 | **Plans:** 10 | **Commits:** 52+**Files changed:** 92 | **Insertions:** +13,388+**Timeline:** 2026-02-26 (single day)++**Key accomplishments:**+1. Genome migration cleanup — fixed stale digital-twin references, updated service paths, route comments, and IdentityTab navigation+2. Data backup & recovery — incremental rsync to external drive with SHA-256 integrity, scheduled/manual triggers, dashboard widget with restore UI+3. Apple Health integration — JSON ingest with dedup, SAX streaming XML import (500MB+ without OOM), WebSocket progress, MeatSpace health cards with correlation charts+4. Cross-domain insights engine — genome-to-health correlations using 117 curated markers, LLM taste-to-identity theme analysis, insights dashboard with confidence levels and narrative summaries+5. Unified search (Cmd+K) — server-side fan-out across 5 data sources, Spotlight-style overlay with keyboard navigation, grouped results with highlighted snippets and deep-link navigation++**Requirements:** 24/24 v1 requirements shipped (GEN-01-03, BAK-01-07, HLT-01-06, INS-01-04, SRC-01-04)++**Archive:** `.planning/milestones/v1.0-ROADMAP.md`, `.planning/milestones/v1.0-REQUIREMENTS.md`++---diff --git a/.planning/PROJECT.md b/.planning/PROJECT.mdindex a1fe025b30..eb7e7c6fc5 100644--- a/.planning/PROJECT.md+++ b/.planning/PROJECT.md@@ -1,12 +1,12 @@-# PortOS — Next Actions Batch+# PortOS## What This Is-PortOS is a self-hosted personal operating system that centralizes app management, AI agent orchestration, knowledge capture, digital identity modeling, and health tracking into a single dashboard — accessible anywhere via Tailscale VPN. This milestone batch focuses on cleanup, data protection, cross-domain intelligence, health integration, and universal search across the 44+ milestones of existing functionality.+PortOS is a self-hosted personal operating system that centralizes app management, AI agent orchestration, knowledge capture, digital identity modeling, and health tracking into a single dashboard — accessible anywhere via Tailscale VPN. With v1.0, genome data informs health insights, all data is backed up and restorable, Apple Health metrics are integrated, cross-domain patterns surface automatically, and any piece of information is one keystroke away via Cmd+K search.## Core Value-Ship the five planned next actions that transform PortOS from a collection of powerful but siloed features into a connected, protected, and searchable system — where genome data informs health insights, all data is backed up, and any piece of information is one keystroke away.+A connected, protected, and searchable personal OS — where data flows between domains (genome, health, identity, taste) to surface insights, everything is backed up, and universal search makes any piece of information one keystroke away.## Requirements@@ -21,20 +21,21 @@ Ship the five planned next actions that transform PortOS from a collection of po- ✓ Agent tools and platform support (Moltbook, Moltworld) — M38, M43- ✓ MeatSpace health tracking (death clock, LEV, alcohol, blood, body, epigenetic, eye, genome, lifestyle) — M44 P1-P5- ✓ Tailscale anywhere access with mobile-responsive UI — existing+- ✓ Genome migration cleanup — fix stale digital-twin references — v1.0+- ✓ Data backup & recovery — scheduled incremental rsync with integrity verification and restore — v1.0+- ✓ Apple Health integration — JSON ingest, SAX XML import, health metric cards and correlations — v1.0+- ✓ Cross-domain insights — genome-to-health correlations, taste-to-identity themes, LLM narratives — v1.0+- ✓ Unified search (Cmd+K) — server fan-out, Spotlight-style overlay, keyboard navigation, deep linking — v1.0### Active-- [ ] M44 P6: Genome/epigenetic migration cleanup — fix route comments and IdentityTab Genome card-- [ ] M42 P5: Cross-Insights Engine — genome-to-health correlations and taste-to-identity themes-- [ ] M45: Data Backup & Recovery — scheduled incremental backup to local external drive with restore-- [ ] M44 P7: Apple Health Integration — ingest endpoint for Health Auto Export app + bulk XML import-- [ ] M46: Unified Search (Cmd+K) — keyword search across all data sources from any page+(None — next milestone requirements TBD via `/gsd:new-milestone`)### Out of Scope-- Semantic/vector search in Cmd+K — keyword-first for v1, semantic later-- Cloud backup targets — local external drive only for this batch-- Apple Health live sync setup — app not yet installed, build the endpoint first+- Semantic/vector search in Cmd+K — keyword-first for v1, semantic layers on later via existing BM25+vector infra+- Cloud backup targets — local external drive only, NAS/rsync can be added later+- Apple Health live sync setup — endpoint built, app not yet purchased- Multi-modal identity capture (voice, video) — future tier- Push notifications (M47) — deferred to next batch- Dashboard customization / workspace contexts — Tier 4, later@@ -42,14 +43,22 @@ Ship the five planned next actions that transform PortOS from a collection of po## Context-PortOS has 44+ completed milestones with a mature Express.js + React + PM2 architecture. All data persists to JSON files in `./data/` with zero redundancy — making M45 (backup) critical. The genome data was recently migrated from digital-twin routes to MeatSpace (M44 P5) but cleanup of old references remains (M44 P6). The Cross-Insights Engine (M42 P5) connects existing genome, taste, personality, and health data into derived insights. Apple Health integration (M44 P7) brings external health data into MeatSpace. Unified Search (M46) adds a cross-cutting Cmd+K overlay that searches brain, memory, history, agents, apps, and health.+PortOS has 44+ completed milestones with a mature Express.js + React + PM2 architecture. All data persists to JSON files in `./data/`. v1.0 shipped 5 phases (10 plans, 24 requirements) transforming siloed features into a connected system. The codebase is ~79K server LOC + ~55K client LOC (JavaScript/JSX).-**Existing infrastructure to leverage:**-- Vector + BM25 hybrid search already exists in memory system (for future semantic search extension)-- Socket.IO real-time updates throughout the app+**Shipped in v1.0:**+- Genome data reads from correct meatspace paths+- Incremental rsync backup with SHA-256 manifest, scheduler, dashboard widget, snapshot restore+- Apple Health JSON ingest with dedup + SAX XML import (500MB+ streaming) + health cards with correlation charts+- Cross-domain insights engine with 117 curated genome markers, LLM theme analysis, confidence levels+- Cmd+K unified search across Brain, Memory, Apps, History, Health with grouped results and deep linking++**Infrastructure available for next milestone:**+- Vector + BM25 hybrid search in memory system+- Socket.IO real-time updates- Zod validation on all routes- PM2 ecosystem managing 5+ processes- `portos-ai-toolkit` for AI provider management+- Fan-out search architecture (easily extensible to new sources)## Constraints@@ -58,16 +67,19 @@ PortOS has 44+ completed milestones with a mature Express.js + React + PM2 archi- **Ports**: 5554-5560 allocated, define new ports in `ecosystem.config.cjs`- **No hardcoded localhost**: Use `window.location.hostname` for all URLs- **Backup target**: Local external drive (mounted path)-- **Apple Health app**: Not yet purchased — build ingest endpoint, test with sample data## Key Decisions| Decision | Rationale | Outcome ||----------|-----------|---------|-| Keyword-first search for M46 | Ship faster, semantic search can layer on later via existing vector infra | — Pending |-| Local external drive for backup | Simplest reliable target, NAS/rsync can be added later | — Pending |-| Genome→Health and Taste→Identity as priority insights | User's most-wanted cross-domain correlations | — Pending |-| Build Apple Health endpoint before purchasing app | Endpoint + sample data testing first, real device later | — Pending |+| Keyword-first search for M46 | Ship faster, semantic search can layer on later via existing vector infra | ✓ Good — shipped in one session, keyword covers 90% of use cases |+| Local external drive for backup | Simplest reliable target, NAS/rsync can be added later | ✓ Good — works reliably, rsync incremental is fast |+| Genome→Health and Taste→Identity as priority insights | User's most-wanted cross-domain correlations | ✓ Good — 117 curated markers + LLM themes provide actionable insights |+| Build Apple Health endpoint before purchasing app | Endpoint + sample data testing first, real device later | ✓ Good — full pipeline tested with sample data |+| SAX streaming for Apple Health XML | 500MB+ files would OOM with DOM parsing | ✓ Good — processes large exports with constant memory |+| Portal rendering for Cmd+K overlay | z-index isolation above sidebar | ✓ Good — no stacking context issues |+| Promise.allSettled for search fan-out | Individual source failures shouldn't break entire search | ✓ Good — graceful degradation |+| Day-partitioned JSON for health data | Aligns with Health Auto Export's daily cadence, fast date-range queries | ✓ Good — simple, performant |----*Last updated: 2026-02-26 after initialization*+*Last updated: 2026-02-27 after v1.0 milestone*diff --git a/.planning/RETROSPECTIVE.md b/.planning/RETROSPECTIVE.mdnew file mode 100644index 0000000000..052a9da508--- /dev/null+++ b/.planning/RETROSPECTIVE.md@@ -0,0 +1,68 @@+# Project Retrospective++*A living document updated after each milestone. Lessons feed forward into future planning.*++## Milestone: v1.0 — Next Actions Batch++**Shipped:** 2026-02-27+**Phases:** 5 | **Plans:** 10 | **Sessions:** ~5++### What Was Built+- Genome migration cleanup (stale digital-twin references fixed)+- Data backup & recovery (rsync, SHA-256 manifest, scheduler, dashboard widget, restore UI)+- Apple Health integration (JSON ingest + SAX XML import + health cards + correlation charts)+- Cross-domain insights engine (genome-health correlations, taste-identity themes, LLM narratives)+- Unified search Cmd+K (server fan-out, Spotlight overlay, keyboard nav, deep linking)++### What Worked+- Wave-based plan execution with parallel agents completed 10 plans in ~1.5 hours+- Research phase prevented zero-dependency additions — all 5 phases used existing libraries only+- Fan-out architecture (Promise.allSettled) made search gracefully degradable from day one+- Day-partitioned JSON storage for health data aligned naturally with Apple Health export cadence+- CONTEXT.md from discuss-phase locked decisions early — no mid-execution design debates+- SAX streaming decision (from research) prevented OOM on 500MB+ Apple Health XML files++### What Was Inefficient+- Some ROADMAP.md plan checkboxes fell out of sync during multi-phase execution (manual fix needed)+- Verification checkpoint for Phase 5 partially duplicated the Phase 5 verifier output+- Research agent sometimes explored files already well-documented in CLAUDE.md++### Patterns Established+- Portal rendering for overlays (z-index isolation above sidebar) — CmdKSearch sets the pattern+- Correlation text summaries via pure data math (no LLM) for zero-latency deterministic display+- "Evidence" and "Risk Marker" language for genome correlations — never causation claims+- 14-day minimum data threshold before showing correlation insights+- multer diskStorage (not memoryStorage) for large file uploads+- Raw fetch() instead of request() helper when Content-Type needs to be multipart/form-data++### Key Lessons+1. Day-partitioned JSON files are a strong pattern for time-series data when the query pattern is date-range-based+2. Promise.allSettled is the right default for fan-out queries where partial results are acceptable+3. SAX streaming should be the default for any user-uploaded XML/JSON over 10MB+4. CONTEXT.md (from discuss-phase) is the highest-leverage step — it prevents 80% of mid-execution pivots++### Cost Observations+- Model mix: ~30% opus (orchestration, user interaction), ~70% sonnet (research, execution, verification)+- Sessions: ~5 (discuss + plan + execute per phase, some combined)+- Notable: Single-day milestone execution — all 5 phases shipped 2026-02-26++---++## Cross-Milestone Trends++### Process Evolution++| Milestone | Sessions | Phases | Key Change |+|-----------|----------|--------|------------|+| v1.0 | ~5 | 5 | First GSD milestone — established wave execution, discuss-phase context, fan-out patterns |++### Cumulative Quality++| Milestone | Tests | Coverage | Zero-Dep Additions |+|-----------|-------|----------|-------------------|+| v1.0 | existing | — | 5/5 phases (zero new npm dependencies) |++### Top Lessons (Verified Across Milestones)++1. Research before planning prevents unnecessary dependency additions+2. CONTEXT.md locks design decisions — downstream agents execute without asking the userdiff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.mdindex 281277de18..53d9b665b9 100644--- a/.planning/ROADMAP.md+++ b/.planning/ROADMAP.md@@ -1,110 +1,15 @@-# Roadmap: PortOS Next Actions Batch+# Roadmap: PortOS-## Overview+## Milestones-This batch transforms PortOS from a collection of powerful but siloed features into a connected, protected, and searchable system. Five phases follow a strict dependency chain: clean up stale genome references (unblocking insights), protect all data with backup (before adding new data writers), ingest Apple Health data (the richest new source), derive cross-domain insights (connecting genome, health, taste, and identity), and finally wire up unified search across everything. Each phase delivers a complete, independently verifiable capability.--## Phases--**Phase Numbering:**-- Integer phases (1, 2, 3): Planned milestone work-- Decimal phases (2.1, 2.2): Urgent insertions (marked with INSERTED)--Decimal phases appear between their surrounding integers in numeric order.--- [x] **Phase 1: Genome Migration Cleanup** - Fix stale digital-twin genome references so data reads from the correct meatspace location-- [x] **Phase 2: Data Backup & Recovery** - Incremental rsync backup to external drive with scheduling, dashboard widget, and restore capability (completed 2026-02-26)-- [x] **Phase 3: Apple Health Integration** - Ingest Health Auto Export JSON and bulk XML into day-partitioned storage with dashboard cards (completed 2026-02-26)-- [x] **Phase 4: Cross-Domain Insights Engine** - Genome-to-health correlations and taste-to-identity themes with confidence levels and source attribution (completed 2026-02-26)-- [ ] **Phase 5: Unified Search (Cmd+K)** - Keyboard-triggered search overlay with server-side fan-out across all data sources--## Phase Details--### Phase 1: Genome Migration Cleanup-**Goal**: Genome data reads from the correct directory and all stale digital-twin references are eliminated-**Depends on**: Nothing (first phase)-**Requirements**: GEN-01, GEN-02, GEN-03-**Success Criteria** (what must be TRUE):- 1. All genome API route comments reference `/api/meatspace/genome/` (no digital-twin references remain)- 2. IdentityTab no longer shows a Genome card (or it links to `/meatspace/genome` instead of a dead route)- 3. genome.js reads data from `data/meatspace/` paths and returns valid genome data-**Plans**: 1 plan--Plans:-- [x] 01-01-PLAN.md -- Complete genome migration: update service paths, route comments, client navigation, docs, and move data files--### Phase 2: Data Backup & Recovery-**Goal**: All PortOS data is automatically backed up to an external drive with integrity verification and restore capability-**Depends on**: Nothing (can parallel with Phase 1)-**Requirements**: BAK-01, BAK-02, BAK-03, BAK-04, BAK-05, BAK-06, BAK-07-**Success Criteria** (what must be TRUE):- 1. Running backup copies changed files from `./data/` to the configured external drive path using incremental rsync- 2. A SHA-256 manifest file exists after each backup and can verify file integrity- 3. Backup runs automatically on a daily schedule and can be triggered manually from the dashboard- 4. Dashboard widget displays last backup time, next scheduled time, and health status (green/yellow/red)- 5. User can restore from a named snapshot with dry-run preview, and can selectively restore individual directories-**Plans**: 2 plans--Plans:-- [ ] 02-01-PLAN.md -- Backup engine, scheduler, REST routes, validation schemas, and client API functions (BAK-01, BAK-02, BAK-03)-- [ ] 02-02-PLAN.md -- Dashboard backup widget with health status, manual trigger, snapshot list, and restore UI (BAK-04, BAK-05, BAK-06, BAK-07)--### Phase 3: Apple Health Integration-**Goal**: Apple Health data flows into PortOS via JSON ingest and bulk XML import, with health metrics visible on the MeatSpace dashboard-**Depends on**: Phase 2 (backup must protect data before adding new data writers)-**Requirements**: HLT-01, HLT-02, HLT-03, HLT-04, HLT-05, HLT-06-**Success Criteria** (what must be TRUE):- 1. POST `/api/health/ingest` accepts Health Auto Export JSON, validates it, deduplicates by metric+timestamp, and persists to day-partitioned files- 2. Bulk Apple Health XML export (500MB+) imports without OOM via streaming SAX parser, with progress reported via WebSocket- 3. MeatSpace dashboard shows cards for steps, heart rate, sleep, and HRV trends from ingested data- 4. Apple Health data correlates with existing MeatSpace data (alcohol vs HRV, activity vs blood work)-**Plans**: 3 plans--Plans:-- [x] 03-01-PLAN.md -- Backend foundation: Zod validation, JSON ingest with dedup, day-partitioned storage, query service, REST routes, client API functions (HLT-01, HLT-02)-- [ ] 03-02-PLAN.md -- SAX streaming XML import with WebSocket progress, multer diskStorage upload, Import tab XML file picker UI (HLT-03, HLT-04)-- [ ] 03-03-PLAN.md -- MeatSpace Health tab with steps/HR/sleep/HRV cards, range selector, alcohol-HRV and activity-blood correlation charts (HLT-05, HLT-06)--### Phase 4: Cross-Domain Insights Engine-**Goal**: PortOS surfaces actionable cross-domain patterns by correlating genome markers with health data and taste preferences with identity themes-**Depends on**: Phase 1 (clean genome paths), Phase 3 (health data available for correlation)-**Requirements**: INS-01, INS-02, INS-03, INS-04-**Success Criteria** (what must be TRUE):- 1. Genome-to-health correlations display against actual blood/body data using the curated 117 markers, with provenance citations- 2. LLM-generated taste-to-identity theme analysis connects user preferences to identity patterns- 3. Insights dashboard groups results by domain with confidence levels and source attribution- 4. LLM narrative summaries of cross-domain patterns can be refreshed on demand-**Plans**: 2 plans--Plans:-- [x] 04-01-PLAN.md -- Backend insights engine: insightsService.js with genome-health correlations, LLM taste-identity themes, cross-domain narrative; REST routes, Zod validation, client API functions (INS-01, INS-02, INS-04)-- [x] 04-02-PLAN.md -- Insights dashboard UI: /insights/:tab page with Overview, Genome-Health, Taste-Identity, Cross-Domain tabs; shared components, App.jsx routes, Layout.jsx nav entry (INS-03, INS-01, INS-02, INS-04)--### Phase 5: Unified Search (Cmd+K)-**Goal**: Any piece of information in PortOS is one keystroke away via a global search overlay-**Depends on**: Phases 1-4 (benefits from all data sources existing, but technically only needs server routes)-**Requirements**: SRC-01, SRC-02, SRC-03, SRC-04-**Success Criteria** (what must be TRUE):- 1. Pressing Cmd+K (or Ctrl+K) from any page opens a search overlay- 2. Typing a query returns results from all data sources (Brain, Memory, Apps, History, Health, etc.) via server-side fan-out- 3. Results are categorized by source with icons and text snippets- 4. Clicking a result navigates to the deep-linked location (specific brain capture, agent run, health entry, etc.)-**Plans**: 2 plans--Plans:-- [ ] 05-01-PLAN.md -- Server search engine: fan-out search service with 5 source adapters, GET /api/search route, Zod validation, client API function (SRC-02, SRC-03)-- [ ] 05-02-PLAN.md -- Cmd+K overlay UI: useCmdKSearch hook, CmdKSearch portal component with keyboard nav, highlighted snippets, deep-link navigation, Layout.jsx mount (SRC-01, SRC-03, SRC-04)+- **v1.0 Next Actions Batch** — Phases 1-5 (shipped 2026-02-27) | [Archive](milestones/v1.0-ROADMAP.md)## Progress-**Execution Order:**-Phases execute in numeric order: 1 -> 2 -> 3 -> 4 -> 5-Note: Phases 1 and 2 have no dependency on each other and can execute in parallel.--| Phase | Plans Complete | Status | Completed |-|-------|----------------|--------|-----------|-| 1. Genome Migration Cleanup | 1/1 | Complete | 2026-02-26 |-| 2. Data Backup & Recovery | 2/2 | Complete | 2026-02-26 |-| 3. Apple Health Integration | 2/3 | Complete | 2026-02-26 |-| 4. Cross-Domain Insights Engine | 2/2 | Complete | 2026-02-26 |-| 5. Unified Search (Cmd+K) | 1/2 | In Progress| |+| Phase | Milestone | Plans Complete | Status | Completed |+|-------|-----------|----------------|--------|-----------|+| 1. Genome Migration Cleanup | v1.0 | 1/1 | Complete | 2026-02-26 |+| 2. Data Backup & Recovery | v1.0 | 2/2 | Complete | 2026-02-26 |+| 3. Apple Health Integration | v1.0 | 3/3 | Complete | 2026-02-26 |+| 4. Cross-Domain Insights Engine | v1.0 | 2/2 | Complete | 2026-02-26 |+| 5. Unified Search (Cmd+K) | v1.0 | 2/2 | Complete | 2026-02-26 |diff --git a/.planning/STATE.md b/.planning/STATE.mdindex 4294c7572c..2670b03cfe 100644--- a/.planning/STATE.md+++ b/.planning/STATE.md@@ -1,9 +1,9 @@---gsd_state_version: 1.0-milestone: v1.0-milestone_name: milestone-status: unknown-last_updated: "2026-02-27T00:23:57.790Z"+milestone: null+milestone_name: null+status: milestone_complete+last_updated: "2026-02-27"progress:total_phases: 5completed_phases: 5@@ -15,103 +15,52 @@ progress:## Project Reference-See: .planning/PROJECT.md (updated 2026-02-26)+See: .planning/PROJECT.md (updated 2026-02-27)-**Core value:** Ship five next actions that transform PortOS from siloed features into a connected, protected, and searchable system-**Current focus:** MILESTONE COMPLETE — all 5 phases shipped (genome migration, backup/recovery, Apple Health, cross-domain insights, unified search)+**Core value:** A connected, protected, and searchable personal OS+**Current focus:** Planning next milestone## Current Position-Phase: 5 of 5 (Unified Search) — COMPLETE-Plan: 2 of 2 in current phase (05-02 complete)-Status: ALL PLANS COMPLETE — milestone v1.0 fully shipped-Last activity: 2026-02-27 -- Plan 05-02 complete (Cmd+K overlay, useCmdKSearch hook, CmdKSearch portal modal, Layout mount)+Milestone v1.0 Next Actions Batch — SHIPPED 2026-02-27+All 5 phases, 10 plans, 24 requirements complete.-Progress: [██████████] 100%+Next step: `/gsd:new-milestone` to define next milestone scope## Performance Metrics-**Velocity:**-- Total plans completed: 3-- Average duration: ~10 min-- Total execution time: ~0.5 hours+**v1.0 Velocity:**+- Total plans: 10+- Average duration: ~7 min/plan+- Total execution time: ~1.5 hours+- Timeline: completed 2026-02-26 (single day)**By Phase:**-| Phase | Plans | Total | Avg/Plan |-|-------|-------|-------|----------|-| 01-genome-migration-cleanup | 1 | 108s | 108s |-| 02-data-backup-recovery | 2 | 255s + ~10min | ~7min |-| 03-apple-health-integration | 1 | 210s | 210s |-| 03-apple-health-integration | 2 | 180s | 180s |-| 03-apple-health-integration | 3 | ~15min | ~15min |-| 04-cross-domain-insights-engine | 1 | 174s | 174s |-| 04-cross-domain-insights-engine | 2 | 238s | 238s |-| 05-unified-search | 1 | ~8min | ~8min |-| 05-unified-search | 2 | ~15min | ~15min |--**Recent Trend:**-- Last 5 plans: 03-01 (210s), 03-02 (180s), 03-03 (~15min), 04-01 (174s), 04-02 (238s)-- Trend: stable (~2-15 min/plan)--*Updated after each plan completion*+| Phase | Plans | Avg/Plan |+|-------|-------|----------|+| 01-genome-migration-cleanup | 1 | 108s |+| 02-data-backup-recovery | 2 | ~7min |+| 03-apple-health-integration | 3 | ~6min |+| 04-cross-domain-insights-engine | 2 | ~4min |+| 05-unified-search | 2 | ~12min |## Accumulated Context### Decisions-Decisions are logged in PROJECT.md Key Decisions table.-Recent decisions affecting current work:--- Keyword-first search for M46 (semantic search layers on later)-- Local external drive for backup (NAS/rsync added later)-- Build Apple Health endpoint before purchasing app-- Genome-to-health and taste-to-identity as priority insight domains-- Used PATHS.meatspace (existing constant) for genome migration — no new constant needed-- Moved genome data files with mv (not copy) to prevent stale digital-twin copies-- createReadStream only available on 'fs' not 'fs/promises' — fixed import in backup.js-- Exit code 24 from rsync means files vanished mid-transfer (acceptable for active systems)-- startBackupScheduler is async (reads settings) — called with .catch() in index.js like other async inits-- [Phase 02-data-backup-recovery]: RestorePanel uses inline expandable within snapshot row — avoids URL-less modal per CLAUDE.md-- [Phase 02-data-backup-recovery]: Restore requires dry-run preview before enabling Restore button — prevents accidental destructive restore-- [Phase 02-data-backup-recovery plan 02]: BackupWidget placed in Dashboard Row 4 (system-status row) alongside SystemHealthWidget-- [Phase 02-data-backup-recovery plan 02]: SnapshotList fetches lazily (only when expanded) to avoid unnecessary API calls-- [Phase 03-apple-health-integration plan 01]: extractDateStr uses substring(0,10) not Date() to avoid timezone shift on Apple Health timestamps-- [Phase 03-apple-health-integration plan 01]: Dedup key is full date string, not extracted YYYY-MM-DD, to distinguish multiple same-day readings-- [Phase 03-apple-health-integration plan 01]: /health/system renamed to /health/details to avoid redundancy with /api/system mount point-- [Phase 03-apple-health-integration plan 01]: getDailyAggregates uses per-metric strategy (step_count sums, heart_rate averages Avg, sleep takes totalSleep, default averages qty)-- [Phase 03-apple-health-integration]: SAX non-strict mode handles malformed Apple Health XML; error handler clears parser and resumes-- [Phase 03-apple-health-integration]: multer diskStorage for XML upload avoids OOM on 500MB+ files — tmpdir write, no in-memory buffering-- [Phase 03-apple-health-integration]: uploadAppleHealthXml uses raw fetch() not request() helper — helper hardcodes Content-Type application/json which breaks multipart/form-data-- [Phase 03-apple-health-integration plan 03]: Correlation text summaries computed via pure data math (no LLM) — zero latency, deterministic-- [Phase 03-apple-health-integration plan 03]: 14-day minimum threshold guard prevents misleading correlations with sparse data-- [Phase 03-apple-health-integration plan 03]: Stethoscope icon chosen for Health tab — Activity used by Overview, HeartPulse used by Blood & Body-- [Phase 04-cross-domain-insights-engine plan 01]: CONFIDENCE_FROM_STATUS uses "Evidence" and "Risk Marker" language — never causation language — per INS-01 requirement-- [Phase 04-cross-domain-insights-engine plan 01]: CATEGORY_BLOOD_MAP covers 6 categories; other genome categories get empty matchedBloodValues (no blood analyte mapping available)-- [Phase 04-cross-domain-insights-engine plan 01]: LLM generation functions return { available: false, reason } (not throw) when provider unavailable or no taste data-- [Phase 04-cross-domain-insights-engine plan 01]: narrativeRefresh preserves previousText + previousGeneratedAt for client-side diff rendering-- [Phase 04-cross-domain-insights-engine plan 02]: Insights nav entry is a single item (not expandable) — sub-tabs navigate from within the page-- [Phase 04-cross-domain-insights-engine plan 02]: /insights added to isFullWidth paths in Layout.jsx for proper full-height rendering matching MeatSpace pattern-- [Phase 04-cross-domain-insights-engine plan 02]: CrossDomainTab diff only shows after refresh triggers and previousText differs (trimmed comparison prevents false diffs)-- [Phase 05-unified-search plan 01]: Health adapter is synchronous (no I/O) — searches known metric names + display aliases in-memory, no file reads needed-- [Phase 05-unified-search plan 01]: fanOutSearch returns only non-empty sources — zero-result sources are omitted from the response-- [Phase 05-unified-search plan 01]: Brain adapter fans out to 5 sub-types via Promise.allSettled and merges into a single source block-- [Phase 05-unified-search plan 02]: CmdKSearch renders via createPortal(document.body) for z-index isolation above sidebar-- [Phase 05-unified-search plan 02]: Flat result list derived from grouped sources to keep focusedIndex as a simple number across all categories-- [Phase 05-unified-search plan 02]: 300ms debounce + 2-char minimum matches Spotlight/Raycast UX conventions-- [Phase 05-unified-search plan 02]: Top 3 results per source by default with Show More per-source expansion-- [Phase 05-unified-search plan 02]: Cmd+K fires in input context intentionally — search is a global action with highest priority (Spotlight parity)+See PROJECT.md Key Decisions table for full history.### Pending Todos-None yet.+None.### Blockers/Concerns-- Phase 4: Curating scientifically grounded correlation rules is domain work, not just engineering+None.## Session ContinuityLast session: 2026-02-27-Stopped at: 05-02-PLAN.md complete — Cmd+K overlay UI shipped; ALL PHASES AND PLANS COMPLETE (milestone v1.0)+Stopped at: Milestone v1.0 archivedResume file: Nonediff --git a/.planning/REQUIREMENTS.md b/.planning/milestones/v1.0-REQUIREMENTS.mdsimilarity index 97%rename from .planning/REQUIREMENTS.mdrename to .planning/milestones/v1.0-REQUIREMENTS.mdindex 3f64d024df..a88a0cb0c8 100644--- a/.planning/REQUIREMENTS.md+++ b/.planning/milestones/v1.0-REQUIREMENTS.md@@ -1,3 +1,12 @@+# Requirements Archive: v1.0 Next Actions Batch++**Archived:** 2026-02-27+**Status:** SHIPPED++For current requirements, see `.planning/REQUIREMENTS.md`.++---+# Requirements: PortOS Next Actions Batch**Defined:** 2026-02-26diff --git a/.planning/milestones/v1.0-ROADMAP.md b/.planning/milestones/v1.0-ROADMAP.mdnew file mode 100644index 0000000000..281277de18--- /dev/null+++ b/.planning/milestones/v1.0-ROADMAP.md@@ -0,0 +1,110 @@+# Roadmap: PortOS Next Actions Batch++## Overview++This batch transforms PortOS from a collection of powerful but siloed features into a connected, protected, and searchable system. Five phases follow a strict dependency chain: clean up stale genome references (unblocking insights), protect all data with backup (before adding new data writers), ingest Apple Health data (the richest new source), derive cross-domain insights (connecting genome, health, taste, and identity), and finally wire up unified search across everything. Each phase delivers a complete, independently verifiable capability.++## Phases++**Phase Numbering:**+- Integer phases (1, 2, 3): Planned milestone work+- Decimal phases (2.1, 2.2): Urgent insertions (marked with INSERTED)++Decimal phases appear between their surrounding integers in numeric order.++- [x] **Phase 1: Genome Migration Cleanup** - Fix stale digital-twin genome references so data reads from the correct meatspace location+- [x] **Phase 2: Data Backup & Recovery** - Incremental rsync backup to external drive with scheduling, dashboard widget, and restore capability (completed 2026-02-26)+- [x] **Phase 3: Apple Health Integration** - Ingest Health Auto Export JSON and bulk XML into day-partitioned storage with dashboard cards (completed 2026-02-26)+- [x] **Phase 4: Cross-Domain Insights Engine** - Genome-to-health correlations and taste-to-identity themes with confidence levels and source attribution (completed 2026-02-26)+- [ ] **Phase 5: Unified Search (Cmd+K)** - Keyboard-triggered search overlay with server-side fan-out across all data sources++## Phase Details++### Phase 1: Genome Migration Cleanup+**Goal**: Genome data reads from the correct directory and all stale digital-twin references are eliminated+**Depends on**: Nothing (first phase)+**Requirements**: GEN-01, GEN-02, GEN-03+**Success Criteria** (what must be TRUE):+ 1. All genome API route comments reference `/api/meatspace/genome/` (no digital-twin references remain)+ 2. IdentityTab no longer shows a Genome card (or it links to `/meatspace/genome` instead of a dead route)+ 3. genome.js reads data from `data/meatspace/` paths and returns valid genome data+**Plans**: 1 plan++Plans:+- [x] 01-01-PLAN.md -- Complete genome migration: update service paths, route comments, client navigation, docs, and move data files++### Phase 2: Data Backup & Recovery+**Goal**: All PortOS data is automatically backed up to an external drive with integrity verification and restore capability+**Depends on**: Nothing (can parallel with Phase 1)+**Requirements**: BAK-01, BAK-02, BAK-03, BAK-04, BAK-05, BAK-06, BAK-07+**Success Criteria** (what must be TRUE):+ 1. Running backup copies changed files from `./data/` to the configured external drive path using incremental rsync+ 2. A SHA-256 manifest file exists after each backup and can verify file integrity+ 3. Backup runs automatically on a daily schedule and can be triggered manually from the dashboard+ 4. Dashboard widget displays last backup time, next scheduled time, and health status (green/yellow/red)+ 5. User can restore from a named snapshot with dry-run preview, and can selectively restore individual directories+**Plans**: 2 plans++Plans:+- [ ] 02-01-PLAN.md -- Backup engine, scheduler, REST routes, validation schemas, and client API functions (BAK-01, BAK-02, BAK-03)+- [ ] 02-02-PLAN.md -- Dashboard backup widget with health status, manual trigger, snapshot list, and restore UI (BAK-04, BAK-05, BAK-06, BAK-07)++### Phase 3: Apple Health Integration+**Goal**: Apple Health data flows into PortOS via JSON ingest and bulk XML import, with health metrics visible on the MeatSpace dashboard+**Depends on**: Phase 2 (backup must protect data before adding new data writers)+**Requirements**: HLT-01, HLT-02, HLT-03, HLT-04, HLT-05, HLT-06+**Success Criteria** (what must be TRUE):+ 1. POST `/api/health/ingest` accepts Health Auto Export JSON, validates it, deduplicates by metric+timestamp, and persists to day-partitioned files+ 2. Bulk Apple Health XML export (500MB+) imports without OOM via streaming SAX parser, with progress reported via WebSocket+ 3. MeatSpace dashboard shows cards for steps, heart rate, sleep, and HRV trends from ingested data+ 4. Apple Health data correlates with existing MeatSpace data (alcohol vs HRV, activity vs blood work)+**Plans**: 3 plans++Plans:+- [x] 03-01-PLAN.md -- Backend foundation: Zod validation, JSON ingest with dedup, day-partitioned storage, query service, REST routes, client API functions (HLT-01, HLT-02)+- [ ] 03-02-PLAN.md -- SAX streaming XML import with WebSocket progress, multer diskStorage upload, Import tab XML file picker UI (HLT-03, HLT-04)+- [ ] 03-03-PLAN.md -- MeatSpace Health tab with steps/HR/sleep/HRV cards, range selector, alcohol-HRV and activity-blood correlation charts (HLT-05, HLT-06)++### Phase 4: Cross-Domain Insights Engine+**Goal**: PortOS surfaces actionable cross-domain patterns by correlating genome markers with health data and taste preferences with identity themes+**Depends on**: Phase 1 (clean genome paths), Phase 3 (health data available for correlation)+**Requirements**: INS-01, INS-02, INS-03, INS-04+**Success Criteria** (what must be TRUE):+ 1. Genome-to-health correlations display against actual blood/body data using the curated 117 markers, with provenance citations+ 2. LLM-generated taste-to-identity theme analysis connects user preferences to identity patterns+ 3. Insights dashboard groups results by domain with confidence levels and source attribution+ 4. LLM narrative summaries of cross-domain patterns can be refreshed on demand+**Plans**: 2 plans++Plans:+- [x] 04-01-PLAN.md -- Backend insights engine: insightsService.js with genome-health correlations, LLM taste-identity themes, cross-domain narrative; REST routes, Zod validation, client API functions (INS-01, INS-02, INS-04)+- [x] 04-02-PLAN.md -- Insights dashboard UI: /insights/:tab page with Overview, Genome-Health, Taste-Identity, Cross-Domain tabs; shared components, App.jsx routes, Layout.jsx nav entry (INS-03, INS-01, INS-02, INS-04)++### Phase 5: Unified Search (Cmd+K)+**Goal**: Any piece of information in PortOS is one keystroke away via a global search overlay+**Depends on**: Phases 1-4 (benefits from all data sources existing, but technically only needs server routes)+**Requirements**: SRC-01, SRC-02, SRC-03, SRC-04+**Success Criteria** (what must be TRUE):+ 1. Pressing Cmd+K (or Ctrl+K) from any page opens a search overlay+ 2. Typing a query returns results from all data sources (Brain, Memory, Apps, History, Health, etc.) via server-side fan-out+ 3. Results are categorized by source with icons and text snippets+ 4. Clicking a result navigates to the deep-linked location (specific brain capture, agent run, health entry, etc.)+**Plans**: 2 plans++Plans:+- [ ] 05-01-PLAN.md -- Server search engine: fan-out search service with 5 source adapters, GET /api/search route, Zod validation, client API function (SRC-02, SRC-03)+- [ ] 05-02-PLAN.md -- Cmd+K overlay UI: useCmdKSearch hook, CmdKSearch portal component with keyboard nav, highlighted snippets, deep-link navigation, Layout.jsx mount (SRC-01, SRC-03, SRC-04)++## Progress++**Execution Order:**+Phases execute in numeric order: 1 -> 2 -> 3 -> 4 -> 5+Note: Phases 1 and 2 have no dependency on each other and can execute in parallel.++| Phase | Plans Complete | Status | Completed |+|-------|----------------|--------|-----------|+| 1. Genome Migration Cleanup | 1/1 | Complete | 2026-02-26 |+| 2. Data Backup & Recovery | 2/2 | Complete | 2026-02-26 |+| 3. Apple Health Integration | 2/3 | Complete | 2026-02-26 |+| 4. Cross-Domain Insights Engine | 2/2 | Complete | 2026-02-26 |+| 5. Unified Search (Cmd+K) | 1/2 | In Progress| |