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(cybercity): Phase 1 operational legibility
Adam Eivyd6720be0a029
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 54d1ebe4f7..d7fb709ab6 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,6 +2,8 @@## Changed+- **CyberCity — Phase 1 operational legibility.** Turned the city from a decorative scene into an interactive systems map you can actually run PortOS from. The cryptic weather glyph in the HUD ("//", "%%", "||") is replaced by a plain CPU / MEM / DISK card with a single colored sentinel dot (cyan→amber→red), backed by `/api/system/health/details` polled every 15s; atmospheric weather still drives the sky, but the readout you read is just numbers. Every HUD stat is now clickable: AGENTS jumps to `/cos`, REVIEW to `/review`, NODES to `/instances`, TASKS / STREAK to `/cos`, STOPPED / ARCHIVED to `/apps`, the health row to `/`. Replaced the right-side activity-log panel with a tabbed Intel pane: an `ATTENTION` tab (default) ranks stopped apps, errored PM2 processes, system warnings, pending reviews, federation peers offline, failed agents, and unread notifications by severity — every item is a button that navigates to the relevant page; the live event log is still there as the `ACTIVITY` tab. Added a top-center filter bar with status chips (All / Online / Stopped / Errored / Agent) plus a `/`-key search overlay; non-matching buildings dim to 25% opacity in the 3D scene so you keep spatial context while finding the one you want, and Enter on the search bar jumps to the first match's app page. Documentation: rewrote `docs/features/cybercity-v2.md` to unify the operational-legibility track with the existing atmospheric roadmap into a single 3-phase plan, and shifted the design rule from "read-only" to "interactive systems map" — explicit user-initiated actions (restart, deploy, jump to logs) are now allowed, but the city still can't mutate goals/tasks/notes/memory. Files: `docs/features/cybercity-v2.md`, `PLAN.md`, `client/src/hooks/useCityData.js`, `client/src/pages/CyberCity.jsx`, `client/src/components/city/{CityHud.jsx,CityScene.jsx,BuildingCluster.jsx,Borough.jsx,Building.jsx,CityIntelPane.jsx,CityFilterBar.jsx}` (the last two new). Removed: `client/src/components/city/CityActivityLog.jsx` (its content is now a tab inside `CityIntelPane`).+- **PortOS brand mark + favicon refresh.** Replaced the old portal-ring SVG logo with the new PortOS brand image (`client/public/portos-logo.png`, 512×512). The `Logo` component now renders a `<PortOSMark>` `<img>` so the full-color PNG ships verbatim — the previous `currentColor` SVG variant (and the unused `LogoGrid` / `LogoAnchor` / `LogoHex` / `LogoP` alternates) are removed. `AppIcon`'s `portos` glyph delegates to the same mark so the bookmarked-app tile matches the chrome. Sidebar and mobile-header logos go from `size=18/24` to `22/28` and drop the `text-port-accent` tint now that the artwork is its own color. Favicon, apple-touch-icon, and 192/512 PWA icons regenerated from the new artwork; `favicon.svg` simplified to embed `/portos-logo.png` for SVG-favicon-only browsers; `client/index.html` switches the primary `rel="icon"` to the PNG and updates `theme-color` to `#070B12` (matched in `manifest.json`'s `theme_color` + `background_color`). Added `docs/media/portos-logo.png` and embedded it in the README header. `.gitignore` keeps the global `*.png` ignore but allowlists the two committed brand PNGs so future contributors don't have to remember `git add -f`. Files: `client/src/components/Logo.jsx`, `client/src/components/AppIcon.jsx`, `client/src/components/Layout.jsx`, `client/index.html`, `client/public/{favicon.svg,favicon.ico,apple-touch-icon.png,icon-192.png,icon-512.png,manifest.json,portos-logo.png}`, `docs/media/portos-logo.png`, `README.md`, `.gitignore`.## Fixeddiff --git a/PLAN.md b/PLAN.mdindex f3506f017e..984fee1690 100644--- a/PLAN.md+++ b/PLAN.md@@ -15,7 +15,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [DONE.md]- [ ] **Voice CoS tool expansion** — `calendar_today` / `calendar_next` (Google Calendar via existing MCP), `meatspace_log_workout` (wraps `meatspaceHealth.js`), `weather_now` (needs API choice — OpenWeather / WeatherKit / NWS), `timer_set` (reuses `agentActionExecutor.js` scheduled actions).- [ ] **Voice agent vision fallback** — `ui_describe_visually` tool: screenshot the current tab (or a named canvas/chart) and send to a vision-capable model so "what's on this chart?" works on non-DOM content (CyberCity, graph views). Depends on a vision provider in `portos-ai-toolkit`.- [ ] **Voice agent — explicit long-term memory routing** — On "remember that …", auto-route to `brain_capture` and inject top-N relevant memories into the voice turn's system prompt via `brain_search`. Some of this is ambient today; make it explicit and self-improving.-- [ ] **CyberCity v2** — Transform from decorative scene to living systems dashboard. See [cybercity-v2.md](./docs/features/cybercity-v2.md). Top priorities: system health atmosphere, richer billboards, brain inbox pulse, agent activity visualization, chronotype energy overlay.+- [ ] **CyberCity v2** — Transform from decorative scene to interactive systems map. See [cybercity-v2.md](./docs/features/cybercity-v2.md). Phase 1 (operational legibility) underway: per-building health glyphs, "needs attention" pane, search overlay, status filter chips, clickable HUD stats, hover preview with quick actions, mobile/touch support.- [ ] **M50 P9 — CoS Automation & Rules** — Automated email classification, rule-based pre-filtering, email-to-task pipeline.- [ ] **M50 P10 — Auto-Send with AI Review Gate** — Per-account/per-recipient trust level + dual-LLM review (drafter + reviewer). Only auto-send when both approve or trust ≥ 0.9. See [Messages Security](./docs/features/messages-security.md).- [ ] **M34 P5-P7 — Digital Twin** — Multi-modal capture (voice/video/image identity sources), advanced testing, personas. Ties to GOALS.md secondary "Multi-Modal Identity Capture".diff --git a/client/src/components/city/Borough.jsx b/client/src/components/city/Borough.jsxindex b0386ccd83..ca74e0c396 100644--- a/client/src/components/city/Borough.jsx+++ b/client/src/components/city/Borough.jsx@@ -13,7 +13,7 @@ const hashString = (str) => {return Math.abs(hash);};-export default function Borough({ app, position, agentMap, onBuildingClick, playSfx, neonBrightness, isProximity }) {+export default function Borough({ app, position, agentMap, onBuildingClick, playSfx, neonBrightness, isProximity, dimmed = false }) {const agentData = agentMap.get(app.id);const agents = agentData?.agents || [];const height = getBuildingHeight(app);@@ -53,6 +53,7 @@ export default function Borough({ app, position, agentMap, onBuildingClick, playplaySfx={playSfx}neonBrightness={neonBrightness}isProximity={isProximity}+ dimmed={dimmed}/>{/* Process buildings in ring around main building */}diff --git a/client/src/components/city/Building.jsx b/client/src/components/city/Building.jsxindex 897b5d9238..8f4c618903 100644--- a/client/src/components/city/Building.jsx+++ b/client/src/components/city/Building.jsx@@ -267,7 +267,7 @@ function NeonEdgeStrip({ position, height, color, delay }) {);}-export default function Building({ app, position, agentCount, onClick, playSfx, neonBrightness = 1.2, isProximity = false }) {+export default function Building({ app, position, agentCount, onClick, playSfx, neonBrightness = 1.2, isProximity = false, dimmed = false }) {const meshRef = useRef();const glowRef = useRef();const haloRef = useRef();@@ -279,6 +279,10 @@ export default function Building({ app, position, agentCount, onClick, playSfx,const isOnline = app.overallStatus === 'online' && !app.archived;const isStopped = app.overallStatus === 'stopped' && !app.archived;const { width, depth } = BUILDING_PARAMS;+ // Single multiplier applied to every opacity in the building when the search+ // / status filter doesn't match this app. Faded enough to recede visually+ // without disappearing — the user keeps spatial context.+ const dimMul = dimmed ? 0.25 : 1;// Name hash for seeded randomnessconst seed = useMemo(() => {@@ -314,17 +318,18 @@ export default function Building({ app, position, agentCount, onClick, playSfx,? Math.sin(t * 3.5 + seed) * 0.2 * nb: 0;const hoverBoost = hovered ? 0.4 * nb : 0;- meshRef.current.material.emissiveIntensity = baseIntensity + pulse + hoverBoost;+ meshRef.current.material.emissiveIntensity = (baseIntensity + pulse + hoverBoost) * dimMul;if (glowRef.current) {- glowRef.current.material.opacity = 0.35 + (isOnline ? Math.sin(t * 1.5) * 0.12 : 0) + (hovered ? 0.25 : 0);+ glowRef.current.material.opacity = (0.35 + (isOnline ? Math.sin(t * 1.5) * 0.12 : 0) + (hovered ? 0.25 : 0)) * dimMul;}// Glow halo wireframe pulseif (haloRef.current) {- haloRef.current.material.opacity = hovered+ const haloBase = hovered? 0.15 + Math.sin(t * 8) * 0.1: 0.05 + Math.sin(t * 1.5 + seed) * 0.03;+ haloRef.current.material.opacity = haloBase * dimMul;}});@@ -342,10 +347,10 @@ export default function Building({ app, position, agentCount, onClick, playSfx,<meshStandardMaterialcolor={CITY_COLORS.buildingBody}emissive={edgeColor}- emissiveIntensity={0.35 * neonBrightness}+ emissiveIntensity={0.35 * neonBrightness * dimMul}map={windowTexture}transparent- opacity={app.archived ? 0.6 : 0.95}+ opacity={(app.archived ? 0.6 : 0.95) * dimMul}/></mesh>@@ -354,7 +359,7 @@ export default function Building({ app, position, agentCount, onClick, playSfx,<lineBasicMaterialcolor={edgeColor}transparent- opacity={app.archived ? 0.5 : 0.9}+ opacity={(app.archived ? 0.5 : 0.9) * dimMul}/></lineSegments>diff --git a/client/src/components/city/BuildingCluster.jsx b/client/src/components/city/BuildingCluster.jsxindex fda582524f..aa0608e39f 100644--- a/client/src/components/city/BuildingCluster.jsx+++ b/client/src/components/city/BuildingCluster.jsx@@ -4,7 +4,7 @@ import { computeCityLayout } from './cityLayout';import { DISTRICT_PARAMS, PIXEL_FONT_URL } from './cityConstants';import Borough from './Borough';-export default function BuildingCluster({ apps, agentMap, onBuildingClick, onPositionsReady, playSfx, settings, proximityAppId }) {+export default function BuildingCluster({ apps, agentMap, onBuildingClick, onPositionsReady, playSfx, settings, proximityAppId, dimmedAppIds }) {const positions = useMemo(() => computeCityLayout(apps), [apps]);// Notify parent when positions change (for data streams, roads, traffic)@@ -38,6 +38,7 @@ export default function BuildingCluster({ apps, agentMap, onBuildingClick, onPosplaySfx={playSfx}neonBrightness={settings?.neonBrightness ?? 1.2}isProximity={proximityAppId === app.id}+ dimmed={dimmedAppIds?.has?.(app.id) || false}/>);})}diff --git a/client/src/components/city/CityActivityLog.jsx b/client/src/components/city/CityActivityLog.jsxdeleted file mode 100644index ed3680dc0f..0000000000--- a/client/src/components/city/CityActivityLog.jsx+++ /dev/null@@ -1,80 +0,0 @@-import { useRef, useEffect, useState } from 'react';--const LEVEL_COLORS = {- info: 'text-cyan-400',- warn: 'text-amber-400',- error: 'text-red-400',- success: 'text-emerald-400',- debug: 'text-gray-500',-};--const LEVEL_INDICATORS = {- info: 'bg-cyan-400',- warn: 'bg-amber-400',- error: 'bg-red-400',- success: 'bg-emerald-400',- debug: 'bg-gray-600',-};--export default function CityActivityLog({ logs }) {- const scrollRef = useRef(null);- const [collapsed, setCollapsed] = useState(false);-- useEffect(() => {- if (scrollRef.current) {- scrollRef.current.scrollTop = scrollRef.current.scrollHeight;- }- }, [logs]);-- if (logs.length === 0) return null;-- return (- <div className={`absolute top-16 right-3 ${collapsed ? '' : 'bottom-20'} w-72 pointer-events-auto`}>- <div className={`${collapsed ? '' : 'h-full'} bg-black/80 backdrop-blur-sm border border-cyan-500/25 rounded-lg overflow-hidden flex flex-col`}>- <button- onClick={() => setCollapsed(!collapsed)}- className="flex items-center justify-between px-3 py-2 border-b border-cyan-500/20 hover:bg-cyan-500/5 transition-colors"- >- <span className="text-cyan-400 text-[11px] font-pixel tracking-wider font-bold">- ACTIVITY LOG- </span>- <div className="flex items-center gap-2">- <span className="font-pixel text-[9px] text-cyan-500/40">{logs.length}</span>- <span className="font-pixel text-[10px] text-cyan-500/50">- {collapsed ? '[+]' : '[-]'}- </span>- </div>- </button>- {!collapsed && (- <div- ref={scrollRef}- className="flex-1 overflow-y-auto px-3 py-1.5 space-y-1"- style={{ scrollbarWidth: 'thin', scrollbarColor: 'rgba(6,182,212,0.2) transparent' }}- >- {logs.slice(-40).map((log, i) => {- const level = log.level || 'info';- const colorClass = LEVEL_COLORS[level] || LEVEL_COLORS.info;- const indicatorClass = LEVEL_INDICATORS[level] || LEVEL_INDICATORS.info;- const time = log.timestamp- ? new Date(log.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })- : '';- const message = log.message || log.event || JSON.stringify(log);-- return (- <div- key={i}- className="font-pixel text-[9px] leading-tight flex items-start gap-1.5 tracking-wide group hover:bg-cyan-500/5 rounded px-1 py-0.5 -mx-1 transition-colors"- title={message}- >- <span className={`w-1 h-1 rounded-full ${indicatorClass} shrink-0 mt-1 opacity-70`} />- <span className="text-gray-500 shrink-0">{time}</span>- <span className={`${colorClass} truncate group-hover:whitespace-normal group-hover:break-all`}>{message}</span>- </div>- );- })}- </div>- )}- </div>- </div>- );-}diff --git a/client/src/components/city/CityFilterBar.jsx b/client/src/components/city/CityFilterBar.jsxnew file mode 100644index 0000000000..7451816adf--- /dev/null+++ b/client/src/components/city/CityFilterBar.jsx@@ -0,0 +1,142 @@+import { useEffect, useRef, useState } from 'react';++const STATUS_FILTERS = [+ { id: 'all', label: 'ALL', match: () => true },+ { id: 'online', label: 'ONLINE', match: (app) => !app.archived && app.overallStatus === 'online' },+ { id: 'stopped', label: 'STOPPED', match: (app) => !app.archived && app.overallStatus === 'stopped' },+ {+ id: 'errored',+ label: 'ERRORED',+ match: (app) => {+ if (app.archived) return false;+ const pm2 = app.pm2Status || {};+ return Object.values(pm2).some(s => s?.status === 'errored');+ },+ },+ {+ id: 'agent',+ label: 'AGENT',+ match: (app, { agentMap }) => agentMap?.has?.(app.id),+ },+];++// Compute the set of app IDs that should be dimmed in the 3D scene given the+// current filter + search query. The complement (matching apps) renders at full+// brightness; matches are also returned so a focus/jump action can use them.+export function computeFilterResult({ apps, status, search, agentMap }) {+ const matcher = STATUS_FILTERS.find(f => f.id === status) || STATUS_FILTERS[0];+ const trimmed = (search || '').trim().toLowerCase();+ const matches = [];+ const dimmed = new Set();++ (apps || []).forEach(app => {+ const passesStatus = matcher.match(app, { agentMap });+ const haystack = [app.name, app.id, ...(app.tags || [])]+ .filter(Boolean)+ .join(' ')+ .toLowerCase();+ const passesSearch = trimmed.length === 0 || haystack.includes(trimmed);+ if (passesStatus && passesSearch) {+ matches.push(app);+ } else {+ dimmed.add(app.id);+ }+ });++ return { matches, dimmed };+}++export default function CityFilterBar({ apps, agentMap, filter, onChange, matchCount, onJumpToFirst }) {+ const inputRef = useRef(null);+ const [open, setOpen] = useState(Boolean(filter.search));++ // Press '/' to open search and focus input. Esc clears the query.+ useEffect(() => {+ const onKey = (e) => {+ const tag = e.target?.tagName;+ const isTyping = tag === 'INPUT' || tag === 'TEXTAREA' || e.target?.isContentEditable;+ if (e.key === '/' && !isTyping && !e.metaKey && !e.ctrlKey && !e.altKey) {+ e.preventDefault();+ setOpen(true);+ setTimeout(() => inputRef.current?.focus(), 0);+ return;+ }+ if (e.key === 'Escape') {+ if (filter.search) onChange({ ...filter, search: '' });+ setOpen(false);+ inputRef.current?.blur();+ }+ };+ window.addEventListener('keydown', onKey);+ return () => window.removeEventListener('keydown', onKey);+ }, [filter, onChange]);++ const handleSubmit = (e) => {+ e.preventDefault();+ onJumpToFirst?.();+ };++ const chipBaseClass = 'font-pixel text-[9px] tracking-wider px-2 py-1 rounded border transition-colors';++ return (+ <div className="pointer-events-auto bg-black/85 backdrop-blur-sm border border-cyan-500/30 rounded-lg px-2 py-2 flex items-center gap-2 flex-wrap">+ {/* Status chips */}+ <div className="flex items-center gap-1">+ {STATUS_FILTERS.map(f => {+ const active = filter.status === f.id;+ return (+ <button+ key={f.id}+ type="button"+ onClick={() => onChange({ ...filter, status: f.id })}+ className={`${chipBaseClass} ${+ active+ ? 'border-cyan-400/70 bg-cyan-500/15 text-cyan-300 shadow-[0_0_4px_rgba(6,182,212,0.3)]'+ : 'border-cyan-500/20 text-cyan-500/50 hover:border-cyan-400/50 hover:text-cyan-300'+ }`}+ title={`Show ${f.label.toLowerCase()} only`}+ >+ {f.label}+ </button>+ );+ })}+ </div>++ <div className="w-px h-5 bg-cyan-500/20" />++ {/* Search */}+ {!open ? (+ <button+ type="button"+ onClick={() => { setOpen(true); setTimeout(() => inputRef.current?.focus(), 0); }}+ className={`${chipBaseClass} border-cyan-500/20 text-cyan-500/50 hover:border-cyan-400/50 hover:text-cyan-300 flex items-center gap-1.5`}+ title="Search apps (press /)"+ >+ <svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>+ <circle cx="11" cy="11" r="7" />+ <path d="m20 20-3-3" strokeLinecap="round" />+ </svg>+ SEARCH+ <span className="font-pixel text-[8px] text-cyan-500/40 px-1 border border-cyan-500/20 rounded">/</span>+ </button>+ ) : (+ <form onSubmit={handleSubmit} className="flex items-center gap-1.5">+ <input+ ref={inputRef}+ type="text"+ value={filter.search}+ onChange={(e) => onChange({ ...filter, search: e.target.value })}+ onBlur={() => { if (!filter.search) setOpen(false); }}+ placeholder="search apps…"+ className="font-pixel text-[10px] tracking-wide bg-black/60 border border-cyan-500/30 rounded px-2 py-1 text-cyan-300 placeholder:text-cyan-500/30 focus:outline-none focus:border-cyan-400/70 w-32"+ />+ {filter.search && (+ <span className="font-pixel text-[8px] text-cyan-500/50 tracking-wider">+ {matchCount} {matchCount === 1 ? 'MATCH' : 'MATCHES'}+ </span>+ )}+ </form>+ )}+ </div>+ );+}diff --git a/client/src/components/city/CityHud.jsx b/client/src/components/city/CityHud.jsxindex b87c639caa..2b73731083 100644--- a/client/src/components/city/CityHud.jsx+++ b/client/src/components/city/CityHud.jsx@@ -1,7 +1,8 @@import { useState, useEffect, useMemo, useRef } from 'react';import { useNavigate, useLocation } from 'react-router-dom';-import CityActivityLog from './CityActivityLog';+import CityIntelPane from './CityIntelPane';import CityAgentBar from './CityAgentBar';+import CityFilterBar from './CityFilterBar';// WASD controls hint shown briefly on first exploration entryfunction ControlsHint({ visible }) {@@ -55,13 +56,23 @@ const formatUptime = (seconds) => {return `${s}s`;};-// Weather status text based on system health-const getWeatherStatus = (onlineRatio) => {- if (onlineRatio >= 1.0) return { text: 'CLEAR', color: 'text-emerald-400', icon: '//', desc: 'All systems operational' };- if (onlineRatio >= 0.8) return { text: 'FAIR', color: 'text-cyan-400', icon: '~', desc: 'Minor issues detected' };- if (onlineRatio >= 0.5) return { text: 'OVERCAST', color: 'text-amber-400', icon: '%%', desc: 'Multiple systems down' };- if (onlineRatio >= 0.2) return { text: 'RAIN', color: 'text-orange-400', icon: '||', desc: 'Significant outages' };- return { text: 'STORM', color: 'text-red-400', icon: '!!', desc: 'Critical system failure' };+// Sentinel dot color for the system-health card. Reads from systemHealth.overallHealth+// when available, falls back to onlineRatio if the health endpoint is offline.+const getHealthSentinel = (systemHealth, onlineRatio) => {+ if (systemHealth?.overallHealth === 'critical') return { dot: 'bg-red-400', text: 'text-red-400', label: 'CRITICAL' };+ if (systemHealth?.overallHealth === 'warning') return { dot: 'bg-amber-400', text: 'text-amber-400', label: 'WARN' };+ if (systemHealth?.overallHealth === 'healthy') return { dot: 'bg-emerald-400', text: 'text-emerald-400', label: 'OK' };+ if (onlineRatio >= 0.8) return { dot: 'bg-cyan-400', text: 'text-cyan-400', label: 'OK' };+ if (onlineRatio >= 0.5) return { dot: 'bg-amber-400', text: 'text-amber-400', label: 'WARN' };+ return { dot: 'bg-red-400', text: 'text-red-400', label: 'CRIT' };+};++// Color a metric percentage cyan→amber→red so the eye can scan the row at a glance.+const metricColor = (pct) => {+ if (pct == null) return 'text-gray-500';+ if (pct >= 90) return 'text-red-400';+ if (pct >= 75) return 'text-amber-400';+ return 'text-cyan-400';};// Animated corner decoration for HUD panels@@ -136,7 +147,7 @@ function HealthBar({ value, max, color }) {);}-export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, reviewCounts, instances, productivityData, onToggleExploration, explorationMode }) {+export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, reviewCounts, instances, productivityData, systemHealth, notificationCounts, filter, onFilterChange, onJumpToFirst, matchCount, onToggleExploration, explorationMode }) {const navigate = useNavigate();const location = useLocation();const [time, setTime] = useState(new Date());@@ -155,7 +166,10 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, conconst archivedApps = apps.filter(a => a.archived).length;const onlineRatio = totalApps > 0 ? activeApps / totalApps : 1;- const weather = useMemo(() => getWeatherStatus(onlineRatio), [onlineRatio]);+ const sentinel = useMemo(() => getHealthSentinel(systemHealth, onlineRatio), [systemHealth, onlineRatio]);+ const cpuPct = systemHealth?.system?.cpu?.usagePercent;+ const memPct = systemHealth?.system?.memory?.usagePercent;+ const diskPct = systemHealth?.system?.disk?.usagePercent;const pendingReview = reviewCounts?.total || 0;const alertCount = reviewCounts?.alert || 0;const peers = instances?.peers || [];@@ -213,77 +227,145 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con</span></div>- {/* Weather (system health) */}- <div className="flex items-center justify-between gap-6" title={weather.desc}>- <span className="font-pixel text-[10px] text-gray-400 tracking-wide">WEATHER</span>- <span className={`font-pixel text-[11px] ${weather.color}`}>- <span className="opacity-60 mr-1">{weather.icon}</span>{weather.text}+ {/* Health card: CPU / MEM / DISK with a single-glance sentinel.+ Replaces the cryptic weather glyph — atmospheric weather still+ lives in CityWeather, but the HUD readout is plain numbers. */}+ <button+ type="button"+ onClick={() => navigate('/')}+ className="w-full flex items-center justify-between gap-3 -mx-1 px-1 py-1 rounded hover:bg-cyan-500/5 transition-colors"+ title={systemHealth?.warnings?.length ? systemHealth.warnings.map(w => w.message).join(' · ') : 'System health — click to open dashboard'}+ >+ <span className="font-pixel text-[10px] text-gray-400 tracking-wide flex items-center gap-1.5">+ <span className={`w-1.5 h-1.5 rounded-full ${sentinel.dot} shadow-[0_0_4px_currentColor]`} />+ HEALTH</span>+ <span className="font-pixel text-[10px] tracking-wide flex items-center gap-2">+ <span className={metricColor(cpuPct)}>{cpuPct != null ? `${cpuPct}%` : '—'}</span>+ <span className="text-gray-600">/</span>+ <span className={metricColor(memPct)}>{memPct != null ? `${memPct}%` : '—'}</span>+ <span className="text-gray-600">/</span>+ <span className={metricColor(diskPct)}>{diskPct != null ? `${diskPct}%` : '—'}</span>+ </span>+ </button>+ <div className="flex items-center justify-between gap-6 -mt-0.5">+ <span className="font-pixel text-[8px] text-gray-600 tracking-wider pl-3.5">CPU · MEM · DISK</span>+ <span className={`font-pixel text-[8px] ${sentinel.text} tracking-wider`}>{sentinel.label}</span></div>- {/* Active agents */}- <div className="flex items-center justify-between gap-6">+ {/* Active agents — clicks into CoS */}+ <button+ type="button"+ onClick={() => navigate('/cos')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open Chief of Staff"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">AGENTS</span><span className={`font-pixel text-[11px] ${activeAgentCount > 0 ? 'text-emerald-400' : 'text-gray-600'}`}>{activeAgentCount > 0 && <span className="inline-block w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1 animate-pulse" />}{activeAgentCount} ACTIVE</span>- </div>+ </button>- {/* Stopped count */}+ {/* Stopped count — jumps to apps page */}{stoppedApps > 0 && (- <div className="flex items-center justify-between gap-6">+ <button+ type="button"+ onClick={() => navigate('/apps')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="View apps"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">STOPPED</span><span className="font-pixel text-[11px] text-red-400" style={{ textShadow: '0 0 4px rgba(239,68,68,0.3)' }}>{stoppedApps}</span>- </div>+ </button>)}{/* Archived */}{archivedApps > 0 && (- <div className="flex items-center justify-between gap-6">+ <button+ type="button"+ onClick={() => navigate('/apps')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="View apps"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">ARCHIVED</span><span className="font-pixel text-[11px] text-gray-500">{archivedApps}</span>- </div>+ </button>)}- {/* Review pressure */}+ {/* Review pressure — jumps to review hub */}{(pendingReview > 0 || alertCount > 0) && (- <div className="flex items-center justify-between gap-6">+ <button+ type="button"+ onClick={() => navigate('/review')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open Review Hub"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">REVIEW</span><span className={`font-pixel text-[11px] ${alertCount > 0 ? 'text-orange-400' : 'text-cyan-400'}`}>{pendingReview} PENDING{alertCount > 0 ? ` · ${alertCount} ALERT${alertCount === 1 ? '' : 'S'}` : ''}</span>- </div>+ </button>)}- {/* Instance mesh */}- <div className="flex items-center justify-between gap-6">+ {/* Instance mesh — jumps to federation page */}+ <button+ type="button"+ onClick={() => navigate('/instances')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open Federation / Instances"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">NODES</span><span className={`font-pixel text-[11px] ${onlinePeers > 0 ? 'text-violet-400' : 'text-gray-500'}`}>{onlinePeers}/{totalNodes} LINKED</span>- </div>+ </button>++ {/* Notifications — jumps to dashboard (where the alerts widget lives) */}+ {notificationCounts?.unread > 0 && (+ <button+ type="button"+ onClick={() => navigate('/')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open dashboard alerts"+ >+ <span className="font-pixel text-[10px] text-gray-400 tracking-wide">NOTIFS</span>+ <span className="font-pixel text-[11px] text-cyan-400">+ {notificationCounts.unread} UNREAD+ </span>+ </button>+ )}{/* Productivity - today's tasks */}{productivityData?.todaySucceeded > 0 && (- <div className="flex items-center justify-between gap-6">+ <button+ type="button"+ onClick={() => navigate('/cos')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open Chief of Staff"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">TASKS</span><span className="font-pixel text-[11px] text-purple-400" style={{ textShadow: '0 0 4px rgba(168,85,247,0.3)' }}>{productivityData.todaySucceeded} TODAY</span>- </div>+ </button>)}{/* Streak */}{productivityData?.currentDailyStreak > 0 && (- <div className="flex items-center justify-between gap-6">+ <button+ type="button"+ onClick={() => navigate('/cos')}+ className="w-full flex items-center justify-between gap-6 -mx-1 px-1 py-0.5 rounded hover:bg-cyan-500/5 transition-colors"+ title="Open Chief of Staff"+ ><span className="font-pixel text-[10px] text-gray-400 tracking-wide">STREAK</span><span className={`font-pixel text-[11px] ${productivityData.currentDailyStreak >= 3 ? 'text-orange-400' : 'text-gray-400'}`}>{productivityData.currentDailyStreak}d</span>- </div>+ </button>)}{/* Divider */}@@ -309,6 +391,21 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con</div></div>+ {/* Below title: filter chips + search. Centered so it reads as the+ city's primary navigation aid. Press '/' from anywhere to focus. */}+ {filter && onFilterChange && (+ <div className="absolute top-14 left-1/2 -translate-x-1/2">+ <CityFilterBar+ apps={apps}+ agentMap={agentMap}+ filter={filter}+ onChange={onFilterChange}+ onJumpToFirst={onJumpToFirst}+ matchCount={matchCount}+ />+ </div>+ )}+{/* Top-right: Connection + CoS status */}<div className="absolute top-3 right-3 pointer-events-auto"><div className="relative bg-black/85 backdrop-blur-sm border border-cyan-500/40 rounded-lg px-4 py-2.5 flex items-center gap-4">@@ -333,8 +430,16 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con</div></div>- {/* Right side: Activity log */}- <CityActivityLog logs={eventLogs} />+ {/* Right side: Intel pane (Attention + Activity tabs) */}+ <CityIntelPane+ apps={apps}+ cosAgents={cosAgents}+ reviewCounts={reviewCounts}+ instances={instances}+ systemHealth={systemHealth}+ notificationCounts={notificationCounts}+ eventLogs={eventLogs}+ />{/* Bottom: Agent status bar */}<CityAgentBar cosAgents={cosAgents} agentMap={agentMap} />diff --git a/client/src/components/city/CityIntelPane.jsx b/client/src/components/city/CityIntelPane.jsxnew file mode 100644index 0000000000..69fefb7d0a--- /dev/null+++ b/client/src/components/city/CityIntelPane.jsx@@ -0,0 +1,302 @@+import { useMemo, useRef, useEffect, useState } from 'react';+import { useNavigate } from 'react-router-dom';++const SEVERITY_RANK = { critical: 0, warning: 1, info: 2 };+const SEVERITY_COLORS = {+ critical: { dot: 'bg-red-400', text: 'text-red-300', border: 'border-red-500/40' },+ warning: { dot: 'bg-amber-400', text: 'text-amber-300', border: 'border-amber-500/30' },+ info: { dot: 'bg-cyan-400', text: 'text-cyan-300', border: 'border-cyan-500/25' },+};++// Build the prioritized list of things that need the user's attention right now.+// Higher-priority (critical) items rise to the top; ties broken by category order.+function buildAttentionItems({ apps, cosAgents, reviewCounts, instances, systemHealth, notificationCounts }) {+ const items = [];++ // 1. Errored / stopped apps — most urgent, the city's reason for being a dashboard+ const stoppedApps = (apps || []).filter(a => !a.archived && a.overallStatus === 'stopped');+ stoppedApps.forEach(app => {+ items.push({+ id: `app-stopped-${app.id}`,+ severity: 'critical',+ label: `${app.name || app.id}`,+ detail: 'Stopped',+ to: `/apps/${app.id}`,+ category: 'app',+ });+ });++ // PM2 process-level errors per app+ (apps || []).forEach(app => {+ if (app.archived) return;+ const pm2 = app.pm2Status || {};+ const erroredProcs = Object.entries(pm2).filter(([, s]) => s?.status === 'errored');+ erroredProcs.forEach(([procName]) => {+ items.push({+ id: `proc-err-${app.id}-${procName}`,+ severity: 'critical',+ label: `${app.name || app.id} · ${procName}`,+ detail: 'Process errored',+ to: `/apps/${app.id}`,+ category: 'app',+ });+ });+ });++ // 2. System health warnings (memory/cpu/disk/database)+ if (systemHealth?.warnings?.length) {+ systemHealth.warnings.forEach((w, i) => {+ const sev = systemHealth.overallHealth === 'critical' ? 'critical' : 'warning';+ items.push({+ id: `sys-warn-${i}-${w.type}`,+ severity: sev,+ label: w.message || `System: ${w.type}`,+ detail: 'System health',+ to: '/',+ category: 'system',+ });+ });+ }++ // 3. Pending reviews / alerts+ if (reviewCounts?.alert > 0) {+ items.push({+ id: 'review-alerts',+ severity: 'critical',+ label: `${reviewCounts.alert} alert${reviewCounts.alert === 1 ? '' : 's'}`,+ detail: 'Review hub',+ to: '/review',+ category: 'review',+ });+ }+ if (reviewCounts?.total > 0) {+ items.push({+ id: 'review-pending',+ severity: 'warning',+ label: `${reviewCounts.total} pending review${reviewCounts.total === 1 ? '' : 's'}`,+ detail: 'Review hub',+ to: '/review',+ category: 'review',+ });+ }++ // 4. Federation: peers offline / sync degraded+ const peers = instances?.peers || [];+ const offlinePeers = peers.filter(p => p.status !== 'online');+ if (offlinePeers.length > 0) {+ items.push({+ id: 'peers-offline',+ severity: 'warning',+ label: `${offlinePeers.length} of ${peers.length} peer${peers.length === 1 ? '' : 's'} offline`,+ detail: 'Federation',+ to: '/instances',+ category: 'federation',+ });+ }++ // 5. Agents with error state+ const erroredAgents = (cosAgents || []).filter(a =>+ a.status === 'failed' || a.state === 'error' || a.error+ );+ erroredAgents.forEach(agent => {+ items.push({+ id: `agent-err-${agent.agentId || agent.id}`,+ severity: 'warning',+ label: agent.task || agent.taskTitle || `Agent ${agent.agentId?.slice(0, 8) || ''}`,+ detail: 'Agent failed',+ to: '/cos',+ category: 'agent',+ });+ });++ // 6. Unread notifications (informational, not critical)+ const unread = notificationCounts?.unread ?? 0;+ if (unread > 0) {+ items.push({+ id: 'notifs-unread',+ severity: 'info',+ label: `${unread} unread notification${unread === 1 ? '' : 's'}`,+ detail: 'Open dashboard alerts',+ to: '/',+ category: 'notifications',+ });+ }++ // Sort by severity, preserving insertion order within a severity+ return items.sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity]);+}++function AttentionList({ items }) {+ const navigate = useNavigate();++ if (items.length === 0) {+ return (+ <div className="flex-1 flex items-center justify-center px-3 py-6">+ <div className="text-center">+ <div className="font-pixel text-[10px] text-emerald-400/70 tracking-wider mb-1">ALL CLEAR</div>+ <div className="font-pixel text-[8px] text-cyan-500/30 tracking-wide">No items need attention</div>+ </div>+ </div>+ );+ }++ return (+ <div className="flex-1 overflow-y-auto px-2 py-1.5 space-y-1" style={{ scrollbarWidth: 'thin', scrollbarColor: 'rgba(6,182,212,0.2) transparent' }}>+ {items.map(item => {+ const colors = SEVERITY_COLORS[item.severity] || SEVERITY_COLORS.info;+ return (+ <button+ key={item.id}+ type="button"+ onClick={() => item.to && navigate(item.to)}+ className={`w-full text-left flex items-start gap-2 px-2 py-1.5 rounded border ${colors.border} bg-black/40 hover:bg-cyan-500/10 transition-colors`}+ title={`${item.label} — ${item.detail}`}+ >+ <span className={`w-1.5 h-1.5 rounded-full ${colors.dot} shrink-0 mt-1.5 shadow-[0_0_4px_currentColor]`} />+ <div className="flex-1 min-w-0">+ <div className={`font-pixel text-[10px] tracking-wide truncate ${colors.text}`}>+ {item.label}+ </div>+ <div className="font-pixel text-[8px] text-gray-500 tracking-wide truncate mt-0.5">+ {item.detail}+ </div>+ </div>+ <span className="font-pixel text-[8px] text-cyan-500/40 tracking-wide self-center">{'>'}</span>+ </button>+ );+ })}+ </div>+ );+}++const LEVEL_COLORS = {+ info: 'text-cyan-400',+ warn: 'text-amber-400',+ error: 'text-red-400',+ success: 'text-emerald-400',+ debug: 'text-gray-500',+};++const LEVEL_INDICATORS = {+ info: 'bg-cyan-400',+ warn: 'bg-amber-400',+ error: 'bg-red-400',+ success: 'bg-emerald-400',+ debug: 'bg-gray-600',+};++function ActivityLogList({ logs }) {+ const scrollRef = useRef(null);++ useEffect(() => {+ if (scrollRef.current) {+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;+ }+ }, [logs]);++ if (!logs || logs.length === 0) {+ return (+ <div className="flex-1 flex items-center justify-center px-3 py-6">+ <div className="font-pixel text-[8px] text-cyan-500/30 tracking-wide">No activity yet</div>+ </div>+ );+ }++ return (+ <div+ ref={scrollRef}+ className="flex-1 overflow-y-auto px-3 py-1.5 space-y-1"+ style={{ scrollbarWidth: 'thin', scrollbarColor: 'rgba(6,182,212,0.2) transparent' }}+ >+ {logs.slice(-40).map((log, i) => {+ const level = log.level || 'info';+ const colorClass = LEVEL_COLORS[level] || LEVEL_COLORS.info;+ const indicatorClass = LEVEL_INDICATORS[level] || LEVEL_INDICATORS.info;+ const time = log.timestamp+ ? new Date(log.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })+ : '';+ const message = log.message || log.event || JSON.stringify(log);++ return (+ <div+ key={i}+ className="font-pixel text-[9px] leading-tight flex items-start gap-1.5 tracking-wide group hover:bg-cyan-500/5 rounded px-1 py-0.5 -mx-1 transition-colors"+ title={message}+ >+ <span className={`w-1 h-1 rounded-full ${indicatorClass} shrink-0 mt-1 opacity-70`} />+ <span className="text-gray-500 shrink-0">{time}</span>+ <span className={`${colorClass} truncate group-hover:whitespace-normal group-hover:break-all`}>{message}</span>+ </div>+ );+ })}+ </div>+ );+}++export default function CityIntelPane({ apps, cosAgents, reviewCounts, instances, systemHealth, notificationCounts, eventLogs }) {+ const [tab, setTab] = useState('attention');+ const [collapsed, setCollapsed] = useState(false);++ const items = useMemo(+ () => buildAttentionItems({ apps, cosAgents, reviewCounts, instances, systemHealth, notificationCounts }),+ [apps, cosAgents, reviewCounts, instances, systemHealth, notificationCounts]+ );++ const criticalCount = items.filter(i => i.severity === 'critical').length;++ return (+ <div className={`absolute top-16 right-3 ${collapsed ? '' : 'bottom-20'} w-72 pointer-events-auto`}>+ <div className={`${collapsed ? '' : 'h-full'} bg-black/85 backdrop-blur-sm border border-cyan-500/30 rounded-lg overflow-hidden flex flex-col`}>+ <div className="flex items-stretch border-b border-cyan-500/20">+ <button+ type="button"+ onClick={() => { setTab('attention'); setCollapsed(false); }}+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-2 transition-colors ${+ tab === 'attention' && !collapsed+ ? 'bg-cyan-500/10 text-cyan-400'+ : 'text-cyan-500/50 hover:bg-cyan-500/5'+ }`}+ title="Things needing your attention"+ >+ <span className="font-pixel text-[10px] tracking-wider font-bold">ATTENTION</span>+ {items.length > 0 && (+ <span className={`font-pixel text-[9px] px-1 rounded ${+ criticalCount > 0 ? 'bg-red-500/30 text-red-300' : 'bg-cyan-500/20 text-cyan-300'+ }`}>+ {items.length}+ </span>+ )}+ </button>+ <button+ type="button"+ onClick={() => { setTab('activity'); setCollapsed(false); }}+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-2 border-l border-cyan-500/20 transition-colors ${+ tab === 'activity' && !collapsed+ ? 'bg-cyan-500/10 text-cyan-400'+ : 'text-cyan-500/50 hover:bg-cyan-500/5'+ }`}+ title="Live event log"+ >+ <span className="font-pixel text-[10px] tracking-wider font-bold">ACTIVITY</span>+ {eventLogs?.length > 0 && (+ <span className="font-pixel text-[9px] text-cyan-500/40">{eventLogs.length}</span>+ )}+ </button>+ <button+ type="button"+ onClick={() => setCollapsed(c => !c)}+ className="px-2 py-2 border-l border-cyan-500/20 text-cyan-500/50 hover:bg-cyan-500/5 hover:text-cyan-400 transition-colors"+ title={collapsed ? 'Expand' : 'Collapse'}+ >+ <span className="font-pixel text-[11px]">{collapsed ? '[+]' : '[-]'}</span>+ </button>+ </div>+ {!collapsed && (+ tab === 'attention'+ ? <AttentionList items={items} />+ : <ActivityLogList logs={eventLogs} />+ )}+ </div>+ </div>+ );+}diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex 263de2f5d8..c1fcfaf797 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -24,7 +24,7 @@ import CitySky from './CitySky';import PlayerController from './PlayerController';import CameraTransition from './CameraTransition';-export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, reviewCounts, instances, productivityData, settings, playSfx, keysRef }) {+export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, reviewCounts, instances, productivityData, settings, playSfx, keysRef, dimmedAppIds }) {const [positions, setPositions] = useState(null);const [proximityApp, setProximityApp] = useState(null);const [transitioning, setTransitioning] = useState(false);@@ -82,6 +82,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,playSfx={playSfx}settings={settings}proximityAppId={proximityApp?.id}+ dimmedAppIds={dimmedAppIds}/><CityDataStreams positions={positions} /><CityTraffic positions={positions} />diff --git a/client/src/hooks/useCityData.js b/client/src/hooks/useCityData.jsindex dcc600f670..9ec6fff721 100644--- a/client/src/hooks/useCityData.js+++ b/client/src/hooks/useCityData.js@@ -10,8 +10,11 @@ export const useCityData = () => {const [eventLogs, setEventLogs] = useState([]);const [reviewCounts, setReviewCounts] = useState({ total: 0, alert: 0, todo: 0, briefing: 0, cos: 0 });const [instances, setInstances] = useState({ self: null, peers: [], syncStatus: null });+ const [systemHealth, setSystemHealth] = useState(null);+ const [notificationCounts, setNotificationCounts] = useState({ total: 0, unread: 0 });const [loading, setLoading] = useState(true);const pollRef = useRef(null);+ const healthPollRef = useRef(null);const fetchApps = useCallback(async () => {const data = await api.getApps().catch(() => []);@@ -20,13 +23,15 @@ export const useCityData = () => {}, []);const fetchAll = useCallback(async () => {- const [appsData, agents, cosAgentsData, status, reviewData, instanceData] = await Promise.all([+ const [appsData, agents, cosAgentsData, status, reviewData, instanceData, health, notifs] = await Promise.all([api.getApps().catch(() => []),api.getRunningAgents().catch(() => []),api.getCosAgents().catch(() => []),api.getCosStatus().catch(() => ({ running: false })),api.getReviewCounts().catch(() => ({ total: 0, alert: 0, todo: 0, briefing: 0, cos: 0 })),api.getInstances().catch(() => ({ self: null, peers: [], syncStatus: null })),+ api.getSystemHealth().catch(() => null),+ api.getNotificationCounts().catch(() => ({ total: 0, unread: 0 })),]);setApps(appsData);@@ -35,9 +40,16 @@ export const useCityData = () => {setCosStatus(status);setReviewCounts(reviewData);setInstances(instanceData);+ setSystemHealth(health);+ setNotificationCounts(notifs);setLoading(false);}, []);+ const fetchHealth = useCallback(async () => {+ const health = await api.getSystemHealth().catch(() => null);+ if (health) setSystemHealth(health);+ }, []);+const agentMap = useMemo(() => {const map = new Map();const allAgents = [...(cosAgents || [])];@@ -98,6 +110,10 @@ export const useCityData = () => {setRunningAgents(agents);}, 10000);+ // System health refresh: every 15s. CPU/memory shift fast enough to matter+ // for the operational HUD but not so fast that we want a per-second poll.+ healthPollRef.current = setInterval(fetchHealth, 15000);+return () => {socket.emit('cos:unsubscribe');socket.off('connect', subscribe);@@ -108,8 +124,9 @@ export const useCityData = () => {socket.off('cos:log', handleCosLog);socket.off('cos:status', handleCosStatus);clearInterval(pollRef.current);+ clearInterval(healthPollRef.current);};- }, [fetchAll, fetchApps]);+ }, [fetchAll, fetchApps, fetchHealth]);return {apps,@@ -120,6 +137,8 @@ export const useCityData = () => {agentMap,reviewCounts,instances,+ systemHealth,+ notificationCounts,loading,connected: socket.connected,};diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/CyberCity.jsxindex 4dee193069..5c40404e98 100644--- a/client/src/pages/CyberCity.jsx+++ b/client/src/pages/CyberCity.jsx@@ -1,4 +1,4 @@-import { useCallback, useState, useEffect } from 'react';+import { useCallback, useState, useEffect, useMemo } from 'react';import { useNavigate, useLocation } from 'react-router-dom';import { useCityData } from '../hooks/useCityData';import useCityAudio from '../hooks/useCityAudio';@@ -9,14 +9,21 @@ import CityHud from '../components/city/CityHud';import CityScanlines from '../components/city/CityScanlines';import { CitySettingsProvider, useCitySettingsContext } from '../components/city/CitySettingsContext';import CitySettingsPanel from '../components/city/CitySettingsPanel';+import { computeFilterResult } from '../components/city/CityFilterBar';function CyberCityInner() {- const { apps, cosAgents, cosStatus, eventLogs, agentMap, reviewCounts, instances, loading, connected } = useCityData();+ const { apps, cosAgents, cosStatus, eventLogs, agentMap, reviewCounts, instances, systemHealth, notificationCounts, loading, connected } = useCityData();const { settings, updateSetting } = useCitySettingsContext();const { playSfx } = useCityAudio(settings);const navigate = useNavigate();const location = useLocation();const [productivityData, setProductivityData] = useState(null);+ const [filter, setFilter] = useState({ status: 'all', search: '' });++ const filterResult = useMemo(+ () => computeFilterResult({ apps, agentMap, status: filter.status, search: filter.search }),+ [apps, agentMap, filter.status, filter.search]+ );const showSettings = location.pathname === '/city/settings';@@ -45,6 +52,13 @@ function CyberCityInner() {}}, [navigate]);+ // Submit (Enter) on the search bar jumps to the first match's app page —+ // the closest thing to a focus-camera-on-match without rebuilding the layout.+ const handleJumpToFirst = useCallback(() => {+ const first = filterResult.matches[0];+ if (first?.id) navigate(`/apps/${first.id}`);+ }, [filterResult.matches, navigate]);+if (loading) {return (<div className="flex flex-col items-center justify-center h-full gap-4" style={{ background: '#030308' }}>@@ -74,6 +88,7 @@ function CyberCityInner() {settings={settings}playSfx={playSfx}keysRef={keysRef}+ dimmedAppIds={filterResult.dimmed}/><CityHudcosStatus={cosStatus}@@ -85,6 +100,12 @@ function CyberCityInner() {reviewCounts={reviewCounts}instances={instances}productivityData={productivityData}+ systemHealth={systemHealth}+ notificationCounts={notificationCounts}+ filter={filter}+ onFilterChange={setFilter}+ onJumpToFirst={handleJumpToFirst}+ matchCount={filterResult.matches.length}onToggleExploration={handleToggleExploration}explorationMode={settings?.explorationMode}/>diff --git a/docs/features/cybercity-v2.md b/docs/features/cybercity-v2.mdindex 19903109d9..0704baedea 100644--- a/docs/features/cybercity-v2.md+++ b/docs/features/cybercity-v2.md@@ -2,315 +2,238 @@## Intent-CyberCity should be a **read-only interpretive layer** over PortOS state.+CyberCity is the **spatial systems map** of PortOS. A single `/cybercity` page that+turns the abstract state of every managed app, every active agent, every system+signal into a 3D environment you can glance at, search, and act in.-It is not a control plane and should not mutate canonical user data. Its job is to:+It does three jobs:-- spatialize important system state-- make operational pressure legible at a glance-- provide a memorable aesthetic layer for PortOS-- route the user into deeper app surfaces when they want detail+1. **Make operational pressure legible at a glance** — which buildings are hot,+ where is review pressure piling up, what needs your attention right now.+2. **Provide a fast spatial front-end to PortOS** — search any app, jump into+ any detail page, take action on any building.+3. **Be a memorable, distinctive aesthetic layer** — a cyberpunk city you+ actually enjoy spending time in, with personality that grows over use.-## Current State+## Current State (as of 2026-04-29)-The current implementation already has a strong rendering shell:+Strong rendering shell already exists: 3D scene with apps as buildings (PM2-driven),+boroughs, archive district, weather, traffic, particles, neon signs, billboards,+HUD with vitals + activity log + agent bar, exploration mode (WASD), and an+OrbitControls default view.-- 3D city scene with buildings, districts, weather, traffic, particles, signs, billboards, and HUD-- app-driven building placement-- archived apps separated into an archive district-- CoS activity shown in HUD and event logs-- exploration mode / avatar controls+Tech: React Three Fiber + Three.js (no postprocessing lib — bloom is custom).-What it lacks is a stronger semantic model. Right now it is more of a stylish city visualization than a true systems map.+What it lacks:-## Core Design Rule+- **Per-building real-time signal** — buildings show only binary online/stopped;+ CPU/memory/error rate are invisible.+- **Findability** — no search, no filter, scrolling through ~50 buildings is+ the only way to locate one.+- **Drill-down / actionability** — buildings click straight to `/apps/{id}`;+ HUD stats are not interactive; no hover preview, no quick actions.+- **Holistic coverage** — AI runs, CoS task queue depth, federation peers,+ backups, voice agent state, notifications all invisible.+- **Mobile** — desktop-only despite project mandate; no touch controls.+- **Mutation surface** — the city is read-only today, but it is the natural+ place to restart a stopped app or kick off a deploy without leaving the view.-CyberCity is a **read layer**.+## Design Rules++CyberCity is an **interactive systems map**.Allowed:-- query state from PortOS APIs-- reflect state visually-- link/navigate to app pages and dashboards-- render symbolic or atmospheric interpretations-Not allowed:-- mutate user goals, tasks, notes, or memory directly-- trigger automations implicitly-- act as a hidden write surface+- query state from PortOS APIs and reflect it visually+- offer click-to-navigate into deeper app surfaces+- offer **explicit user-initiated actions** that already exist elsewhere in+ PortOS (restart app, deploy app, jump to logs, etc.) — the city is a+ faster path, not a hidden side channel+- render symbolic / atmospheric interpretations of state-## V2 Design Goal+Not allowed:-Turn CyberCity from a decorative scene into a **living systems dashboard**.+- mutate user goals, tasks, notes, or memory directly (those flow through their+ canonical pages with their own validation)+- trigger automations *implicitly* (no auto-restart on click, no batch actions+ without explicit confirmation)+- act as an undocumented write surface — every action exposed in the city must+ be discoverable elsewhere in PortOS too-The city should answer questions like:-- Where is activity happening?-- Which systems are healthy vs degraded?-- Where is review pressure building?-- Which machine or domain is producing noise?-- What deserves attention first?+In short: **interactive, but every action is intentional and user-initiated**.-## Proposed Semantic Layers+## Semantic Layers### 1. Infrastructure Layer-Maps operational system state into broad city behavior.+Maps operational state into city behavior.-Examples:-- app health -> district brightness / outages / skyline quality-- active agents -> drones, traffic density, lit windows, moving signals-- alerts / review pressure -> warning beacons, weather severity, red pulses-- archived apps -> warehouse / cold-storage district-- remote instances / machines -> distinct boroughs or utility grids+- App health → district brightness, building façade, ember/spark intensity+- Active agents → tethered light to their assigned building, traffic density+- Alerts / review pressure → warning beacons, weather severity, red pulses+- Archived apps → cold-storage district+- Remote instances → distant skyline silhouettes on the horizon### 2. Domain Layer-Maps major PortOS domains into recognizable urban geography.--Initial candidate districts:-- Apps / operations district-- CoS / agents district-- Review / alerts district-- Memory / archive district-- Machine / instance district-- Void machine district (remote primary node)+Maps PortOS domains into recognizable urban geography.++Districts:+- **Apps / operations** — main downtown, all PM2-managed buildings+- **CoS / agents** — agent bar + tether anchors+- **Review / alerts** — pressure landmarks+- **Memory / archive** — archived apps + memory crystal layer (future)+- **AI core** — central tower, all model activity radiates from here+- **Backup vault** — small monument tracking snapshot health+- **Federation horizon** — distant peer skyline+- **Void machine** — reserved zone for the remote primary instance### 3. Interface Layer-Lets CyberCity route the user into the real app.+Routes the user into the real app.-Examples:-- click building -> app detail-- click review beacon -> Review Hub-- click agent district -> CoS / agent page-- click void-machine infrastructure -> instance/machine details+- click building → app detail (existing)+- click building façade health bar → live metrics page+- click review beacon → Review Hub+- click AI Core → AI runs page+- click backup vault → Backup page+- click distant peer city → instance management+- press `/` → search overlay → focus camera + jump### 4. Atmosphere Layer-Adds meaning and personality without changing truth.+Personality without changing truth.-Examples:-- ambient city mood tied to system conditions-- earned monuments or holograms from milestones-- subtle machine-familiar tone in signage / overlays+- ambient mood tied to system conditions (weather already does this)+- earned monuments / holograms from milestones+- chronotype-driven energy levels (peak hours = bright/fast, recovery = dim/slow)- temporal events (night mode, storms, calm periods)+- ambient soundscape (future)## Roadmap-### Phase 1 — Legibility-Goal: make the city communicate real system state clearly.--Planned work:-- define district model beyond active vs archive-- add explicit status-to-visual mappings-- introduce review/alert pressure indicators-- make remote instance presence visible through data-driven landmarks and signals-- refine HUD so it reflects domain health, not just generic counts--### Phase 2 — Navigation-Goal: make CyberCity a spatial front-end to PortOS.--Planned work:-- district click targets-- landmark summaries-- richer hover/interact states-- direct routing into app areas from meaningful city objects--### Phase 3 — Atmosphere-Goal: make CyberCity feel alive and distinctive.--Planned work:-- domain-specific ambient effects-- earned artifacts / monuments-- ghost-console / familiar flavor in selected UI surfaces-- stronger day/night and signal-noise mood shifts--## Related Future Ideas-Track for later work:--- Sandbox district (safe experiments, simulated artifacts, non-canonical play)-- Memory museum / mausoleum layer-- Ambient ritual layer-- Ghost console / machine familiar mode--These should remain separate from canonical write paths.--## First Implementation Slice--The first useful slice should be:--1. inspect and formalize current city data inputs-2. introduce a district/state model that goes beyond `active apps vs archive`-3. surface review/alert pressure in the scene, not just the Review Hub-4. reserve a visible zone for the void machine / remote primary instance--That creates a meaningful systems-map foundation before adding more spectacle.-------# CyberCity Improvement Plan--Concrete ideas for making CyberCity more **useful** (a real systems dashboard) and more **interesting** (atmospheric, delightful, memorable). Organized by effort tier.--## Tier 1 — Quick Wins (single-file or small changes, high impact)--### 1.1 System Health as City Atmosphere-**Data source:** `/api/system/health/details` (CPU, memory, disk, process stats)-**Concept:** Map real system metrics to existing atmospheric effects:-- **CPU load** → heat shimmer / haze intensity on buildings (reuse CityParticles or add a distortion shader)-- **Memory pressure** → fog density (scale existing cloud/particle opacity)-- **Disk usage** → ground texture degradation (swap ground material roughness/color at thresholds: green <70%, amber 70-90%, red >90%)-- **Process error count** → ember/spark intensity (already have CityEmbers)--This turns the existing weather system from random decoration into a meaningful system health indicator. One glance at the sky tells you if the server is struggling.--### 1.2 Notification Beacons-**Data source:** `/api/notifications/counts` (breakdown by type)-**Concept:** Extend the existing CitySignalBeacons to pulse based on notification backlog. Unread notification count drives beacon brightness and pulse rate. Different notification types get different beacon colors. Clicking a beacon navigates to the relevant PortOS page.--### 1.3 Brain Inbox Pulse-**Data source:** `/api/brain/inbox` (count of unprocessed thoughts)-**Concept:** Add a central spire/antenna whose glow intensity reflects brain inbox depth. Each new thought capture triggers a brief light pulse visible from anywhere in the city. Zero inbox = calm blue glow. Growing inbox = increasingly urgent amber→red pulse.--### 1.4 Richer Billboards with Real Content-**Data source:** `/api/cos/briefings/latest`, `/api/cos/productivity/summary`-**Concept:** The existing CityBillboards already show some data. Enhance them to rotate through:-- Today's briefing headline-- Productivity streak count ("7-day streak")-- Top actionable insight from `/api/cos/actionable-insights`-- Recent agent completion summary-- Goal progress percentage for active goals--### 1.5 Building Pulse Animation for Active Agents-**Concept:** When a CoS agent is actively working on an app, the building's windows should animate (scrolling light pattern, like code being written). Currently agents are octahedra floating above — add a visual link between agent and building (a light beam or tether).--## Tier 2 — Medium Effort (new components, new data hooks)--### 2.1 Productivity District-**Data sources:** `/api/cos/productivity/trends`, `/api/cos/productivity/calendar`-**Concept:** A dedicated district (offset from downtown) containing:-- **Streak monument** — a tower whose height equals current task completion streak (days). Glows brighter at longer streaks. Crumbles/darkens when streak breaks.-- **Activity heatmap ground** — ground tiles colored by the GitHub-style activity calendar data. Recent high-activity days glow; idle days are dark.-- **Task flow river** — an animated stream running through the district whose width/speed reflects daily task throughput.--### 2.2 Goal Monuments-**Data source:** `/api/digital-twin/identity/goals`-**Concept:** Each active goal becomes a landmark structure in the city:-- **In-progress goals** → buildings under construction with scaffolding, cranes, and sparks-- **Completed goals** → polished monuments with celebratory lighting-- **Stalled goals** → dimmed, cobwebbed structures-- Goal progress percentage maps to construction completion (25% = foundation only, 75% = mostly built, facade incomplete)-- Milestone completions trigger a brief city-wide firework effect--### 2.3 Chronotype Energy Overlay-**Data source:** `/api/digital-twin/identity/chronotype/energy-schedule`-**Concept:** The city's ambient energy level follows the user's chronotype profile:-- During peak focus hours → brighter neon, faster traffic, more particle activity, upbeat synth music key-- During recovery/wind-down hours → dimmer lights, slower traffic, calmer particles, mellow music-- This makes the city feel like it "breathes" with the user's natural rhythm rather than running at constant intensity-- Could be a toggle ("Chronotype mode") that overrides static time-of-day setting--### 2.4 Character Level & XP HUD-**Data source:** `/api/character/` (XP, level, events)-**Concept:** Display character level as a floating holographic badge near the HUD. XP gains trigger a brief golden particle burst from the relevant building. Level-ups trigger a city-wide celebration (fireworks + music sting + temporary golden sky tint). This ties the gamification system directly into the spatial experience.--### 2.5 Data Flow Streams Between Buildings-**Concept:** Animate visible light streams between buildings that communicate (e.g., API calls between apps, agent messages). Stream thickness = traffic volume. Stream color = data type (blue = API, green = socket, orange = file I/O). This visualizes the actual interconnection topology of managed apps.--### 2.6 Mini-Map Overlay-**Concept:** A small top-down map in the HUD corner showing:-- Building positions colored by status-- Current camera position/orientation-- Hot spots (buildings with active agents or alerts glow)-- Click-to-teleport navigation-This is especially useful as the city grows beyond a few buildings and districts spread out.--### 2.7 Health Vitals Tower (Meatspace Integration)-**Data source:** `/api/meatspace/apple-health/metrics/latest`-**Concept:** A biometric tower in a "wellness district" that visualizes:-- Heart rate → pulsing ring animation speed-- Steps today → tower height growth throughout the day-- Sleep quality last night → tower color (green=good, amber=fair, red=poor)-- Active calories → glowing particle emission rate-Makes physical health data part of the ambient awareness layer.--## Tier 3 — Ambitious Features (new systems, significant effort)--### 3.1 Memory/Knowledge District-**Data sources:** `/api/memory/graph`, `/api/memory/stats`, `/api/brain/`-**Concept:** A visually distinct district representing the knowledge base:-- **Memory nodes as crystalline structures** — each memory category is a crystal cluster. Size = number of memories. Brightness = recency of access.-- **Connection bridges** — graph edges from the memory graph rendered as light bridges between crystals-- **Brain inbox as a glowing well** — new thoughts drop in as light orbs, processed thoughts flow out as connections-- **Knowledge fog** — areas with sparse connections are foggy; dense knowledge areas are clear and well-lit-- Clicking a crystal navigates to the Memory page filtered by that category--### 3.2 Historical Timeline Scrubber-**Data sources:** `/api/cos/productivity/trends`, `/api/history/stats`-**Concept:** A timeline slider (in HUD or settings) that lets you see the city at previous points in time:-- Scrub back to see which apps existed, which were online, what the system health was-- Buildings appear/disappear, construction animations play for new apps-- Useful for understanding system evolution and identifying when problems started-- Data sourced from historical snapshots or reconstructed from event history--### 3.3 JIRA/Sprint District-**Data source:** `/api/jira/instances/:id/my-sprint-tickets`-**Concept:** A "work board" district where current sprint tickets are visualized as:-- **Todo tickets** → stacked crates in a warehouse-- **In-progress tickets** → buildings under active construction with worker drones-- **Done tickets** → completed structures that join the skyline-- Sprint progress shown as a road being built across the district (0% = bare ground, 100% = complete highway)--### 3.4 Federation/Network Visualization-**Data source:** `/api/instances` (self + peers + sync status)-**Concept:** When PortOS has federated peers, each remote instance appears as a distant city on the horizon:-- Sync health shown as a bridge/highway between cities (broken bridge = sync failure)-- Remote instance load shown as that city's skyline brightness-- Click distant city → navigate to instance management page-- Data streams flowing between cities show active sync traffic--### 3.5 Photo Mode / Cinematic Camera-**Concept:** A dedicated "photo mode" that:-- Pauses animations at current state-- Provides cinematic camera presets (aerial flyover, street level, dramatic angle)-- Adds depth-of-field, vignette, and color grading controls-- Captures high-res screenshots-- Could auto-generate a "city postcard" with key stats overlaid-- Sharable output for showing off your personal OS--### 3.6 Ambient Soundscape Tied to Data-**Concept:** Extend the existing synth music system so the soundscape reflects system state:-- Base key/tempo shifts with overall system health (healthy = major key, degraded = minor key)-- Agent activity adds rhythmic elements (each active agent = an additional synth voice)-- High notification count adds tension (dissonant undertones)-- Completed tasks trigger brief melodic chimes-- This makes the city audible as well as visual — you could hear a problem before you see it--### 3.7 Earned Artifacts & Achievement Layer-**Concept:** Permanent visual rewards that accumulate over time:-- **Milestone statues** — completing a major goal places a permanent statue in the city-- **Streak trophies** — longest task streak, most productive week, etc. displayed in a "hall of fame" area-- **Seasonal decorations** — city changes with real-world seasons (cherry blossoms in spring, snow in winter, etc.)-- **Easter eggs** — hidden visual rewards for specific achievements (e.g., 1000th commit → neon dragon flyover)-- These give the city a sense of personal history and make it feel earned, not just generated--## Implementation Priority--Recommended order based on impact-to-effort ratio:--| Priority | Item | Why |-|----------|------|-----|-| 1 | 1.1 System Health Atmosphere | Highest ROI — existing effects just need real data piped in |-| 2 | 1.4 Richer Billboards | Existing component, just needs more data sources |-| 3 | 1.3 Brain Inbox Pulse | Simple visual, high daily utility |-| 4 | 1.5 Building Pulse for Agents | Makes agent activity viscerally visible |-| 5 | 2.4 Character XP HUD | Ties gamification to spatial experience |-| 6 | 2.3 Chronotype Energy Overlay | Unique differentiator, makes city feel alive |-| 7 | 2.1 Productivity District | New district with strong daily relevance |-| 8 | 2.2 Goal Monuments | Visual goal tracking is motivating |-| 9 | 2.6 Mini-Map | Navigation aid as city grows |-| 10 | 1.2 Notification Beacons | Extends existing beacon system |-| 11 | 2.7 Health Vitals Tower | Unique biometric integration |-| 12 | 2.5 Data Flow Streams | Visually impressive, shows system topology |-| 13 | 3.6 Ambient Soundscape | Audio feedback layer |-| 14 | 3.7 Earned Artifacts | Long-term delight and personalization |-| 15 | 3.1 Memory/Knowledge District | Ambitious but visually stunning |-| 16 | 3.5 Photo Mode | Fun, shareable |-| 17 | 3.4 Federation Visualization | Only relevant with multiple instances |-| 18 | 3.3 JIRA Sprint District | Only relevant with JIRA integration active |-| 19 | 3.2 Historical Timeline | Requires historical data infrastructure |+The roadmap unifies operational legibility (the *useful* layer) with atmospheric+polish (the *delightful* layer). Phase 1 prioritizes legibility because that's+what makes CyberCity worth visiting daily; later phases add depth.++### Phase 1 — Operational Legibility (current focus)++Goal: a person walking into `/cybercity` for the first time can immediately see+what's healthy, what's not, find a specific app, and take action.++| ID | Item | Effort |+|----|------|--------|+| **1.1** | **Per-building health glyph** — vertical CPU/MEM/ERR strip on every building façade, cyan→amber→red mapped from `/api/system/health/details` + PM2 metrics. The single highest-leverage change: every building tells you what it's doing right now. | M |+| **1.2** | **Stress smoke / sparks** — reuse `CityEmbers` per-building. Persistent CPU spike = smoke trail; recent crash = sparks. Brings global weather vocabulary down to the per-building level. | S |+| **1.3** | **Health card replaces cryptic weather glyph** — HUD shows plain `CPU 34% / MEM 71% / DISK 88%` with a sentinel dot. Atmospheric weather effect stays. | XS |+| **1.4** | **System Health as City Atmosphere** — pipe `/api/system/health/details` into existing weather/fog/ground texture so the sky reflects real state. | S |+| **1.5** | **Notification beacons** — extend `CitySignalBeacons` with notification backlog from `/api/notifications/counts`; brightness = unread count, color = type, click = navigate. | S |+| **1.6** | **Brain inbox pulse** — central spire glow tracks `/api/brain/inbox` depth; new captures pulse the spire. | S |+| **1.7** | **"Needs attention" pane** — replace the right-side `cos:log` stream with a structured list ranked by urgency: stopped/errored apps, high CPU/mem, pending reviews, stale backups, failed agent runs, federation sync failures, unread notifications. Every item clickable. Live log demoted to a tab. | S |+| **1.8** | **Building search overlay** — press `/` to filter buildings by name/tag/status; non-matches dim, matches stay lit, Enter focuses camera. Reuses `resolveNavCommand` from `server/lib/navManifest.js`. | S |+| **1.9** | **Status filter chips in HUD** — All / Online / Stopped / Errored / Has-Agent / Has-Pending-Review pill row above legend. Persists per-session. | S |+| **1.10** | **Hover preview card with quick actions** — show status / uptime / CPU / MEM / err / recent log line, with **Logs / Restart / Deploy / Open** buttons. Restart and Deploy POST to existing endpoints with explicit confirmation. | M |+| **1.11** | **Clickable HUD stats** — every count routes somewhere: PENDING REVIEWS → `/review`, AGENTS → `/cos`, NODES → `/instances`, etc. | XS |+| **1.12** | **Richer billboards** — rotate today's briefing headline, productivity streak, top actionable insight, recent agent completion summary, goal progress. | S |+| **1.13** | **Agent → building tether** — visible light from `AgentEntity` to its assigned building; color = agent state. Plus window-pulse animation on the building. | M |+| **1.14** | **Mobile / touch support** — `pointer: coarse` detection, single-finger orbit, two-finger pinch zoom, tap-to-select. Below 640px collapse HUD into a bottom sheet with search + filters + needs-attention. WASD exploration disables. CLAUDE.md mandate. | M |+| **1.15** | **Quality auto-detection** — default low/medium for mobile or weak hardware; settings panel still allows override. | XS |++### Phase 2 — Holistic Coverage++Goal: every major system PortOS tracks has a place in the city.++| ID | Item | Effort |+|----|------|--------|+| **2.1** | **AI Core landmark + activity beams** — central tower; on `ai:status` events, shoot a beam to the building whose agent issued the call. Thickness = tokens/sec, color = model tier. Solves the biggest current blind spot. | M |+| **2.2** | **CoS task queue silhouette** — warehouse with stack height = pending CoS tasks. Boxes load on `tasks:cos:created`, unload on completion. | M |+| **2.3** | **Backup vault landmark** — pulses on `backup:started/completed`, label shows time-since-last-snapshot, goes red when stale. | S |+| **2.4** | **Voice agent district marker** — small area whose lighting mirrors voice-agent state (idle / dictating / error). | S |+| **2.5** | **Federation horizon** — peers as distant skyline silhouettes; opacity = reachability, bridge condition = sync state. Even with one instance the void zone stays visible. | M |+| **2.6** | **Productivity district** — streak monument, activity heatmap ground tiles, task flow river. Driven by `/api/cos/productivity/*`. | L |+| **2.7** | **Goal monuments** — active goals as construction sites; completed goals as polished monuments; stalled goals dimmed. Driven by `/api/digital-twin/identity/goals`. | L |+| **2.8** | **Mini-map overlay** — top-down map in HUD corner with click-to-teleport. | M |+| **2.9** | **Health vitals tower** — biometric tower in a wellness district visualizing heart rate / steps / sleep / calories from `/api/meatspace/apple-health/metrics/latest`. | M |+| **2.10** | **Data flow streams between buildings** — visible light streams for actual API/socket/file traffic; thickness = volume, color = type. | M |+| **2.11** | **Character XP HUD** — floating level/XP badge with particle burst on XP gain; level-up triggers fireworks. | S |++### Phase 3 — Atmosphere & Polish++Goal: the city feels alive, distinctive, and earned.++| ID | Item | Effort |+|----|------|--------|+| **3.1** | **Chronotype energy overlay** — city brightens/quickens during peak focus hours, dims during recovery, driven by `/api/digital-twin/identity/chronotype/energy-schedule`. | M |+| **3.2** | **Memory / knowledge district** — categories as crystal clusters, graph edges as light bridges, brain inbox as a glowing well. Driven by `/api/memory/graph`. | L |+| **3.3** | **Photo mode / cinematic camera** — pause animations, cinematic presets, depth-of-field, vignette, high-res screenshots, "city postcard" with stats overlay. | M |+| **3.4** | **Ambient soundscape tied to data** — base key/tempo follows system health; agent activity adds rhythmic voices; completed tasks chime. Extends existing synth music. | L |+| **3.5** | **Earned artifacts & achievements** — milestone statues, streak trophies, seasonal decorations, easter eggs. | M |+| **3.6** | **Historical timeline scrubber** — scrub back to past city states; buildings appear/disappear via construction animations. Requires snapshot data. | L |+| **3.7** | **JIRA sprint district** — current sprint tickets as crates / under-construction / completed structures. | M |+| **3.8** | **Throttle expensive socket-driven repaints** — coalesce noisy event bursts into a 100ms tick. Becomes load-bearing once Phase 2's beams/vehicles ship. | S |++## Performance & Polish (cross-cutting)++- Default to lower quality on `pointer: coarse` and `hardwareConcurrency < 8`+- Coalesce socket events into a render tick to avoid bursty repaints+- Lazy-load heavy effects (volumetric lights, postprocessing, particle storms)+ on the basis of the active quality preset+- All new components must respect the existing settings panel quality dial++## Critical Files++- `client/src/pages/CyberCity.jsx` — page wrapper+- `client/src/components/city/CityScene.jsx` — Canvas, 3D containers, controls+- `client/src/components/city/CityHud.jsx` — overlay HUD (most Phase 1 UX changes)+- `client/src/components/city/Building.jsx`, `Borough.jsx` — façade work (1.1, 1.2, 1.13)+- `client/src/components/city/AgentEntity.jsx` — tether (1.13)+- `client/src/components/city/CityTraffic.jsx`, `CityDataStreams.jsx` — meaningful traffic (2.10)+- `client/src/components/city/CitySignalBeacons.jsx` — extend for notifications (1.5) + landmarks (2.x)+- `client/src/components/city/CityBillboards.jsx` — richer content (1.12)+- `client/src/hooks/useCityData.js` — data layer; extend with new endpoints+- `server/lib/navManifest.js` — `resolveNavCommand` reused for search (1.8)+- `client/src/utils/formatters.js` — reuse formatters; do not duplicate++## Endpoints used / to use++| Endpoint | Phase | Purpose |+|----------|-------|---------|+| `/api/system/health/details` | 1.1, 1.3, 1.4 | CPU/MEM/DISK |+| `/api/notifications/counts` | 1.5 | beacon brightness/colors |+| `/api/brain/inbox` | 1.6 | spire pulse |+| `/api/cos/queue` (or `/api/cos`) | 1.7, 2.2 | task queue depth |+| `/api/instances/peers` | 1.7, 2.5 | sync failures, peer rendering |+| `/api/cos/briefings/latest` | 1.12 | billboard headline |+| `/api/cos/productivity/summary` | 1.12, 2.6 | streak, throughput |+| `/api/cos/productivity/trends` | 2.6 | activity heatmap |+| `/api/digital-twin/identity/goals` | 2.7 | goal monuments |+| `/api/digital-twin/identity/chronotype/energy-schedule` | 3.1 | energy overlay |+| `/api/meatspace/apple-health/metrics/latest` | 2.9 | health vitals tower |+| `/api/memory/graph` | 3.2 | memory district |+| `/api/character/` | 2.11 | XP HUD |+| `/api/backup/*` | 2.3 | vault state |++## Sockets used / to use++Existing events the city should hook into more deeply:++- `apps:changed` (already used)+- `cos:agent:spawned` / `updated` / `completed` (already used)+- `cos:status`, `cos:log` (already used)+- `tasks:cos:created` / `changed` / `completed` (Phase 2.2)+- `ai:status` (Phase 2.1)+- `app:deploy:start/step/complete/error` (Phase 1.13, 2.10)+- `backup:started` / `completed` (Phase 2.3)+- `voice:idle` / `dictation` / `error` (Phase 2.4)+- `system:critical-error` / `health:check` / `health:critical` (Phase 1.4, 1.7)+- `peer:online` / `peers:updated` (Phase 2.5)++## Verification per phase++**Phase 1 acceptance test:** open `/cybercity`, confirm at a glance which apps+need attention, search for a specific app by name in <2s, click any HUD stat+and land on the relevant page, work the same flow on a phone via Tailscale.++**Phase 2 acceptance test:** every major system in PortOS has a visible spatial+representation; new socket events animate the city in real time; opening+`/cybercity` instead of `/dashboard` is a viable daily workflow.++**Phase 3 acceptance test:** the city feels distinctive — soundscape and mood+shift with system state, milestones leave permanent visual artifacts, and+photo mode produces shareable postcards.