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
docs(01-genome-migration-cleanup): create phase plan
Adam Eivyf8f01434e8ee
diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.mdindex 0e741caa00..4a881b41c7 100644--- a/.planning/ROADMAP.md+++ b/.planning/ROADMAP.md@@ -28,10 +28,10 @@ Decimal phases appear between their surrounding integers in numeric order.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**: TBD+**Plans**: 1 planPlans:-- [ ] 01-01: TBD+- [ ] 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 capabilitydiff --git a/.planning/phases/01-genome-migration-cleanup/01-01-PLAN.md b/.planning/phases/01-genome-migration-cleanup/01-01-PLAN.mdnew file mode 100644index 0000000000..fcd17f6349--- /dev/null+++ b/.planning/phases/01-genome-migration-cleanup/01-01-PLAN.md@@ -0,0 +1,252 @@+---+phase: 01-genome-migration-cleanup+plan: 01+type: execute+wave: 1+depends_on: []+files_modified:+ - server/routes/genome.js+ - server/services/genome.js+ - server/services/clinvar.js+ - server/services/epigenetic.js+ - client/src/components/digital-twin/tabs/IdentityTab.jsx+ - docs/API.md+ - docs/features/identity-system.md+autonomous: true+requirements:+ - GEN-01+ - GEN-02+ - GEN-03++must_haves:+ truths:+ - "All route comments in genome.js reference /api/meatspace/genome/ (zero digital-twin references)"+ - "IdentityTab 'View Full Genome' button navigates to /meatspace/genome (a live route)"+ - "genome.js, clinvar.js, and epigenetic.js read/write data from data/meatspace/ directory"+ - "Genome data files (genome.json, genome-raw.txt, clinvar-index.json, clinvar-meta.json) exist in data/meatspace/"+ - "No genome data files remain in data/digital-twin/"+ artifacts:+ - path: "server/routes/genome.js"+ provides: "Corrected route comments"+ contains: "/api/meatspace/genome"+ - path: "server/services/genome.js"+ provides: "Correct data directory"+ contains: "PATHS.meatspace"+ - path: "server/services/clinvar.js"+ provides: "Correct data directory"+ contains: "PATHS.meatspace"+ - path: "server/services/epigenetic.js"+ provides: "Correct data directory"+ contains: "PATHS.meatspace"+ - path: "client/src/components/digital-twin/tabs/IdentityTab.jsx"+ provides: "Working genome navigation"+ contains: "navigate('/meatspace/genome')"+ - path: "data/meatspace/genome.json"+ provides: "Migrated genome metadata"+ - path: "data/meatspace/genome-raw.txt"+ provides: "Migrated raw genome file"+ - path: "data/meatspace/clinvar-index.json"+ provides: "Migrated ClinVar index"+ - path: "data/meatspace/clinvar-meta.json"+ provides: "Migrated ClinVar metadata"+ key_links:+ - from: "server/services/genome.js"+ to: "data/meatspace/genome.json"+ via: "GENOME_DIR = PATHS.meatspace"+ pattern: "PATHS\\.meatspace"+ - from: "server/services/clinvar.js"+ to: "data/meatspace/clinvar-index.json"+ via: "GENOME_DIR = PATHS.meatspace"+ pattern: "PATHS\\.meatspace"+ - from: "client/src/components/digital-twin/tabs/IdentityTab.jsx"+ to: "MeatSpace.jsx genome tab"+ via: "navigate('/meatspace/genome')"+ pattern: "navigate\\('/meatspace/genome'\\)"+---++<objective>+Complete the genome data migration from digital-twin to meatspace by updating all stale path references in server services, route comments, client navigation, and documentation, then moving the physical data files.++Purpose: The genome API was partially migrated -- the Express mount point and client API calls already reference `/api/meatspace/genome`, but three service files still read from `data/digital-twin/`, route comments are stale, IdentityTab has a dead navigation link, and docs reference old paths. This plan completes the migration so genome data reads from the correct location and all references are consistent.++Output: Updated service files, route comments, client navigation, documentation, and migrated data files.+</objective>++<execution_context>+@/Users/antic/.claude/get-shit-done/workflows/execute-plan.md+@/Users/antic/.claude/get-shit-done/templates/summary.md+</execution_context>++<context>[email protected]/ROADMAP.md[email protected]/STATE.md[email protected]/phases/01-genome-migration-cleanup/01-RESEARCH.md++Key facts from research:+- `server/index.js` line 209 mounts genome router at `/api/meatspace/genome` (already correct -- do NOT touch)+- `client/src/services/api.js` already calls `/meatspace/genome/...` endpoints (already correct -- do NOT touch)+- `client/src/pages/MeatSpace.jsx` line 29 has `case 'genome': return <GenomeTab />` (live route, confirmed)+- `PATHS.meatspace` is defined at `server/lib/fileUtils.js` line 31 (already exists -- do NOT create a new constant)+- `data/digital-twin/` contains: `genome.json`, `genome-raw.txt`, `clinvar-index.json`, `clinvar-meta.json` (must move all four)+- `data/meatspace/` already contains: `blood-tests.json`, `config.json`, `daily-log.json`, `epigenetic-tests.json`, `eyes.json` (no genome files yet)+- `epigenetic.js` writes `epigenetic.json` (NOT `epigenetic-tests.json`) -- no epigenetic data file exists in `data/digital-twin/`, so no epigenetic data migration needed+- `docs/API.md` lines 400-415 reference `/digital-twin/genome` paths (stale)+- `docs/features/identity-system.md` references `data/digital-twin/genome.json` and `/digital-twin/genome` route (stale)+</context>++<tasks>++<task type="auto">+ <name>Task 1: Update service data paths and route comments</name>+ <files>+ server/services/genome.js+ server/services/clinvar.js+ server/services/epigenetic.js+ server/routes/genome.js+ </files>+ <action>+1. In `server/services/genome.js` line 7, replace `PATHS.digitalTwin` with `PATHS.meatspace`:+ ```+ const GENOME_DIR = PATHS.meatspace;+ ```++2. In `server/services/clinvar.js` line 9, replace `PATHS.digitalTwin` with `PATHS.meatspace`:+ ```+ const GENOME_DIR = PATHS.meatspace;+ ```++3. In `server/services/epigenetic.js` line 6, replace `PATHS.digitalTwin` with `PATHS.meatspace`:+ ```+ const DATA_DIR = PATHS.meatspace;+ ```++4. In `server/routes/genome.js`, replace ALL 18 occurrences of `/api/digital-twin/genome` with `/api/meatspace/genome` in route comments (lines 19, 25, 39, 52, 59, 66, 80, 95, 101, 120, 141, 149, 155, 162, 169, 176, 190, 204, 217). Use replace_all -- these are comment-only changes, no functional code is affected.++Do NOT modify `server/index.js` (mount point is already correct).+Do NOT modify `client/src/services/api.js` (API calls are already correct).+ </action>+ <verify>+ <automated>cd /Users/antic/github.com/atomantic/PortOS && grep -c "PATHS.digitalTwin" server/services/genome.js server/services/clinvar.js server/services/epigenetic.js && grep -c "digital-twin/genome" server/routes/genome.js</automated>+ All four counts must be 0.+ </verify>+ <done>All three service files use PATHS.meatspace. All 18 route comments reference /api/meatspace/genome/. Zero occurrences of PATHS.digitalTwin or /api/digital-twin/genome remain in these files.</done>+</task>++<task type="auto">+ <name>Task 2: Fix client navigation and update documentation</name>+ <files>+ client/src/components/digital-twin/tabs/IdentityTab.jsx+ docs/API.md+ docs/features/identity-system.md+ </files>+ <action>+1. In `client/src/components/digital-twin/tabs/IdentityTab.jsx` line 190, replace:+ ```+ onClick={() => navigate('/digital-twin/genome')}+ ```+ with:+ ```+ onClick={() => navigate('/meatspace/genome')}+ ```+ This redirects the "View Full Genome" button to the live meatspace genome tab. Keep the genome card and completeness chip -- only the navigation target changes.++2. In `docs/API.md` lines 400-415, replace all occurrences of `/digital-twin/genome` with `/meatspace/genome` in the API route table. Use replace_all for the string `/digital-twin/genome` in that file.++3. In `docs/features/identity-system.md`:+ - Replace `data/digital-twin/genome.json` with `data/meatspace/genome.json` (line 11 area)+ - Replace `/digital-twin/genome` with `/meatspace/genome` where referencing the route (line 255 area)++4. Verify no other client files reference `/digital-twin/genome` by running:+ ```+ grep -r "digital-twin/genome" client/src/ --include="*.jsx" --include="*.js"+ ```+ Expected: zero results after the IdentityTab fix.+ </action>+ <verify>+ <automated>cd /Users/antic/github.com/atomantic/PortOS && grep -c "digital-twin/genome" client/src/components/digital-twin/tabs/IdentityTab.jsx docs/API.md docs/features/identity-system.md && grep -r "digital-twin/genome" client/src/ --include="*.jsx" --include="*.js" -l | wc -l</automated>+ All counts must be 0 and the client search must return 0 files.+ </verify>+ <done>IdentityTab navigates to /meatspace/genome. docs/API.md and docs/features/identity-system.md reference meatspace paths. No client-side references to /digital-twin/genome remain.</done>+</task>++<task type="auto">+ <name>Task 3: Migrate genome data files from digital-twin to meatspace</name>+ <files>+ data/digital-twin/genome.json+ data/digital-twin/genome-raw.txt+ data/digital-twin/clinvar-index.json+ data/digital-twin/clinvar-meta.json+ data/meatspace/genome.json+ data/meatspace/genome-raw.txt+ data/meatspace/clinvar-index.json+ data/meatspace/clinvar-meta.json+ </files>+ <action>+Move the four genome/clinvar data files from `data/digital-twin/` to `data/meatspace/`. Use `mv` (move, not copy) so stale files do not remain:++```bash+mv data/digital-twin/genome.json data/meatspace/genome.json+mv data/digital-twin/genome-raw.txt data/meatspace/genome-raw.txt+mv data/digital-twin/clinvar-index.json data/meatspace/clinvar-index.json+mv data/digital-twin/clinvar-meta.json data/meatspace/clinvar-meta.json+```++IMPORTANT: Do NOT move any other files from `data/digital-twin/`. That directory still holds non-genome data (chronotype.json, goals.json, etc.) used by other services.++Do NOT move `epigenetic.json` -- it does not exist in `data/digital-twin/`. The epigenetic service will create it in `data/meatspace/` on first write.++Note: These data files are in `.gitignore` (they are user data, not tracked). The move happens on disk only.++After the move, verify the genome API still works by checking the file exists and is valid JSON:+```bash+node -e "const fs=require('fs'); const d=JSON.parse(fs.readFileSync('data/meatspace/genome.json','utf-8')); console.log('uploaded:', d.uploaded, 'markers:', d.savedMarkers?.length ?? 0)"+```+ </action>+ <verify>+ <automated>cd /Users/antic/github.com/atomantic/PortOS && ls data/meatspace/genome.json data/meatspace/genome-raw.txt data/meatspace/clinvar-index.json data/meatspace/clinvar-meta.json && ls data/digital-twin/genome.json 2>&1 | grep -c "No such file"</automated>+ First ls should succeed (all four files exist in meatspace). Second ls should show "No such file" (count = 1).+ </verify>+ <done>All four genome/clinvar files exist in data/meatspace/. Zero genome/clinvar files remain in data/digital-twin/. genome.json parses as valid JSON with expected fields.</done>+</task>++</tasks>++<verification>+After all tasks complete, run these checks:++1. **No stale references in code:**+ ```bash+ grep -r "PATHS.digitalTwin" server/services/genome.js server/services/clinvar.js server/services/epigenetic.js+ # Expected: no output+ grep -r "digital-twin/genome" server/routes/genome.js client/src/ docs/API.md docs/features/identity-system.md+ # Expected: no output+ ```++2. **Data files in correct location:**+ ```bash+ ls -la data/meatspace/genome.json data/meatspace/genome-raw.txt data/meatspace/clinvar-index.json data/meatspace/clinvar-meta.json+ # Expected: all four files exist+ ls data/digital-twin/genome* data/digital-twin/clinvar* 2>&1+ # Expected: "No such file or directory" for all+ ```++3. **Tests pass:**+ ```bash+ cd server && npm test+ # Expected: all tests pass (no genome-specific tests exist, but no regressions)+ ```+</verification>++<success_criteria>+- Zero occurrences of `PATHS.digitalTwin` in genome.js, clinvar.js, epigenetic.js+- Zero occurrences of `/api/digital-twin/genome` in server/routes/genome.js+- Zero occurrences of `/digital-twin/genome` in IdentityTab.jsx, docs/API.md, docs/features/identity-system.md+- Zero occurrences of `/digital-twin/genome` in any client .jsx or .js file+- genome.json, genome-raw.txt, clinvar-index.json, clinvar-meta.json all exist in data/meatspace/+- No genome/clinvar files remain in data/digital-twin/+- `npm test` passes in server/+</success_criteria>++<output>+After completion, create `.planning/phases/01-genome-migration-cleanup/01-01-SUMMARY.md`+</output>