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
fix(digital-twin): text enrichment answers now update confidence metrics
Adam Eivy06b90f66590e
diff --git a/.changelog/v0.18.x.md b/.changelog/v0.18.x.mdindex a3a3a2558d..6cfd6fc034 100644--- a/.changelog/v0.18.x.md+++ b/.changelog/v0.18.x.md@@ -47,6 +47,11 @@ Continued reliability improvements and codebase hardening.- Comprehensive project goals document generated from codebase analysis covering 9 core goals, non-goals, current state, and project direction- Added reference link from PLAN.md to GOALS.md+### Fix text enrichment answers not updating Twin Confidence / Soul Health+- Text-based enrichment answers (boundaries, decision heuristics, etc.) were saved to documents but never recalculated confidence scores — only scale (Likert) questions triggered the confidence boost and metadata save+- Added category-to-dimension mapping so each enrichment category boosts the correct confidence dimension (e.g., `non_negotiables` → `boundaries`, `decision_heuristics` → `decision_making`)+- Confidence, overall score, and gap recommendations now recalculate and persist after every enrichment answer, not just scale questions+## Removed### App Templates (M7)diff --git a/package-lock.json b/package-lock.jsonindex 0ba4b4ccb2..8fec8811d1 100644--- a/package-lock.json+++ b/package-lock.json@@ -102,6 +102,7 @@"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==","dev": true,"license": "MIT",+ "peer": true,"dependencies": {"@babel/code-frame": "^7.27.1","@babel/generator": "^7.28.5",@@ -395,6 +396,7 @@"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz","integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==","license": "MIT",+ "peer": true,"dependencies": {"@dnd-kit/accessibility": "^3.1.1","@dnd-kit/utilities": "^3.2.2",@@ -437,7 +439,6 @@"integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==","license": "MIT","optional": true,- "peer": true,"dependencies": {"tslib": "^2.4.0"}@@ -890,7 +891,6 @@"integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==","license": "MIT","optional": true,- "peer": true,"engines": {"node": ">=18"}@@ -907,7 +907,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -930,7 +929,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -953,7 +951,6 @@"os": ["darwin"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -970,7 +967,6 @@"os": ["darwin"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -987,7 +983,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1004,7 +999,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1021,7 +1015,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1038,7 +1031,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1055,7 +1047,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1072,7 +1063,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1089,7 +1079,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1106,7 +1095,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1123,7 +1111,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1146,7 +1133,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1169,7 +1155,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1192,7 +1177,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1215,7 +1199,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1238,7 +1221,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1261,7 +1243,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1284,7 +1265,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1304,7 +1284,6 @@],"license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT","optional": true,- "peer": true,"dependencies": {"@emnapi/runtime": "^1.7.0"},@@ -1327,7 +1306,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1347,7 +1325,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1367,7 +1344,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1447,8 +1423,7 @@"version": "16.1.6","resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz","integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==",- "license": "MIT",- "peer": true+ "license": "MIT"},"node_modules/@next/swc-darwin-arm64": {"version": "16.1.6",@@ -1462,7 +1437,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": ">= 10"}@@ -1479,7 +1453,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": ">= 10"}@@ -1496,7 +1469,6 @@"os": ["linux"],- "peer": true,"engines": {"node": ">= 10"}@@ -1513,7 +1485,6 @@"os": ["linux"],- "peer": true,"engines": {"node": ">= 10"}@@ -1530,7 +1501,6 @@"os": ["linux"],- "peer": true,"engines": {"node": ">= 10"}@@ -1547,7 +1517,6 @@"os": ["linux"],- "peer": true,"engines": {"node": ">= 10"}@@ -1564,7 +1533,6 @@"os": ["win32"],- "peer": true,"engines": {"node": ">= 10"}@@ -1581,7 +1549,6 @@"os": ["win32"],- "peer": true,"engines": {"node": ">= 10"}@@ -2015,6 +1982,7 @@"resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-8.18.0.tgz","integrity": "sha512-FYZZqD0UUHUswKz3LQl2Z7H24AhD14XGTsIRw3SJaXUxyfVMi+1yiZGmqTcPt/CkPpdU7rrxqcyQ1zJE5DjvIQ==","license": "MIT",+ "peer": true,"dependencies": {"@babel/runtime": "^7.17.8","@types/react-reconciler": "^0.26.7",@@ -2460,7 +2428,6 @@"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz","integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==","license": "Apache-2.0",- "peer": true,"dependencies": {"tslib": "^2.8.0"}@@ -2608,6 +2575,7 @@"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.6.tgz","integrity": "sha512-NNu0sjyNxpoiW3YuVFfNz7mxSQ+S4X2G28uqg2s+CzoqoQjLPsWSbsFFyztIAqt2vb8kfEAsJNepMGPTxFDx3Q==","license": "MIT",+ "peer": true,"dependencies": {"undici-types": "~7.16.0"}@@ -2623,6 +2591,7 @@"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.13.tgz","integrity": "sha512-KkiJeU6VbYbUOp5ITMIc7kBfqlYkKA5KhEHVrGMmUUMt7NeaZg65ojdPk+FtNrBAOXNVM5QM72jnADjM+XVRAQ==","license": "MIT",+ "peer": true,"dependencies": {"csstype": "^3.2.2"}@@ -2647,6 +2616,7 @@"resolved": "https://registry.npmjs.org/@types/three/-/three-0.182.0.tgz","integrity": "sha512-WByN9V3Sbwbe2OkWuSGyoqQO8Du6yhYaXtXLoA5FkKTUJorZ+yOHBZ35zUUPQXlAKABZmbYp5oAqpA4RBjtJ/Q==","license": "MIT",+ "peer": true,"dependencies": {"@dimforge/rapier3d-compat": "~0.12.0","@tweenjs/tween.js": "~23.1.3",@@ -3269,6 +3239,7 @@}],"license": "MIT",+ "peer": true,"dependencies": {"baseline-browser-mapping": "^2.9.0","caniuse-lite": "^1.0.30001759",@@ -3550,8 +3521,7 @@"version": "0.0.1","resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz","integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==",- "license": "MIT",- "peer": true+ "license": "MIT"},"node_modules/cliui": {"version": "8.0.1",@@ -3774,7 +3744,8 @@"version": "3.2.3","resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz","integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",- "license": "MIT"+ "license": "MIT",+ "peer": true},"node_modules/culvert": {"version": "0.1.2",@@ -3910,7 +3881,6 @@"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==","license": "Apache-2.0","optional": true,- "peer": true,"engines": {"node": ">=8"}@@ -5190,6 +5160,7 @@"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==","dev": true,"license": "MIT",+ "peer": true,"bin": {"jiti": "bin/jiti.js"}@@ -6216,7 +6187,6 @@"resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz","integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==","license": "MIT",- "peer": true,"dependencies": {"@next/env": "16.1.6","@swc/helpers": "0.5.15",@@ -6284,7 +6254,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.6","picocolors": "^1.0.0",@@ -6783,6 +6752,7 @@}],"license": "MIT",+ "peer": true,"dependencies": {"nanoid": "^3.3.11","picocolors": "^1.1.1",@@ -7090,6 +7060,7 @@"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz","integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==","license": "MIT",+ "peer": true,"dependencies": {"loose-envify": "^1.1.0"},@@ -7114,6 +7085,7 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz","integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==","license": "MIT",+ "peer": true,"dependencies": {"loose-envify": "^1.1.0","scheduler": "^0.23.2"@@ -7642,7 +7614,6 @@"hasInstallScript": true,"license": "Apache-2.0","optional": true,- "peer": true,"dependencies": {"@img/colour": "^1.0.0","detect-libc": "^2.1.2",@@ -7687,7 +7658,6 @@"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==","license": "ISC","optional": true,- "peer": true,"bin": {"semver": "bin/semver.js"},@@ -8099,7 +8069,6 @@"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz","integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==","license": "MIT",- "peer": true,"dependencies": {"client-only": "0.0.1"},@@ -8329,7 +8298,8 @@"version": "0.182.0","resolved": "https://registry.npmjs.org/three/-/three-0.182.0.tgz","integrity": "sha512-GbHabT+Irv+ihI1/f5kIIsZ+Ef9Sl5A1Y7imvS5RQjWgtTPfPnZ43JmlYI7NtCRDK9zir20lQpfg8/9Yd02OvQ==",- "license": "MIT"+ "license": "MIT",+ "peer": true},"node_modules/three-mesh-bvh": {"version": "0.7.8",@@ -8422,6 +8392,7 @@"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==","dev": true,"license": "MIT",+ "peer": true,"engines": {"node": ">=12"},@@ -8834,6 +8805,7 @@"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==","dev": true,"license": "MIT",+ "peer": true,"dependencies": {"esbuild": "^0.25.0","fdir": "^6.4.4",@@ -8927,6 +8899,7 @@"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==","dev": true,"license": "MIT",+ "peer": true,"engines": {"node": ">=12"},@@ -8940,6 +8913,7 @@"integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==","dev": true,"license": "MIT",+ "peer": true,"dependencies": {"@vitest/expect": "4.0.16","@vitest/mocker": "4.0.16",diff --git a/server/package-lock.json b/server/package-lock.jsonindex 2eaf72689e..1d1941dd04 100644--- a/server/package-lock.json+++ b/server/package-lock.json@@ -1,12 +1,12 @@{"name": "portos-server",- "version": "0.9.3",+ "version": "0.18.8","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "portos-server",- "version": "0.9.3",+ "version": "0.18.8","dependencies": {"cors": "^2.8.5","express": "^4.21.2",diff --git a/server/services/digital-twin.js b/server/services/digital-twin.jsindex 3b29e1a170..72e1d708ce 100644--- a/server/services/digital-twin.js+++ b/server/services/digital-twin.js@@ -1121,14 +1121,47 @@ export async function processEnrichmentAnswer(data) {});}+ // Boost confidence for the dimension this category maps to+ const categoryToDimension = {+ personality_assessments: 'openness',+ daily_routines: 'conscientiousness',+ communication: 'communication',+ values: 'values',+ non_negotiables: 'boundaries',+ decision_heuristics: 'decision_making',+ error_intolerance: 'boundaries',+ core_memories: 'identity',+ career_skills: 'conscientiousness',+ taste: 'openness'+ };+ const dimension = categoryToDimension[category];+ if (dimension) {+ if (!meta.confidence) meta.confidence = { overall: 0, dimensions: {}, gaps: [], lastCalculated: now() };+ if (!meta.confidence.dimensions) meta.confidence.dimensions = {};+ const currentConf = meta.confidence.dimensions[dimension] || 0;+ meta.confidence.dimensions[dimension] = Math.min(1, Math.round((currentConf + CONFIDENCE_BOOST) * 100) / 100);++ const dimValues = Object.values(meta.confidence.dimensions);+ meta.confidence.overall = dimValues.length > 0+ ? Math.round((dimValues.reduce((a, b) => a + b, 0) / dimValues.length) * 100) / 100+ : 0;++ meta.confidence.gaps = generateGapRecommendations(meta.confidence.dimensions);+ meta.confidence.lastCalculated = now();+ }+await saveMeta(meta);- console.log(`🧬 Enrichment answer processed for ${category}`);+ digitalTwinEvents.emit('confidence:calculated', meta.confidence);++ console.log(`🧬 Enrichment answer processed for ${category}${dimension ? ` → ${dimension} confidence=${meta.confidence.dimensions[dimension]}` : ''}`);return {category,targetDoc: config.targetDoc,- contentAdded: formattedContent+ contentAdded: formattedContent,+ dimension,+ newConfidence: dimension ? meta.confidence.dimensions[dimension] : undefined};}