Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
eb4a754
docs: refresh roadmap and add Health & Longevity as core goal
atomantic Feb 26, 2026
92afb72
feat: add Update action to App Manager
atomantic Feb 26, 2026
a91bc7d
docs: map existing codebase
atomantic Feb 26, 2026
ae348dd
docs: initialize project
atomantic Feb 26, 2026
b7720fd
chore: add project config
atomantic Feb 26, 2026
6de3431
docs: complete project research for next actions batch
atomantic Feb 26, 2026
45b7269
docs: define v1 requirements
atomantic Feb 26, 2026
b4c25f2
docs: create roadmap (5 phases)
atomantic Feb 26, 2026
a52cbcc
docs(01): research phase genome migration cleanup
atomantic Feb 26, 2026
f8f0143
docs(01-genome-migration-cleanup): create phase plan
atomantic Feb 26, 2026
6503b70
fix(01-01): update genome service paths from digitalTwin to meatspace
atomantic Feb 26, 2026
912946f
fix(01-01): update client navigation and docs to meatspace genome paths
atomantic Feb 26, 2026
6a06375
docs(01-01): complete genome migration cleanup plan
atomantic Feb 26, 2026
bee0e24
docs(phase-1): complete phase execution
atomantic Feb 26, 2026
d08c6d6
docs(02): research phase data-backup-recovery
atomantic Feb 26, 2026
7700e0b
docs(02-data-backup-recovery): create phase plan
atomantic Feb 26, 2026
8a01c2b
feat(02-01): add backup service and scheduler
atomantic Feb 26, 2026
523ffd7
feat(02-01): add backup routes, validation schemas, and client API fu…
atomantic Feb 26, 2026
84466da
docs(02-01): complete backup engine plan - summary, state, roadmap, r…
atomantic Feb 26, 2026
516c7c7
feat(02-02): add BackupWidget to Dashboard
atomantic Feb 26, 2026
e0985c2
docs(02-02): complete BackupWidget plan — awaiting human verification
atomantic Feb 26, 2026
fa91a4f
docs(02-02): complete BackupWidget plan — human verification approved
atomantic Feb 26, 2026
c757e94
docs(phase-2): complete phase execution
atomantic Feb 26, 2026
a32e189
docs(03): capture phase context
atomantic Feb 26, 2026
95c1e0f
docs(03): research phase domain
atomantic Feb 26, 2026
a6daeb9
docs(03-apple-health-integration): create phase plan
atomantic Feb 26, 2026
f3b267a
docs(03): create phase plans with verification fixes
atomantic Feb 26, 2026
7c2a592
feat(03-01): rename system health routes to free /api/health namespace
atomantic Feb 26, 2026
200a0d2
feat(03-01): create Apple Health validation schemas and ingest service
atomantic Feb 26, 2026
2cd855f
feat(03-01): create Apple Health query service, REST routes, and clie…
atomantic Feb 26, 2026
acf13a6
docs(05): capture phase context
atomantic Feb 26, 2026
c526d40
docs(03-01): complete Apple Health ingest pipeline plan
atomantic Feb 26, 2026
0eb6f0b
docs(04): capture phase context
atomantic Feb 26, 2026
11cc0ea
feat(03-03): create four health metric cards and HealthTab container
atomantic Feb 26, 2026
8967415
feat(03-02): add SAX streaming XML import service and POST /import/xm…
atomantic Feb 26, 2026
a4b2d20
feat(03-02): replace Apple Health placeholder with working XML import UI
atomantic Feb 26, 2026
81bd182
feat(03-03): create correlation charts and wire Health tab into MeatS…
atomantic Feb 26, 2026
264b5ec
docs(03-02): complete Apple Health XML import plan — checkpoint await…
atomantic Feb 26, 2026
d50d009
docs(04): research phase domain
atomantic Feb 26, 2026
1876723
docs(03-02): complete Apple Health XML import plan — checkpoint approved
atomantic Feb 26, 2026
a0e876e
docs(04-cross-domain-insights-engine): create phase plan
atomantic Feb 26, 2026
e907cc7
docs(05): research phase domain
atomantic Feb 26, 2026
30b9e80
docs(phase-3): complete phase execution
atomantic Feb 26, 2026
ff11610
docs(05-unified-search): create phase plan
atomantic Feb 26, 2026
0f20b69
feat(04-01): create insightsService.js with genome-health correlation…
atomantic Feb 26, 2026
e4dc2be
feat(04-01): create insights routes, Zod validation, mount in index.j…
atomantic Feb 26, 2026
4bf0749
docs(04-01): complete insights engine backend plan
atomantic Feb 26, 2026
832c561
feat(04-02): install react-diff-viewer-continued and create shared in…
atomantic Feb 26, 2026
4cd9ee9
feat(04-02): create Insights page with 4 tabs, wire App.jsx routes an…
atomantic Feb 26, 2026
b02efaf
docs(04-02): complete Insights dashboard plan — awaiting human verifi…
atomantic Feb 26, 2026
226b850
feat(05-01): create unified search service with fan-out adapters
atomantic Feb 27, 2026
ea077ee
feat(05-01): add search route, schema, index registration, and client…
atomantic Feb 27, 2026
b70d4cd
docs(05-01): complete unified search server foundation plan
atomantic Feb 27, 2026
8cdbee1
feat(05-02): create Cmd+K search hook and overlay component
atomantic Feb 27, 2026
22484ed
feat(05-02): mount CmdKSearch in Layout.jsx
atomantic Feb 27, 2026
615933c
docs(05-02): complete Cmd+K search overlay plan
atomantic Feb 27, 2026
586afd2
docs(04-02): complete Insights dashboard plan — human verification ap…
atomantic Feb 27, 2026
456b344
fix(04): add available:true to theme/narrative cache-hit returns
atomantic Feb 27, 2026
e1d0c16
docs(phase-4): complete phase execution
atomantic Feb 27, 2026
52ebf56
docs(phase-5): complete phase execution
atomantic Feb 27, 2026
2d4bff9
chore: archive v1.0 Next Actions Batch milestone
atomantic Feb 27, 2026
241c11f
chore: fix milestone version label v1.0 → v1.14
atomantic Feb 27, 2026
20fe4f9
feat(meatspace): add Import tab with JSON upload and fix HRV metric n…
atomantic Feb 27, 2026
f6c1652
fix: remove duplicate XML metric mapping key and bump to v1.14.2
atomantic Feb 27, 2026
aba6bb7
fix: strip CLAUDECODE env var from spawned CLI processes
atomantic Feb 27, 2026
eadc3c4
address review: validate backup destPath, bound command output, guard…
atomantic Feb 27, 2026
e7a4b1e
address review: fix CLAUDECODE env stripping, add update lock, icons/…
atomantic Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changelog/v1.13.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Release v1.13.x - Changelog

Released: YYYY-MM-DD

## Overview

Roadmap and goals refresh — added Health & Longevity as a core goal, defined M45-M47, cleaned up completed milestones and stale backlog items.

## Features

- **App Manager: Update action** — new "Update" button in Quick Actions that runs a full update cycle: git pull (rebase + autostash), npm install for each subdir with a package.json (root/client/server), npm run setup if present, and PM2 restart. Available via REST (`POST /api/apps/:id/update`) and Socket.IO streaming (`app:update` event) for real-time progress

## Improvements

- **GOALS.md: Health & Longevity core goal** — added Goal 10 covering MeatSpace health tracking, mortality projections, LEV tracking, and meatspace goal management; updated tagline and purpose to reflect health as a project pillar
- **GOALS.md: Secondary goals cleanup** — removed shipped items (Behavioral Feedback Loop, Mortality-Aware Goal Tracking), added forward-looking items (Apple Health Integration, Chronotype-Aware Scheduling)
- **GOALS.md: Current State refresh** — updated all goal statuses, replaced stale Direction section with PLAN.md pointer
- **PLAN.md: New milestones** — added M45 (Data Backup & Recovery), M46 (Unified Search Cmd+K), M47 (Push Notifications) with full specs
- **PLAN.md: Completed milestones** — moved M42 P1-P4 and M44 P1-P5 to Completed section, added In Progress section for M44 P6 migration cleanup
- **PLAN.md: Tier backlog cleanup** — marked shipped Tier 1 items (Mortality-Aware Goal Widget, Behavioral Feedback Loop), updated partial items with current status notes, promoted Unified Search from Tier 4 to M46
- **PLAN.md: Next Actions** — replaced stale strikethrough list with active prioritized queue
45 changes: 45 additions & 0 deletions .changelog/v1.14.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Release v1.14.x - Changelog

Released: YYYY-MM-DD

## Overview

Genome migration cleanup — completed the meatspace data migration so genome, ClinVar, and epigenetic services read/write from the correct `data/meatspace/` directory, with all stale path references updated across services, routes, client navigation, and documentation.

## Features

- **Apple Health ingest pipeline** — `POST /api/health/ingest` accepts Health Auto Export JSON, validates with Zod, deduplicates by metric+timestamp, and persists to day-partitioned files at `data/health/YYYY-MM-DD.json`
- **Apple Health query service** — `GET /api/health/metrics/:name/daily` returns aggregated daily values, `GET /api/health/metrics/:name` returns summary stats, `GET /api/health/range` returns available data range
- **Apple Health correlation endpoint** — `GET /api/health/correlation` merges HRV, steps, alcohol, and blood test data for cross-domain health analysis
- **System health namespace relocation** — moved system health endpoints from `/api/health` and `/api/health/system` to `/api/system/health` and `/api/system/health/details` to free the `/api/health` namespace for Apple Health data
- **Data backup engine** — rsync-based incremental backup from `./data/` to a configured external drive path, with SHA-256 manifest generation for integrity verification after each snapshot
- **Backup REST API** — `GET /api/backup/status`, `POST /api/backup/run`, `GET /api/backup/snapshots`, `POST /api/backup/restore` with Zod request validation
- **Backup cron scheduler** — daily backup at 2 AM (configurable via `settings.backup.cronExpression`), registered with the existing eventScheduler and started at server boot
- **Backup client API** — `getBackupStatus`, `triggerBackup`, `getBackupSnapshots`, `restoreBackup` added to `client/src/services/api.js` for widget consumption
- **BackupWidget dashboard component** — health status indicator (green/yellow/red), manual "Backup Now" trigger with toast feedback, expandable snapshot list, inline restore panel with dry-run preview and selective subdirectory filter

- **Cross-domain insights engine** — `insightsService.js` with 5 exported functions: genome-health correlations (rule-based, groups markers by clinical category and matches blood test values), taste-identity theme generation (LLM, cached to `data/insights/themes.json`), and cross-domain narrative (LLM, cached to `data/insights/narrative.json` with previousText for diff)
- **Insights REST API** — `GET /api/insights/genome-health`, `GET /api/insights/themes`, `POST /api/insights/themes/refresh`, `GET /api/insights/narrative`, `POST /api/insights/narrative/refresh` — all endpoints degrade gracefully with `{ available: false, reason }` when source data is missing
- **Insights client API** — `getGenomeHealthCorrelations`, `getInsightThemes`, `refreshInsightThemes`, `getInsightNarrative`, `refreshInsightNarrative` added to `client/src/services/api.js`
- **Insights dashboard UI** — tabbed page at `/insights/:tab` with four deep-linked views: Overview (3 clickable domain summary cards), Genome-Health (category-grouped marker cards with confidence badges, blood value matching, collapsible provenance), Taste-Identity (LLM theme cards with evidence lists and refresh), Cross-Domain (narrative with ReactDiffViewer diff toggle on refresh)
- **Insights shared components** — `ConfidenceBadge` (color-coded strong/moderate/weak/significant), `InsightCard` (shared card shell with badge and source tags), `ProvenancePanel` (collapsible references), `EmptyState` (guided empty states with nav links)
- **Insights navigation** — "Insights" sidebar entry with Lightbulb icon, alphabetically positioned between Instances and MeatSpace
- **Unified search API** — `GET /api/search?q=<query>` fans out keyword search to Brain (inbox/people/projects/ideas/links), CoS Memory (BM25), Apps, History, and Health metrics in parallel via Promise.allSettled for fault isolation. Returns `{ query, sources }` with categorized results, each including id/title/snippet/url/type fields. Sources with zero results are omitted.
- **Search client function** — `search(q)` added to `client/src/services/api.js` for use by the overlay component
- **Cmd+K search overlay** — Spotlight-style modal mounted in Layout, available from every page; Cmd+K/Ctrl+K opens overlay with debounced search-as-you-type (300ms), results grouped by source with Lucide icons and highlighted keyword snippets, full keyboard navigation (arrows/Enter/Escape), deep-link navigation on selection, body scroll lock, and React portal for z-index isolation

- **MeatSpace Import tab** — wired existing ImportTab component into MeatSpace page routing, sidebar nav, and tab bar at `/meatspace/import`
- **Health JSON import UI** — added JSON file upload section to ImportTab for Health Auto Export JSON files, with success/error display showing metrics processed, records ingested/skipped, and days affected

## Fixes

- **HRV metric name mismatch** — Health Auto Export JSON uses `heart_rate_variability` but queries expected `heart_rate_variability_sdnn`; added metric name normalization on JSON ingest and query-time alias fallback so existing imported data displays correctly
- **Claude Code nesting detection in agent spawner** — strip `CLAUDECODE` env var from child processes so CoS agents, Brain, Runner, and Digital Twin CLI spawns don't fail with "cannot be launched inside another Claude Code session" when PortOS server runs within a Claude Code terminal

## Improvements

- **Genome migration: service data paths** — updated `genome.js`, `clinvar.js`, and `epigenetic.js` services to use `PATHS.meatspace` instead of `PATHS.digitalTwin`, completing the migration from digital-twin to meatspace storage
- **Genome migration: route comments** — updated all 18 JSDoc comments in `server/routes/genome.js` to reference `/api/meatspace/genome` (was `/api/digital-twin/genome`)
- **Genome migration: client navigation** — IdentityTab "View Full Genome" button now navigates to `/meatspace/genome` (was broken `/digital-twin/genome` dead link)
- **Genome migration: documentation** — updated `docs/API.md` and `docs/features/identity-system.md` to reflect meatspace paths for genome data files and API routes
- **Genome migration: data files** — moved `genome.json`, `genome-raw.txt`, `clinvar-index.json`, `clinvar-meta.json` from `data/digital-twin/` to `data/meatspace/` so the server reads them correctly
11 changes: 11 additions & 0 deletions .changelog/v1.7.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ Personalized taste prompting, behavioral feedback loop, mortality-aware goal tra
- Life goals card with top-3 urgency-sorted goals, category icons, and urgency badges
- All summary cards link to their respective deep-dive tabs
- **Navigation restructure**: Digital Twin promoted to top-level collapsible section with all 13 sub-tabs as alphabetically ordered children; Brain promoted to standalone top-level nav item; former "Identity" grouping removed

### Apple Health XML Import (03-02)
- Added SAX streaming parser for Apple Health export.xml files (500MB+) without loading into memory
- POST /api/health/import/xml accepts multipart file upload with multer diskStorage (2GB max)
- HK identifiers normalized to metric names matching existing JSON ingest format (step_count, heart_rate, etc.)
- Sleep categorical values parsed into duration-based stage data (deep, REM, core, awake, inBed)
- Step counts aggregated per day (sum of all per-activity readings into daily total)
- WebSocket progress events emitted every 10k records (health:xml:progress) and on completion (health:xml:complete)
- Temp file cleaned up after import completes
- Import tab Apple Health placeholder replaced with working XML file picker and progress bar
- Progress bar shows live record count during import; success card shows days and records imported
12 changes: 12 additions & 0 deletions .changelog/v1.9.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@ MeatSpace Phases 2-5: Complete health tracking with alcohol logging, blood/body/

### MeatSpace Phase 5 — Polish
- **Dashboard death clock widget**: Compact live countdown on main Dashboard with link to MeatSpace overview, shows life expectancy and percent complete

### Apple Health Integration (Phase 03)
- **Health tab in MeatSpace**: New dedicated Health tab at `/meatspace/health` with four metric cards: Steps, Heart Rate, Sleep, and HRV
- **Time range selector**: 7d/30d/90d/1y buttons filter all health cards consistently via parallel API fetches
- **Steps card**: Daily average hero number + LineChart trend from Apple Health step_count data
- **Heart Rate card**: Average BPM hero + LineChart trend from Apple Health heart_rate data
- **Sleep card**: Average hours hero + stacked horizontal BarChart showing deep/REM/core/awake stage proportions (last 7 days)
- **HRV card**: Average ms hero + LineChart trend from Apple Health heart_rate_variability_sdnn data
- **Alcohol vs HRV correlation**: Dual-axis ComposedChart (Line + Bar) with auto-generated computed text summary comparing HRV on drinking vs sober days
- **Activity vs Blood Work correlation**: 30-day rolling average steps paired with blood marker Lines at blood test dates, with per-test text summary
- **Minimum data threshold**: Both correlation charts show "Need 14+ days" message when insufficient data exists
- Apple Health data ingestion via POST `/api/health/ingest`, daily aggregates at `/api/health/metrics/:name/daily`, correlation at `/api/health/correlation`
20 changes: 20 additions & 0 deletions .planning/MILESTONES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Milestones

## v1.14 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.14-ROADMAP.md`, `.planning/milestones/v1.14-REQUIREMENTS.md`

---
85 changes: 85 additions & 0 deletions .planning/PROJECT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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. With v1.14, 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

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

### Validated

- ✓ Centralized app lifecycle management (PM2, logs, JIRA) — M0-M4
- ✓ Multi-provider AI orchestration with CoS agent system — M5, M14, M19, M35
- ✓ Brain capture and semantic memory with LLM classification — M16, M31, M32
- ✓ Digital twin identity modeling (soul, personality, taste, autobiography) — M33, M34, M42 P1-P4
- ✓ Developer toolkit (shell, git, browser, history, CyberCity) — M6, M10, M36, M41
- ✓ Self-improving intelligence (task learning, autonomous jobs) — M23-M27, M37
- ✓ 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.14
- ✓ Data backup & recovery — scheduled incremental rsync with integrity verification and restore — v1.14
- ✓ Apple Health integration — JSON ingest, SAX XML import, health metric cards and correlations — v1.14
- ✓ Cross-domain insights — genome-to-health correlations, taste-to-identity themes, LLM narratives — v1.14
- ✓ Unified search (Cmd+K) — server fan-out, Spotlight-style overlay, keyboard navigation, deep linking — v1.14

### Active

(None — next milestone requirements TBD via `/gsd:new-milestone`)

### Out of Scope

- 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
- Content Calendar — Tier 2, later

## Context

PortOS has 44+ completed milestones with a mature Express.js + React + PM2 architecture. All data persists to JSON files in `./data/`. v1.14 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).

**Shipped in v1.14:**
- 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

- **Tech stack**: Express.js backend, React/Vite frontend, JSON file persistence — no databases
- **Single user**: No auth, no multi-tenancy, private Tailscale network
- **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)

## Key Decisions

| Decision | Rationale | Outcome |
|----------|-----------|---------|
| 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-27 after v1.14 milestone*
Loading