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
feat([issue-2666]): Daily Driver dashboard card sequencing POST then per-goal next-actions
[._.]/ Adam Eivyfb10e18bb649
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 852cb8ede1..b5c050e611 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -18,6 +18,7 @@- **[issue-2610] LLM personality self-profile testing with digital-twin alignment scoring.** New **Digital Twin → Personality** tab (also reachable via ⌘K and voice): pick one or more provider/models and run a single-prompt deep introspective self-evaluation that returns a structured personality profile — agreeableness, humor, error aversion, self-censorship, conciseness, dogmatism, sycophancy, creativity, formality, empathy — each scored 0–100% with the model's own rationale, plus a plain-language summary. An optional follow-up check scores how well that posture aligns with your twin's analyzed traits (Big Five, communication profile, values), with per-dimension notes; it's skipped with a clear message when the twin has no analyzed traits yet. Results render on a radar chart, persist as capped local history (survives restart, delete per entry), and any 2+ past runs can be overlaid on one radar with a side-by-side score table to compare models or track one model over time. The scorer provider/model, history cap, and default alignment toggle are configurable in the tab's Options; both prompts are editable stage templates like any other. Calls fire only from the explicit Run action — never at boot or in the background.+- **[issue-2666] Daily Driver dashboard card.** A self-dismissing card that, on the first visit of the local day, sequences you through your daily POST → a concrete next-action for each active goal → (with no goals) a "Define your goals" nudge — composing existing signals, never firing an LLM call on first visit or boot. The card renders the POST row (done-today/streak or the top "up next" recommendation, deep-linking to `/post/launcher`), then one row per active goal carrying that goal's mapped feature deep-links (health → Daily POST / Body Health, creative → Writers Room / Universes / Series Pipeline, legacy → Autobiography / Legacy Bundle / Sharing, etc.) plus its latest check-in recommendation, and a one-click "Check in on all goals." A new deterministic, LLM-free goal `category` → PortOS feature-area map lives in one module mirrored byte-for-byte between server and client (`server/lib/goalFeatureMap.js` ↔ `client/src/lib/goalFeatureMap.js`), with every deep-link sourced from a real `NAV_COMMANDS` path (test-enforced). A goal can pin its own feature areas via an optional `featureAreas` override (validated on create and update, falling back to the category default when absent). A timezone-correct per-day first-visit + "handled" signal (`server/services/dailyDriver.js`, `GET/POST /api/daily-driver`) gates the widget — it self-hides for the rest of the day once handled or dismissed, reserving no dashboard space. Registered in `widgetRegistry.jsx` and pinned to the top of the Morning Review layout.- **First-run tutorial for POST cognitive drills.** The timed, stimulus-driven cognitive drills (n-back, digit-span, stroop, schulte-table, mental-rotation, reaction-time) start flashing a stimulus the instant they mount, which is disorienting the first time you meet one. Each drill type now shows a one-time how-to card — a plain-language goal, numbered steps, and the controls — the first time it's encountered, and holds the drill (and its timers) until you tap **Start drill**. The card is config-aware (it names the n-back lag, the digit-span direction, and the reaction-time mode), then never shows again for that type (tracked per type in `localStorage`). Non-timed drills (math/memory, LLM/verbal) are self-explanatory and are not gated.- **Voice fast-resolution cascade (lower CoS latency, opt-in).** The voice Chief of Staff can now triage each spoken/typed turn through fast client-side tiers before the (slow) server LLM: **tier 1 triggers** resolve navigation commands ("go to tasks", "open the daily log") instantly in the browser with no LLM; **tier 2** runs Chrome's on-device **Gemini Nano** (Prompt API — `window.LanguageModel` / legacy `self.ai.languageModel`) for simple/conversational turns, entirely local and private; **tier 3** is the existing server pipeline (recommend Ollama), which still handles every tool/action turn, personal-data retrieval, dictation, and confirmations. Off by default (existing installs keep all-server behavior); enable under **Settings → Voice → Fast resolution**, which also shows a live on-device-model availability pill with the `chrome://flags` hint. Applies to Web-Speech STT and typed input (whisper/hands-free audio turns stay server-driven); trigger/Nano replies are spoken through the configured TTS and keep barge-in + echo-suppression working. New `llm.fastPath` config (`enabled`/`triggers`/`browserLlm`/`browser.{temperature,topK}`); new client modules `browserLlm.js` (Nano client) and `voiceFastPath.js` (routing decision). Nothing runs a model the user hasn't triggered (no cold-bootstrap).diff --git a/client/src/components/dashboard/builtins/DailyDriverWidget.jsx b/client/src/components/dashboard/builtins/DailyDriverWidget.jsxnew file mode 100644index 0000000000..c4a994298e--- /dev/null+++ b/client/src/components/dashboard/builtins/DailyDriverWidget.jsx@@ -0,0 +1,165 @@+import { useState, useEffect, useCallback } from 'react';+import { Link } from 'react-router-dom';+import {+ Compass, ArrowRight, X, CheckCircle2, Target, Sparkles,+ Brain, HeartPulse, PenLine, Globe, Clapperboard, Users,+ BookOpen, Package, Share2, ListTree, BrainCircuit,+} from 'lucide-react';+import * as api from '../../../services/api';+import { getGoalFeatureAreas } from '../../../lib/goalFeatureMap.js';++// Resolve a feature-area icon NAME (kept as a string in goalFeatureMap so that+// module stays React-free and server-mirrorable) to a lucide component.+const AREA_ICONS = {+ Brain, HeartPulse, PenLine, Globe, Clapperboard, Users,+ BookOpen, Package, Share2, ListTree, BrainCircuit, Target,+};++// Daily Driver (issue #2666): a self-dismissing card that, on the first visit+// of the day, sequences the user through their daily POST → per-goal+// next-actions → (no goals) a "define your goals" nudge. It COMPOSES existing+// signals (POST stats/recommendations, goals + the deterministic+// goal→feature map) — it makes ZERO LLM calls on render (AI Provider Usage+// Policy); the goal check-in remains an explicit action on the Goals page.+//+// Visibility is gated in the registry on `dashboardState.dailyDriver` ++// `!handledToday`, so a handled day removes the card (no reserved empty cell).+// "Dismiss" / "all done" marks the day handled and refetches so the gate hides it.+export default function DailyDriverWidget({ dashboardState }) {+ const [post, setPost] = useState(null);+ const [topRec, setTopRec] = useState(null);+ const [goals, setGoals] = useState([]);+ const [loaded, setLoaded] = useState(false);+ const [dismissing, setDismissing] = useState(false);++ const refetchDashboard = dashboardState?.refetch;++ const fetchData = useCallback(async () => {+ const [stats, recs, goalsData] = await Promise.all([+ api.getPostStats().catch(() => null),+ api.getPostRecommendations(1).catch(() => null),+ api.getGoals({ silent: true }).catch(() => null),+ ]);+ setPost(stats);+ setTopRec(recs?.recommendations?.[0] || null);+ setGoals((goalsData?.goals || []).filter((g) => g.status === 'active'));+ setLoaded(true);+ }, []);++ useEffect(() => { fetchData(); }, [fetchData]);++ // Mark the day handled, then refetch dashboard state so the registry gate+ // drops the card. Optimistically hides immediately.+ const handleDismiss = useCallback(async () => {+ setDismissing(true);+ await api.markDailyDriverHandled().catch(() => null);+ if (refetchDashboard) await refetchDashboard();+ }, [refetchDashboard]);++ if (!loaded) return null;++ const completedToday = !!post?.completedToday;+ const streak = post?.currentStreak ?? 0;++ return (+ <div className="bg-port-card border border-port-accent/40 rounded-xl p-4 h-full flex flex-col overflow-hidden">+ <div className="flex items-center gap-2 mb-3">+ <Sparkles size={16} className="text-port-accent" />+ <h3 className="text-sm font-semibold text-white">Daily Driver</h3>+ <button+ type="button"+ onClick={handleDismiss}+ disabled={dismissing}+ aria-label="Dismiss for today"+ title="Dismiss for today"+ className="ml-auto p-1 rounded text-gray-500 hover:text-white hover:bg-port-border/60 disabled:opacity-50"+ >+ <X size={14} />+ </button>+ </div>++ <div className="flex-1 overflow-y-auto space-y-3">+ {/* ① Daily POST */}+ <Link+ to="/post/launcher"+ className="flex items-center gap-2 p-2 rounded-lg border border-port-border hover:border-gray-600 transition-colors"+ >+ <Brain size={16} className="text-port-accent shrink-0" />+ <div className="min-w-0 flex-1">+ <div className="text-sm font-medium text-white">Daily POST</div>+ <div className="text-xs text-gray-500 truncate">+ {completedToday+ ? `Done today · ${streak} day streak`+ : topRec+ ? `Up next: ${topRec.title}`+ : 'Start your cognitive session'}+ </div>+ </div>+ {completedToday ? (+ <CheckCircle2 size={16} className="text-port-success shrink-0" />+ ) : (+ <span className="flex items-center gap-1 text-xs text-port-accent shrink-0">+ Start <ArrowRight size={12} />+ </span>+ )}+ </Link>++ {/* ② Goal next-actions, or empty-state nudge */}+ {goals.length === 0 ? (+ <Link+ to="/goals/list"+ className="flex items-center gap-2 p-2 rounded-lg border border-dashed border-port-border hover:border-port-accent transition-colors"+ >+ <Target size={16} className="text-port-accent shrink-0" />+ <div className="min-w-0 flex-1">+ <div className="text-sm font-medium text-white">Define your goals</div>+ <div className="text-xs text-gray-500 truncate">+ Set the goals the Daily Driver will steer you toward.+ </div>+ </div>+ <ArrowRight size={12} className="text-port-accent shrink-0" />+ </Link>+ ) : (+ <>+ <div className="text-xs font-medium text-gray-400 uppercase tracking-wide">Next actions</div>+ {goals.map((goal) => {+ const areas = getGoalFeatureAreas(goal);+ const latestRec = goal.checkIns?.[goal.checkIns.length - 1]?.recommendations?.[0];+ return (+ <div key={goal.id} className="p-2 rounded-lg border border-port-border">+ <div className="text-sm font-medium text-white truncate">{goal.title}</div>+ {latestRec && (+ <div className="text-xs text-gray-500 truncate mt-0.5">{latestRec}</div>+ )}+ {areas.length > 0 && (+ <div className="mt-2 flex flex-wrap gap-1.5">+ {areas.map((a) => {+ const Icon = AREA_ICONS[a.icon] || Target;+ return (+ <Link+ key={a.area}+ to={a.to}+ className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-port-accent/15 text-port-accent text-xs hover:bg-port-accent/25 transition-colors"+ >+ <Icon size={11} />+ {a.label}+ </Link>+ );+ })}+ </div>+ )}+ </div>+ );+ })}+ <Link+ to="/goals/list"+ className="flex items-center justify-center gap-1 p-2 rounded-lg bg-port-accent/10 text-port-accent text-sm hover:bg-port-accent/20 transition-colors"+ >+ <Compass size={14} /> Check in on all goals+ </Link>+ </>+ )}+ </div>+ </div>+ );+}diff --git a/client/src/components/dashboard/builtins/DailyDriverWidget.test.jsx b/client/src/components/dashboard/builtins/DailyDriverWidget.test.jsxnew file mode 100644index 0000000000..4a26c7895f--- /dev/null+++ b/client/src/components/dashboard/builtins/DailyDriverWidget.test.jsx@@ -0,0 +1,91 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { render, screen, fireEvent, waitFor } from '@testing-library/react';+import { MemoryRouter } from 'react-router-dom';+import DailyDriverWidget from './DailyDriverWidget';++const mocks = vi.hoisted(() => ({+ getPostStats: vi.fn(),+ getPostRecommendations: vi.fn(),+ getGoals: vi.fn(),+ markDailyDriverHandled: vi.fn(),+}));++vi.mock('../../../services/api', () => mocks);++const renderWidget = (dashboardState = {}) =>+ render(+ <MemoryRouter>+ <DailyDriverWidget dashboardState={dashboardState} />+ </MemoryRouter>+ );++beforeEach(() => {+ vi.clearAllMocks();+ mocks.getPostStats.mockResolvedValue({ completedToday: false, currentStreak: 3 });+ mocks.getPostRecommendations.mockResolvedValue({ recommendations: [{ title: 'Morse copy drill' }] });+ mocks.getGoals.mockResolvedValue({ goals: [] });+ mocks.markDailyDriverHandled.mockResolvedValue({ handledToday: true });+});++describe('DailyDriverWidget', () => {+ it('renders the POST row with the top recommendation when not completed', async () => {+ renderWidget();+ expect(await screen.findByText('Daily POST')).toBeTruthy();+ expect(screen.getByText(/Up next: Morse copy drill/)).toBeTruthy();+ });++ it('shows a done state for POST once completed today', async () => {+ mocks.getPostStats.mockResolvedValue({ completedToday: true, currentStreak: 5 });+ renderWidget();+ expect(await screen.findByText(/Done today · 5 day streak/)).toBeTruthy();+ });++ it('shows the "Define your goals" empty-state when there are no active goals', async () => {+ renderWidget();+ expect(await screen.findByText('Define your goals')).toBeTruthy();+ const link = screen.getByText('Define your goals').closest('a');+ expect(link.getAttribute('href')).toBe('/goals/list');+ });++ it('renders goal next-action rows with registry-derived deep-links', async () => {+ mocks.getGoals.mockResolvedValue({+ goals: [+ { id: 'g1', title: 'Run a marathon', category: 'health', status: 'active', checkIns: [] },+ { id: 'g2', title: 'Finish the novel', category: 'creative', status: 'active', checkIns: [] },+ { id: 'g3', title: 'Archived', category: 'health', status: 'completed', checkIns: [] },+ ],+ });+ renderWidget();+ expect(await screen.findByText('Run a marathon')).toBeTruthy();+ expect(screen.getByText('Finish the novel')).toBeTruthy();+ // Completed goals are excluded from the driver.+ expect(screen.queryByText('Archived')).toBeNull();++ // health → Daily POST (/post/launcher); creative → Writers Room (/writers-room)+ const postLink = screen.getAllByText('Daily POST').find((el) => el.closest('a')?.getAttribute('href') === '/post/launcher');+ expect(postLink).toBeTruthy();+ const writersLink = screen.getByText('Writers Room').closest('a');+ expect(writersLink.getAttribute('href')).toBe('/writers-room');++ expect(screen.getByText('Check in on all goals').closest('a').getAttribute('href')).toBe('/goals/list');+ });++ it('surfaces the latest check-in recommendation on a goal row', async () => {+ mocks.getGoals.mockResolvedValue({+ goals: [{+ id: 'g1', title: 'Learn CW', category: 'mastery', status: 'active',+ checkIns: [{ recommendations: ['Practice at 15 WPM daily'] }],+ }],+ });+ renderWidget();+ expect(await screen.findByText('Practice at 15 WPM daily')).toBeTruthy();+ });++ it('marks the day handled and refetches dashboard state on dismiss', async () => {+ const refetch = vi.fn().mockResolvedValue();+ renderWidget({ refetch });+ fireEvent.click(await screen.findByLabelText('Dismiss for today'));+ await waitFor(() => expect(mocks.markDailyDriverHandled).toHaveBeenCalledTimes(1));+ await waitFor(() => expect(refetch).toHaveBeenCalledTimes(1));+ });+});diff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsxindex daa1342c15..12f6705edc 100644--- a/client/src/components/dashboard/widgetRegistry.jsx+++ b/client/src/components/dashboard/widgetRegistry.jsx@@ -27,6 +27,7 @@ const HourlyActivityWidget = lazyWithReload(() => import('./builtins/HourlyActiconst FeedsWidget = lazyWithReload(() => import('./builtins/FeedsWidget'));const MeatSpaceStreakWidget = lazyWithReload(() => import('./builtins/MeatSpaceStreakWidget'));const AutoFixMetricsWidget = lazyWithReload(() => import('./builtins/AutoFixMetricsWidget'));+const DailyDriverWidget = lazyWithReload(() => import('./builtins/DailyDriverWidget'));// Each entry: { id, label, Component, width, defaultH?, gate?, module? }.// `gate(state) => bool` skips the widget when it has nothing useful to show.@@ -44,6 +45,9 @@ const AutoFixMetricsWidget = lazyWithReload(() => import('./builtins/AutoFixMet// widget's top border. Several widgets carry this by default; the rest are// label-free so the dashboard doesn't turn into a wall of HUD chrome.export const WIDGETS = [+ // Daily Driver self-hides once the day is handled — gated on the per-day+ // first-visit/handled state so a handled day reserves no grid cell (#2666).+ { id: 'daily-driver', label: 'Daily Driver', Component: DailyDriverWidget, width: 'third', defaultH: 6, gate: (s) => !!s.dailyDriver && !s.dailyDriver.handledToday },{ id: 'quick-brain', label: 'Quick Brain Capture', Component: QuickBrainCapture, width: 'half', defaultH: 3 },{ id: 'quick-idea', label: 'Quick Idea (Catalog)', Component: QuickIdeaCapture, width: 'half', defaultH: 4 },{ id: 'quick-image', label: 'Quick Image Prompt', Component: QuickImagePrompt, width: 'half', defaultH: 6 },diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex a4f42a7b62..a36016e6b7 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -65,6 +65,7 @@ grep -i "what you want to do" client/src/lib/README.md|---|---|| `brainGraphFocus.js` | Pure focus-trail (breadcrumb) transitions for BrainGraph re-focus navigation. || `graphSimulation.js` | 3D force simulation parameters for BrainGraph / CyberCity. |+| `goalFeatureMap.js` | Deterministic goal `category` → PortOS feature-area deep-link map (Daily Driver). `getGoalFeatureAreas(goal)` honors the per-goal `featureAreas` override, else the category default. Mirrored byte-for-byte from `server/lib/`. |## Generic UI / collection utilitiesdiff --git a/client/src/lib/goalFeatureMap.js b/client/src/lib/goalFeatureMap.jsnew file mode 100644index 0000000000..7f2eea4ece--- /dev/null+++ b/client/src/lib/goalFeatureMap.js@@ -0,0 +1,58 @@+// Goal → PortOS feature-area map (issue #2666).+//+// Deterministic, LLM-free registry that turns a goal's `category` (or its+// optional per-goal `featureAreas` override) into the concrete PortOS feature+// that actually moves it forward, each carrying a label, an icon name, and a+// deep-link. Every `to` path MUST be an existing route registered in+// `server/lib/navManifest.js` (`NAV_COMMANDS`) so deep-links can't drift — this+// is enforced by `server/lib/goalFeatureMap.test.js`.+//+// MIRROR: this file is kept byte-for-byte in sync with+// `server/lib/goalFeatureMap.js` (the server uses it to validate the per-goal+// `featureAreas` override and to build the same rows server-side if needed).+// `icon` is a lucide-react icon NAME (string) so this module stays React-free+// and importable from server-side tests; the widget resolves the name to a+// component at render time.++// Feature areas, keyed by a stable area id. Each `to` is a live NAV_COMMANDS path.+export const FEATURE_AREAS = {+ post: { label: 'Daily POST', to: '/post/launcher', icon: 'Brain' },+ bodyHealth: { label: 'Body Health', to: '/meatspace/health', icon: 'HeartPulse' },+ writersRoom: { label: 'Writers Room', to: '/writers-room', icon: 'PenLine' },+ universes: { label: 'Universes', to: '/universes', icon: 'Globe' },+ pipeline: { label: 'Series Pipeline', to: '/pipeline', icon: 'Clapperboard' },+ tribe: { label: 'Tribe', to: '/tribe', icon: 'Users' },+ autobiography: { label: 'Autobiography', to: '/digital-twin/autobiography', icon: 'BookOpen' },+ legacyBundle: { label: 'Legacy Bundle', to: '/digital-twin/legacy', icon: 'Package' },+ sharing: { label: 'Sharing', to: '/sharing', icon: 'Share2' },+ planMilestones:{ label: 'Plan Milestones', to: '/goals/tree', icon: 'ListTree' },+ memory: { label: 'Memory', to: '/brain/memory', icon: 'BrainCircuit' },+};++// Every valid area id — the source of truth for the per-goal override enum.+export const FEATURE_AREA_IDS = Object.keys(FEATURE_AREAS);++// Curated category → ordered feature-area ids. A goal with no override falls+// back to its category's default; an unknown category resolves to an empty list.+export const GOAL_CATEGORY_FEATURE_MAP = {+ creative: ['writersRoom', 'universes', 'pipeline'],+ family: ['tribe'],+ health: ['post', 'bodyHealth'],+ financial: ['planMilestones'],+ legacy: ['autobiography', 'legacyBundle', 'sharing'],+ mastery: ['post', 'memory'],+};++// Resolve the feature-area rows for a goal. Honors the optional per-goal+// `featureAreas` override (an ordered array of area ids) when present and+// non-empty — filtering out any unknown ids — otherwise falls back to the+// category default. Returns an array of { area, label, to, icon }.+export function getGoalFeatureAreas(goal) {+ const override = Array.isArray(goal?.featureAreas)+ ? goal.featureAreas.filter((id) => FEATURE_AREAS[id])+ : [];+ const areaIds = override.length > 0+ ? override+ : (GOAL_CATEGORY_FEATURE_MAP[goal?.category] || []);+ return areaIds.map((area) => ({ area, ...FEATURE_AREAS[area] }));+}diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex a6a5ee36c6..bd48a75256 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -42,6 +42,7 @@ export * from './wrImageDefaults.js';// === Graph & sim ===export * from './brainGraphFocus.js';export * from './graphSimulation.js';+export * from './goalFeatureMap.js';// === Generic UI / collection utilities ===export * from './a11yKeyboard.js';diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex 714d3dced5..8a9ce33bfb 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -22,6 +22,7 @@ export default function Dashboard() {const [tribeCare, setTribeCare] = useState(null);const [feeds, setFeeds] = useState(null);const [meatspaceLogging, setMeatspaceLogging] = useState(null);+ const [dailyDriver, setDailyDriver] = useState(null);const [loading, setLoading] = useState(true);const [dataError, setDataError] = useState(null);const [layoutsError, setLayoutsError] = useState(null);@@ -61,13 +62,16 @@ export default function Dashboard() {const fetchData = useCallback(async () => {setDataError(null);- const [appsData, healthData, usageData, tribeCareData, feedsData, meatspaceLoggingData] = await Promise.all([+ const [appsData, healthData, usageData, tribeCareData, feedsData, meatspaceLoggingData, dailyDriverData] = await Promise.all([api.getApps().catch((err) => { setDataError(err.message); return []; }),api.checkHealth().catch(() => null),api.getUsage().catch(() => null),api.getTribeCareSummary({ silent: true }).catch(() => null),api.getFeedStats({ silent: true }).catch(() => null),api.getMeatspaceLoggingStats({ silent: true }).catch(() => null),+ // GET records the first-visit-of-day signal (issue #2666); a failure just+ // hides the Daily Driver card via its gate. No LLM calls here.+ api.getDailyDriverState().catch(() => null),]);setApps(appsData);setHealth(healthData);@@ -75,6 +79,7 @@ export default function Dashboard() {setTribeCare(tribeCareData);setFeeds(feedsData);setMeatspaceLogging(meatspaceLoggingData);+ setDailyDriver(dailyDriverData);setLoading(false);}, []);@@ -171,8 +176,8 @@ export default function Dashboard() {}), [activeApps]);const dashboardState = useMemo(- () => ({ apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, refetch: fetchData }),- [apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, fetchData]+ () => ({ apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, refetch: fetchData }),+ [apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, fetchData]);// Falls back to a local minimal layout only AFTER the initial fetch hasdiff --git a/client/src/services/apiDashboard.js b/client/src/services/apiDashboard.jsindex 92a88cd389..ef514959a7 100644--- a/client/src/services/apiDashboard.js+++ b/client/src/services/apiDashboard.js@@ -37,3 +37,9 @@ export const saveDashboardLayout = (id, { name, widgets, grid, activateWindow })export const deleteDashboardLayout = (id) =>queueMutation(() => request(`/dashboard/layouts/${encodeURIComponent(id)}`, { method: 'DELETE' }));++// Daily Driver (issue #2666) — per-day first-visit + handled flags gating the+// Daily Driver dashboard card. GET records the visit; the caller owns error UI+// (falls back to hiding the card), so it's silent. POST marks the day handled.+export const getDailyDriverState = (options = {}) => request('/daily-driver', { silent: true, ...options });+export const markDailyDriverHandled = () => request('/daily-driver/handled', { method: 'POST' });diff --git a/server/index.js b/server/index.jsindex 2d22237a39..684127d586 100644--- a/server/index.js+++ b/server/index.js@@ -92,6 +92,7 @@ import { ensureProviderReady as ensureOllamaProviderReady, ensureRunning as ensuimport searchRoutes from './routes/search.js';import paletteRoutes from './routes/palette.js';import dashboardLayoutsRoutes from './routes/dashboardLayouts.js';+import dailyDriverRoutes from './routes/dailyDriver.js';import mediaCollectionsRoutes from './routes/mediaCollections.js';import mediaAnnotationsRoutes from './routes/mediaAnnotations.js';import mediaSketchesRoutes from './routes/mediaSketches.js';@@ -466,6 +467,7 @@ app.use('/api/screenshots', screenshotsRoutes);app.use('/api/search', searchRoutes);app.use('/api/palette', paletteRoutes);app.use('/api/dashboard/layouts', dashboardLayoutsRoutes);+app.use('/api/daily-driver', dailyDriverRoutes);app.use('/api/media/collections', mediaCollectionsRoutes);app.use('/api/media/annotations', mediaAnnotationsRoutes);app.use('/api/media/sketches', mediaSketchesRoutes);diff --git a/server/lib/README.md b/server/lib/README.mdindex 4801f454b3..3be36cb129 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -227,6 +227,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `issueLength.js` | Per-issue size targets fed into text stages. || `mediaItemKey.js` | `<kind>:<ref>` key vocabulary for media items. || `migrationMarker.js` | Shared marker-file helpers for one-time migration/repair/reconcile scripts — `markerExists(filename)` (boolean gate), `readMarker(filename)` (parsed payload or null), `writeMarker(filename, payload)` (atomic write). All anchor `filename` under `PATHS.data` and use `tryReadFile`/`atomicWrite` so a crash can't leave a truncated marker. |+| `goalFeatureMap.js` | Deterministic goal `category` → PortOS feature-area map (deep-links sourced from `NAV_COMMANDS`). `getGoalFeatureAreas(goal)` honors the per-goal `featureAreas` override, else the category default. Mirrored byte-for-byte to `client/src/lib/`. || `navManifest.js` | Single source of truth for nav (`⌘K` palette + voice). Add an entry when you add a page. || `personaTraitBlend.js` | Digital-twin persona trait-blending (M34 P7). Blends a persona's `traitAdjustments` against the base twin's communication profile + Big-Five into a "Communication Calibration" directive. Mirrored to `client/src/lib/`. || `textUtils.js` | Pure server-side prose helpers. `countWords(text)` — canonical whitespace-token count (`\S+`), the single home for what `writersRoom/local.js`, `issueLength.js`, and the client's `formatters.js` used to each re-implement. |diff --git a/server/lib/goalFeatureMap.js b/server/lib/goalFeatureMap.jsnew file mode 100644index 0000000000..7f2eea4ece--- /dev/null+++ b/server/lib/goalFeatureMap.js@@ -0,0 +1,58 @@+// Goal → PortOS feature-area map (issue #2666).+//+// Deterministic, LLM-free registry that turns a goal's `category` (or its+// optional per-goal `featureAreas` override) into the concrete PortOS feature+// that actually moves it forward, each carrying a label, an icon name, and a+// deep-link. Every `to` path MUST be an existing route registered in+// `server/lib/navManifest.js` (`NAV_COMMANDS`) so deep-links can't drift — this+// is enforced by `server/lib/goalFeatureMap.test.js`.+//+// MIRROR: this file is kept byte-for-byte in sync with+// `server/lib/goalFeatureMap.js` (the server uses it to validate the per-goal+// `featureAreas` override and to build the same rows server-side if needed).+// `icon` is a lucide-react icon NAME (string) so this module stays React-free+// and importable from server-side tests; the widget resolves the name to a+// component at render time.++// Feature areas, keyed by a stable area id. Each `to` is a live NAV_COMMANDS path.+export const FEATURE_AREAS = {+ post: { label: 'Daily POST', to: '/post/launcher', icon: 'Brain' },+ bodyHealth: { label: 'Body Health', to: '/meatspace/health', icon: 'HeartPulse' },+ writersRoom: { label: 'Writers Room', to: '/writers-room', icon: 'PenLine' },+ universes: { label: 'Universes', to: '/universes', icon: 'Globe' },+ pipeline: { label: 'Series Pipeline', to: '/pipeline', icon: 'Clapperboard' },+ tribe: { label: 'Tribe', to: '/tribe', icon: 'Users' },+ autobiography: { label: 'Autobiography', to: '/digital-twin/autobiography', icon: 'BookOpen' },+ legacyBundle: { label: 'Legacy Bundle', to: '/digital-twin/legacy', icon: 'Package' },+ sharing: { label: 'Sharing', to: '/sharing', icon: 'Share2' },+ planMilestones:{ label: 'Plan Milestones', to: '/goals/tree', icon: 'ListTree' },+ memory: { label: 'Memory', to: '/brain/memory', icon: 'BrainCircuit' },+};++// Every valid area id — the source of truth for the per-goal override enum.+export const FEATURE_AREA_IDS = Object.keys(FEATURE_AREAS);++// Curated category → ordered feature-area ids. A goal with no override falls+// back to its category's default; an unknown category resolves to an empty list.+export const GOAL_CATEGORY_FEATURE_MAP = {+ creative: ['writersRoom', 'universes', 'pipeline'],+ family: ['tribe'],+ health: ['post', 'bodyHealth'],+ financial: ['planMilestones'],+ legacy: ['autobiography', 'legacyBundle', 'sharing'],+ mastery: ['post', 'memory'],+};++// Resolve the feature-area rows for a goal. Honors the optional per-goal+// `featureAreas` override (an ordered array of area ids) when present and+// non-empty — filtering out any unknown ids — otherwise falls back to the+// category default. Returns an array of { area, label, to, icon }.+export function getGoalFeatureAreas(goal) {+ const override = Array.isArray(goal?.featureAreas)+ ? goal.featureAreas.filter((id) => FEATURE_AREAS[id])+ : [];+ const areaIds = override.length > 0+ ? override+ : (GOAL_CATEGORY_FEATURE_MAP[goal?.category] || []);+ return areaIds.map((area) => ({ area, ...FEATURE_AREAS[area] }));+}diff --git a/server/lib/goalFeatureMap.test.js b/server/lib/goalFeatureMap.test.jsnew file mode 100644index 0000000000..c4caad5827--- /dev/null+++ b/server/lib/goalFeatureMap.test.js@@ -0,0 +1,77 @@+import { describe, it, expect } from 'vitest';+import {+ FEATURE_AREAS,+ FEATURE_AREA_IDS,+ GOAL_CATEGORY_FEATURE_MAP,+ getGoalFeatureAreas,+} from './goalFeatureMap.js';+import { NAV_COMMANDS } from './navManifest.js';+import { goalCategoryEnum } from './identityValidation.js';+import * as clientMap from '../../client/src/lib/goalFeatureMap.js';++// Every route the manifest knows about (strip query strings — a feature-area+// deep-link may point at a `?ref=…` variant of a real page path).+const NAV_PATHS = new Set(NAV_COMMANDS.map((c) => c.path.split('?')[0]));++describe('goalFeatureMap — registry shape', () => {+ it('every feature area carries a label, deep-link, and icon name', () => {+ for (const [id, area] of Object.entries(FEATURE_AREAS)) {+ expect(typeof area.label, `${id}.label`).toBe('string');+ expect(area.label.length, `${id}.label`).toBeGreaterThan(0);+ expect(area.to.startsWith('/'), `${id}.to`).toBe(true);+ expect(typeof area.icon, `${id}.icon`).toBe('string');+ expect(area.icon.length, `${id}.icon`).toBeGreaterThan(0);+ }+ });++ it('every feature-area deep-link resolves to a real NAV_COMMANDS path', () => {+ for (const [id, area] of Object.entries(FEATURE_AREAS)) {+ expect(NAV_PATHS.has(area.to.split('?')[0]), `${id} → ${area.to}`).toBe(true);+ }+ });++ it('FEATURE_AREA_IDS matches the FEATURE_AREAS keys', () => {+ expect([...FEATURE_AREA_IDS].sort()).toEqual(Object.keys(FEATURE_AREAS).sort());+ });++ it('every goal category maps to known, non-empty area ids', () => {+ for (const category of goalCategoryEnum.options) {+ const ids = GOAL_CATEGORY_FEATURE_MAP[category];+ expect(Array.isArray(ids), category).toBe(true);+ expect(ids.length, category).toBeGreaterThan(0);+ for (const id of ids) expect(FEATURE_AREAS[id], `${category} → ${id}`).toBeDefined();+ }+ });+});++describe('goalFeatureMap — getGoalFeatureAreas', () => {+ it('falls back to the category default when no override is present', () => {+ const rows = getGoalFeatureAreas({ category: 'health' });+ expect(rows.map((r) => r.area)).toEqual(GOAL_CATEGORY_FEATURE_MAP.health);+ expect(rows[0]).toMatchObject({ to: '/post/launcher', label: 'Daily POST' });+ });++ it('honors a per-goal featureAreas override over the category default', () => {+ const rows = getGoalFeatureAreas({ category: 'health', featureAreas: ['universes', 'sharing'] });+ expect(rows.map((r) => r.area)).toEqual(['universes', 'sharing']);+ });++ it('drops unknown override ids and falls back when the override is all-invalid', () => {+ expect(getGoalFeatureAreas({ category: 'family', featureAreas: ['bogus'] }).map((r) => r.area))+ .toEqual(GOAL_CATEGORY_FEATURE_MAP.family);+ expect(getGoalFeatureAreas({ category: 'family', featureAreas: ['tribe', 'bogus'] }).map((r) => r.area))+ .toEqual(['tribe']);+ });++ it('returns an empty list for an unknown category with no override', () => {+ expect(getGoalFeatureAreas({ category: 'mystery' })).toEqual([]);+ });+});++describe('goalFeatureMap — server/client mirror parity', () => {+ it('server and client maps are identical', () => {+ expect(clientMap.FEATURE_AREAS).toEqual(FEATURE_AREAS);+ expect(clientMap.GOAL_CATEGORY_FEATURE_MAP).toEqual(GOAL_CATEGORY_FEATURE_MAP);+ expect([...clientMap.FEATURE_AREA_IDS].sort()).toEqual([...FEATURE_AREA_IDS].sort());+ });+});diff --git a/server/lib/identityValidation.js b/server/lib/identityValidation.jsindex 0375954193..24e12f8584 100644--- a/server/lib/identityValidation.js+++ b/server/lib/identityValidation.js@@ -1,4 +1,10 @@import { z } from 'zod';+import { FEATURE_AREA_IDS } from './goalFeatureMap.js';++// Per-goal feature-area override (issue #2666): an ordered list of feature-area+// ids the Daily Driver deep-links to for this goal, overriding the category+// default. Absent/empty → the goal falls back to its category's default map.+const featureAreasSchema = z.array(z.enum(FEATURE_AREA_IDS)).max(FEATURE_AREA_IDS.length);export const sectionStatusEnum = z.enum(['active', 'pending', 'unavailable']);@@ -69,7 +75,8 @@ export const createGoalInputSchema = z.object({parentId: z.string().min(1).nullable().optional().default(null),tags: z.array(z.string().min(1).max(50)).max(20).optional().default([]),targetDate: validCalendarDate.optional(),- timeBlockConfig: timeBlockConfigSchema.optional()+ timeBlockConfig: timeBlockConfigSchema.optional(),+ featureAreas: featureAreasSchema.optional()});export const updateGoalInputSchema = z.object({@@ -82,7 +89,8 @@ export const updateGoalInputSchema = z.object({parentId: z.string().min(1).nullable().optional(),tags: z.array(z.string().min(1).max(50)).max(20).optional(),targetDate: validCalendarDate.nullable().optional(),- timeBlockConfig: timeBlockConfigSchema.nullable().optional()+ timeBlockConfig: timeBlockConfigSchema.nullable().optional(),+ featureAreas: featureAreasSchema.optional()});export const addMilestoneInputSchema = z.object({diff --git a/server/lib/index.js b/server/lib/index.jsindex 1f6bab50b5..67d4dfe514 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -147,6 +147,7 @@ export * from './gitArgs.js';export * from './gitForge.js';export * from './gitOutputParsers.js';export * from './gitRemote.js';+export * from './goalFeatureMap.js';export * from './killWithEscalation.js';export * from './openFolder.js';export * from './processEnv.js';diff --git a/server/routes/dailyDriver.js b/server/routes/dailyDriver.jsnew file mode 100644index 0000000000..83c9e73d16--- /dev/null+++ b/server/routes/dailyDriver.js@@ -0,0 +1,30 @@+/**+ * Daily Driver state (issue #2666).+ *+ * GET /api/daily-driver → { today, firstVisitToday, handledToday } (records the visit)+ * POST /api/daily-driver/handled → { today, firstVisitToday, handledToday } (marks the day handled)+ *+ * No LLM calls — this only reads/writes per-day flags (AI Provider Usage Policy).+ */++import { Router } from 'express';+import { asyncHandler } from '../lib/errorHandler.js';+import * as dailyDriver from '../services/dailyDriver.js';++const router = Router();++// GET records the landing so `firstVisitToday` flips false after the first hit+// of the local day (subsequent same-day fetches still report handledToday, so+// the card stays visible until the user handles it).+router.get('/', asyncHandler(async (req, res) => {+ const state = await dailyDriver.getAndRecordVisit();+ res.json(state);+}));++// POST marks the driver handled for today — the card self-hides on the next read.+router.post('/handled', asyncHandler(async (req, res) => {+ const state = await dailyDriver.markDriverHandled();+ res.json(state);+}));++export default router;diff --git a/server/services/dailyDriver.js b/server/services/dailyDriver.jsnew file mode 100644index 0000000000..04fb1e0567--- /dev/null+++ b/server/services/dailyDriver.js@@ -0,0 +1,87 @@+// Daily Driver state (issue #2666).+//+// Tracks two timezone-correct, per-day signals that gate the Daily Driver+// dashboard card:+// - firstVisitToday — the user's FIRST landing of the current local day+// (used to decide whether to surface / auto-expand the driver).+// - handledToday — the user has completed or dismissed the driver for the+// current local day (the card self-hides once this is set).+//+// State is a tiny per-install file; there are ZERO LLM calls here — this module+// only reads/writes flags, honoring the AI Provider Usage Policy (nothing fires+// on first visit or boot).++import { join } from 'path';+import { atomicWrite, ensureDir, PATHS, readJSONFile } from '../lib/fileUtils.js';+import { getUserTimezone, todayInTimezone } from '../lib/timezone.js';++const FILE = join(PATHS.data, 'daily-driver.json');++/**+ * Pure: derive the driver state for `today` (YYYY-MM-DD) from a stored record.+ * `firstVisitToday` is true when the last recorded visit was NOT today (a fresh+ * day or a never-visited install); `handledToday` is true when the driver was+ * marked handled today. Sentinel discipline: absent markers (null) mean+ * "never" — a never-visited install correctly reports firstVisitToday=true.+ */+export function computeDriverState(record, today) {+ const lastVisitDay = record?.lastVisitDay || null;+ const handledDay = record?.handledDay || null;+ return {+ today,+ firstVisitToday: lastVisitDay !== today,+ handledToday: handledDay === today,+ };+}++async function load() {+ return (await readJSONFile(FILE, null)) || {};+}++async function save(record) {+ await ensureDir(PATHS.data);+ await atomicWrite(FILE, record);+}++async function localToday() {+ const tz = await getUserTimezone();+ return todayInTimezone(tz);+}++/**+ * Read the driver state and record this visit. The returned state reflects the+ * record as it was BEFORE this visit (so `firstVisitToday` is true exactly once+ * per local day, on the first landing), then stamps `lastVisitDay = today`.+ */+export async function getAndRecordVisit() {+ const today = await localToday();+ const record = await load();+ const state = computeDriverState(record, today);+ if (record.lastVisitDay !== today) {+ record.lastVisitDay = today;+ await save(record);+ }+ return state;+}++/**+ * Read the driver state WITHOUT recording a visit (idempotent peek — used by+ * re-fetches after the first landing so the card can stay visible until handled).+ */+export async function getDriverState() {+ const today = await localToday();+ return computeDriverState(await load(), today);+}++/**+ * Mark the driver handled for today (user completed or dismissed the card).+ * Also stamps `lastVisitDay` so a same-day reload doesn't re-flag a first visit.+ */+export async function markDriverHandled() {+ const today = await localToday();+ const record = await load();+ record.handledDay = today;+ record.lastVisitDay = today;+ await save(record);+ return computeDriverState(record, today);+}diff --git a/server/services/dailyDriver.test.js b/server/services/dailyDriver.test.jsnew file mode 100644index 0000000000..ae0857616c--- /dev/null+++ b/server/services/dailyDriver.test.js@@ -0,0 +1,81 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';++// In-memory stand-ins for the persistence + timezone deps so the service tests+// exercise the visit/handled state machine without touching disk or settings.+let fileStore = null;+vi.mock('../lib/fileUtils.js', () => ({+ PATHS: { data: '/tmp/portos-test' },+ ensureDir: vi.fn(async () => {}),+ atomicWrite: vi.fn(async (_path, data) => { fileStore = data; }),+ readJSONFile: vi.fn(async () => fileStore),+}));++let mockToday = '2026-07-16';+vi.mock('../lib/timezone.js', () => ({+ getUserTimezone: vi.fn(async () => 'UTC'),+ todayInTimezone: vi.fn(() => mockToday),+}));++import {+ computeDriverState,+ getAndRecordVisit,+ getDriverState,+ markDriverHandled,+} from './dailyDriver.js';++beforeEach(() => {+ fileStore = null;+ mockToday = '2026-07-16';+});++describe('computeDriverState (pure gate)', () => {+ it('reports firstVisitToday for a never-visited install', () => {+ expect(computeDriverState(null, '2026-07-16')).toEqual({+ today: '2026-07-16', firstVisitToday: true, handledToday: false,+ });+ });++ it('reports firstVisitToday when the last visit was a prior day', () => {+ const s = computeDriverState({ lastVisitDay: '2026-07-15', handledDay: '2026-07-15' }, '2026-07-16');+ expect(s.firstVisitToday).toBe(true);+ expect(s.handledToday).toBe(false);+ });++ it('clears firstVisitToday once today has been visited', () => {+ expect(computeDriverState({ lastVisitDay: '2026-07-16' }, '2026-07-16').firstVisitToday).toBe(false);+ });++ it('reports handledToday only when handled on the current day', () => {+ expect(computeDriverState({ handledDay: '2026-07-16' }, '2026-07-16').handledToday).toBe(true);+ expect(computeDriverState({ handledDay: '2026-07-15' }, '2026-07-16').handledToday).toBe(false);+ });+});++describe('dailyDriver service (visit / handled lifecycle)', () => {+ it('first GET reports firstVisitToday, then records the visit so the next GET does not', async () => {+ const first = await getAndRecordVisit();+ expect(first).toEqual({ today: '2026-07-16', firstVisitToday: true, handledToday: false });++ const second = await getAndRecordVisit();+ expect(second.firstVisitToday).toBe(false);+ expect(second.handledToday).toBe(false);+ });++ it('markDriverHandled sets handledToday and survives a same-day peek', async () => {+ await getAndRecordVisit();+ const handled = await markDriverHandled();+ expect(handled.handledToday).toBe(true);+ expect((await getDriverState()).handledToday).toBe(true);+ });++ it('a new local day resets both flags', async () => {+ await getAndRecordVisit();+ await markDriverHandled();+ expect((await getDriverState()).handledToday).toBe(true);++ mockToday = '2026-07-17';+ const nextDay = await getDriverState();+ expect(nextDay.firstVisitToday).toBe(true);+ expect(nextDay.handledToday).toBe(false);+ });+});diff --git a/server/services/dashboardLayouts.js b/server/services/dashboardLayouts.jsindex ea6874b982..638bfea16e 100644--- a/server/services/dashboardLayouts.js+++ b/server/services/dashboardLayouts.js@@ -149,17 +149,20 @@ const DEFAULT_LAYOUTS = [id: 'morning-review',name: 'Morning Review',builtIn: true,- widgets: ['proactive-alerts', 'upcoming-tasks', 'review-hub', 'goal-progress', 'death-clock'],- // Scan-and-act morning ritual — all 5 widgets above the fold.- // Tasks list takes the tall center column (the actionable hot zone);- // alerts top-left grab attention first; death-clock top-right for- // mortality framing; review + goals fill the remaining quadrants.+ widgets: ['daily-driver', 'proactive-alerts', 'upcoming-tasks', 'review-hub', 'goal-progress', 'death-clock'],+ // Scan-and-act morning ritual. The Daily Driver (#2666) is pinned full-width+ // at the very top — the first-visit-of-day sequence (POST → goal+ // next-actions) — and self-hides once handled, collapsing the layout back to+ // the classic scan quadrants below it. Tasks list takes the tall center+ // column (the actionable hot zone); alerts top-left grab attention first;+ // death-clock top-right for mortality framing; review + goals fill the rest.grid: [- { id: 'proactive-alerts', x: 0, y: 0, w: 4, h: 4 },- { id: 'upcoming-tasks', x: 4, y: 0, w: 5, h: 8 },- { id: 'death-clock', x: 9, y: 0, w: 3, h: 2 },- { id: 'goal-progress', x: 9, y: 2, w: 3, h: 4 },- { id: 'review-hub', x: 0, y: 4, w: 4, h: 4 },+ { id: 'daily-driver', x: 0, y: 0, w: 12, h: 6 },+ { id: 'proactive-alerts', x: 0, y: 6, w: 4, h: 4 },+ { id: 'upcoming-tasks', x: 4, y: 6, w: 5, h: 8 },+ { id: 'death-clock', x: 9, y: 6, w: 3, h: 2 },+ { id: 'goal-progress', x: 9, y: 8, w: 3, h: 4 },+ { id: 'review-hub', x: 0, y: 10, w: 4, h: 4 },],},{diff --git a/server/services/identity/goals.js b/server/services/identity/goals.jsindex 2619cbd094..a79590cf4b 100644--- a/server/services/identity/goals.js+++ b/server/services/identity/goals.js@@ -185,6 +185,7 @@ export async function getGoals() {if (!Array.isArray(goal.tags)) { goal.tags = []; needsSave = true; }if (!Array.isArray(goal.linkedActivities)) { goal.linkedActivities = []; needsSave = true; }if (!Array.isArray(goal.linkedCalendars)) { goal.linkedCalendars = []; needsSave = true; }+ if (!Array.isArray(goal.featureAreas)) { goal.featureAreas = []; needsSave = true; }if (goal.progress === undefined) { goal.progress = 0; needsSave = true; }if (!Array.isArray(goal.progressHistory)) { goal.progressHistory = []; needsSave = true; }if (!Array.isArray(goal.todos)) { goal.todos = []; needsSave = true; }@@ -232,7 +233,7 @@ export async function setBirthDate(birthDate) {return goals;}-export async function createGoal({ title, description, horizon, category, goalType, parentId, tags, targetDate, timeBlockConfig }) {+export async function createGoal({ title, description, horizon, category, goalType, parentId, tags, targetDate, timeBlockConfig, featureAreas }) {const goals = await getGoals();const longevity = await loadJSON(LONGEVITY_FILE, DEFAULT_LONGEVITY);@@ -253,6 +254,7 @@ export async function createGoal({ title, description, horizon, category, goalTytags: [...new Set((tags || []).map(t => t.trim()).filter(Boolean))],linkedActivities: [],linkedCalendars: [],+ featureAreas: Array.isArray(featureAreas) ? featureAreas : [],targetDate: targetDate || null,timeBlockConfig: timeBlockConfig || null,scheduledEvents: [],@@ -297,7 +299,7 @@ export async function updateGoal(goalId, updates) {}}- const allowed = ['title', 'description', 'horizon', 'category', 'goalType', 'status', 'parentId', 'tags', 'targetDate', 'timeBlockConfig'];+ const allowed = ['title', 'description', 'horizon', 'category', 'goalType', 'status', 'parentId', 'tags', 'targetDate', 'timeBlockConfig', 'featureAreas'];for (const key of allowed) {if (updates[key] !== undefined) goal[key] = updates[key];}