Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix([issue-715]): address claude + codex review
Adam Eivycc67d1639d56
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8cd8673eca..09a62d6bf0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,7 +10,7 @@- **[issue-711] Per-domain autonomy guardrails** — The Chief of Staff config gains a "Domain Guardrails" panel that lets you set how much each domain acts on its own, independently: Brain auto-classify, Memory auto-extract, CoS auto-run, and Messages auto-send. Each is Off (never act automatically — leave it for you), Dry-run (do the thinking and surface what it would do, but don't commit the side effect), or Execute (act automatically — the default, so nothing changes unless you dial a domain back). Dry-run captures and classifies thoughts but holds them for your confirmation, routes extracted memories to pending approval instead of storing them live, lists the autonomous tasks it would have run without spawning them, and skips outbound message forwarding while logging what it would have sent.- **[issue-713] Pinned & Recent in the sidebar** — The top of the left navigation now shows the pages you've pinned and the ones you visited most recently, so your working set is one click away. Hover (or keyboard-focus) a page row inside any sidebar section to reveal a pin button; pinned pages stay at the top until you unpin them, and Recent tracks your last few pages automatically. Both sections appear only when they have something to show.- **[issue-715] "Why am I seeing this?" chips on Insights** — Your taste-identity theme cards now carry a tappable provenance chip alongside the confidence badge, the same source-chip affordance the health views use. Tap it to see that the theme was inferred by AI from your taste profile (not something you stated outright) and what would change it — answering more of your profile or regenerating. Confidence (how strong the pattern is) and provenance (how it was derived) are now two distinct, honest signals on every card.-- **[issue-715] "Why am I seeing this?" chips across Chief of Staff, Goals, and the dashboard** — The same provenance chip now appears wherever PortOS shows you something it derived rather than something you set. The Chief of Staff's actionable-insights banner explains that its top recommendation was surfaced from your task queue and recent activity. A goal's detail panel marks its urgency and activity-budget readings as modeled from your health timeline and linked activities — not numbers you entered — so a derived reading never reads as a fact you stated. On the dashboard, the Proactive Alerts card declares its alerts are inferred from trends in your goals, costs, and system metrics, while the Decision Log card declares its entries are read straight from the ledger of choices the Chief of Staff actually made. Tap any chip for how it was derived and what would change it.+- **[issue-715] "Why am I seeing this?" chips across Chief of Staff, Goals, and the dashboard** — The same provenance chip now appears wherever PortOS shows you something it derived rather than something you set. The Chief of Staff's actionable-insights banner explains how its top item was derived — a live count of your records (pending approvals, blocked tasks) reads as data-backed, while a success-rate-driven suggestion reads as inferred. A goal's detail panel marks its urgency and activity-budget readings as modeled from your health timeline and linked activities — not numbers you entered — so a derived reading never reads as a fact you stated. On the dashboard, the Proactive Alerts card declares its alerts are inferred from trends in your goals, costs, and system metrics, while the Decision Log card declares its entries are read straight from the ledger of choices the Chief of Staff actually made. Tap any chip for how it was derived and what would change it.## Changeddiff --git a/client/src/components/DecisionLogWidget.jsx b/client/src/components/DecisionLogWidget.jsxindex 397b0404be..085a7c2955 100644--- a/client/src/components/DecisionLogWidget.jsx+++ b/client/src/components/DecisionLogWidget.jsx@@ -239,14 +239,14 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {return (<div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">{/* Header */}- <div className="flex items-center justify-between mb-4">- <div className="flex items-center gap-3">- <div className="text-2xl" aria-hidden="true">+ <div className="flex items-center justify-between gap-2 mb-4">+ <div className="flex items-center gap-3 min-w-0">+ <div className="shrink-0 text-2xl" aria-hidden="true"><Eye className="w-6 h-6 text-purple-400" /></div>- <div>- <h3 className="text-lg font-semibold text-white">Decision Log</h3>- <p className="text-sm text-gray-500">+ <div className="min-w-0">+ <h3 className="text-lg font-semibold text-white truncate">Decision Log</h3>+ <p className="text-sm text-gray-500 truncate">{last24Hours.total > 0? `${last24Hours.total} decisions in last 24h`: 'No recent decisions'}diff --git a/client/src/components/ProactiveAlertsWidget.jsx b/client/src/components/ProactiveAlertsWidget.jsxindex 791ff5031e..e6703804e1 100644--- a/client/src/components/ProactiveAlertsWidget.jsx+++ b/client/src/components/ProactiveAlertsWidget.jsx@@ -72,18 +72,18 @@ const ProactiveAlertsWidget = memo(function ProactiveAlertsWidget() {return (<div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">{/* Header */}- <div className="flex items-center justify-between mb-3">- <div className="flex items-center gap-3">- <div className={`p-2 rounded-lg ${hasAlerts ? 'bg-port-warning/10' : 'bg-port-success/10'}`}>+ <div className="flex items-center justify-between gap-2 mb-3">+ <div className="flex items-center gap-3 min-w-0">+ <div className={`shrink-0 p-2 rounded-lg ${hasAlerts ? 'bg-port-warning/10' : 'bg-port-success/10'}`}>{hasAlerts ? (<Bell className="w-5 h-5 text-port-warning" />) : (<CheckCircle className="w-5 h-5 text-port-success" />)}</div>- <div>- <h3 className="text-lg font-semibold text-white">Proactive Alerts</h3>- <p className="text-sm text-gray-500">+ <div className="min-w-0">+ <h3 className="text-lg font-semibold text-white truncate">Proactive Alerts</h3>+ <p className="text-sm text-gray-500 truncate">{hasAlerts? `${counts.total} alert${counts.total !== 1 ? 's' : ''} detected`: 'All systems nominal'}diff --git a/client/src/components/cos/ActionableInsightsBanner.jsx b/client/src/components/cos/ActionableInsightsBanner.jsxindex 625e841d32..7b92d01749 100644--- a/client/src/components/cos/ActionableInsightsBanner.jsx+++ b/client/src/components/cos/ActionableInsightsBanner.jsx@@ -18,18 +18,34 @@ import {import * as api from '../../services/api';import ProvenanceChip from '../ui/ProvenanceChip';-// Actionable insights are surfaced by the Chief of Staff from your current task-// queue, system state, and recent activity — recommendations it derived, never-// something you set outright. The chip answers "why am I seeing this?" the same-// way the taste-identity and health surfaces do.-const INSIGHT_PROVENANCE = {+// The chip answers "why am I seeing this?" the same way the taste-identity and+// health surfaces do — but the honesty distinction the feature exists to enforce+// means the level must match how each insight was actually derived. Most insight+// types are direct counts read off records (N tasks awaiting approval, N blocked,+// N health issues) → data-backed. Only the two that lean on success-rate+// statistics — auto-skipped task types and the peak-productivity-hour suggestion+// — are genuinely modeled → inferred.+const INFERRED_INSIGHT_TYPES = new Set(['learning', 'peak-time']);++const DATA_BACKED_PROVENANCE = {+ level: 'data-backed',+ explainer:+ 'Surfaced by your Chief of Staff from a live count of your own records — pending approvals, blocked tasks, health issues, your queue — then prioritized. The underlying number is read straight off your data, not modeled.',+ whatWouldChange:+ 'Clearing the underlying items — approving, unblocking, resolving — updates or removes this on the next evaluation.',+};++const INFERRED_PROVENANCE = {level: 'inferred',explainer:- 'Surfaced by your Chief of Staff from your current task queue, system state, and recent activity — a prioritized recommendation it derived, not an alert you configured.',+ 'Surfaced by your Chief of Staff from statistical patterns in your task history — success rates by task type and time of day — not a value you set or a direct count.',whatWouldChange:- 'Acting on it, clearing the underlying tasks, or changing your queue updates or removes the recommendation on the next evaluation.',+ 'As more task runs accumulate and those success rates shift, this recommendation is recomputed or drops away.',};+export const insightProvenance = (type) =>+ INFERRED_INSIGHT_TYPES.has(type) ? INFERRED_PROVENANCE : DATA_BACKED_PROVENANCE;+const ICON_MAP = {AlertCircle,AlertTriangle,@@ -152,7 +168,7 @@ export default function ActionableInsightsBanner({ onTaskUnblocked }) {Urgent</span>)}- <ProvenanceChip {...INSIGHT_PROVENANCE} />+ <ProvenanceChip {...insightProvenance(primaryInsight.type)} /></div>{primaryInsight.description && !isExpanded && (<p className="text-xs text-gray-400 mt-0.5 line-clamp-1">diff --git a/client/src/components/cos/ActionableInsightsBanner.test.jsx b/client/src/components/cos/ActionableInsightsBanner.test.jsxnew file mode 100644index 0000000000..6cef8845d7--- /dev/null+++ b/client/src/components/cos/ActionableInsightsBanner.test.jsx@@ -0,0 +1,29 @@+import { describe, it, expect } from 'vitest';+import { insightProvenance } from './ActionableInsightsBanner';++// The banner stamps each surfaced insight with a provenance chip. The honesty+// distinction the feature exists to enforce is that a *counted fact* (N tasks+// awaiting approval, N blocked, N health issues) must read as data-backed, while+// only the success-rate-modeled types (auto-skipped task types, peak-hour+// suggestion) read as inferred. These tests pin that mapping so it can't silently+// regress back to a single hardcoded level.+describe('ActionableInsightsBanner insightProvenance', () => {+ it('marks direct-count insight types as data-backed', () => {+ for (const type of ['approval', 'blocked', 'health', 'briefing', 'tasks']) {+ expect(insightProvenance(type).level).toBe('data-backed');+ }+ });++ it('marks success-rate-modeled insight types as inferred', () => {+ for (const type of ['learning', 'peak-time']) {+ expect(insightProvenance(type).level).toBe('inferred');+ }+ });++ it('defaults an unknown insight type to data-backed (a count, not a model)', () => {+ // New insight types are far more likely to be counts than statistical models,+ // so the safe default is data-backed — an over-claim of "inferred" is the one+ // mislabel this feature must avoid.+ expect(insightProvenance('some-future-type').level).toBe('data-backed');+ });+});diff --git a/client/src/components/goals/GoalDetailPanel.jsx b/client/src/components/goals/GoalDetailPanel.jsxindex 37bf960c06..5ee595285a 100644--- a/client/src/components/goals/GoalDetailPanel.jsx+++ b/client/src/components/goals/GoalDetailPanel.jsx@@ -52,8 +52,12 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })const excludedIds = s.getDescendantIds(goal.id);const parentOptions = (allGoals || []).filter(g => !excludedIds.has(g.id));- // Only declare provenance when an AI-derived reading is actually on the panel.- const hasDerivedReading = goal.urgency != null || goal.feasibility != null;+ // Only declare provenance when an AI-derived reading is actually on the panel:+ // a modeled urgency, or an activity-budget block (which needs `feasibility.links`+ // to render). Edit mode replaces these readings with the edit form, so the chip+ // is also suppressed there — see the `!s.editing` gate in the header below.+ const hasDerivedReading = goal.urgency != null+ || (goal.feasibility && Array.isArray(goal.feasibility.links));return (<div className="w-full sm:w-80 bg-port-card border-l border-port-border h-full overflow-y-auto p-4 space-y-4">@@ -73,7 +77,7 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh }))}</div><div className="flex items-center gap-1.5 shrink-0">- {hasDerivedReading && <ProvenanceChip {...READING_PROVENANCE} />}+ {!s.editing && hasDerivedReading && <ProvenanceChip {...READING_PROVENANCE} />}<button onClick={onClose} className="p-1 text-gray-500 hover:text-white shrink-0"><X className="w-4 h-4" /></button>diff --git a/client/src/components/goals/GoalDetailPanel.test.jsx b/client/src/components/goals/GoalDetailPanel.test.jsxindex e797c7b429..b4963475b5 100644--- a/client/src/components/goals/GoalDetailPanel.test.jsx+++ b/client/src/components/goals/GoalDetailPanel.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen } from '@testing-library/react';+import { render, screen, fireEvent } from '@testing-library/react';// The panel fires getActivities()/getCalendarAccounts() on mount; stub them so the// read view renders without network. The badge assertions below only care about@@ -123,4 +123,13 @@ describe('GoalDetailPanel provenance chip', () => {renderPanel({ ...baseGoal, urgency: undefined, feasibility: undefined });expect(screen.queryByText('Inferred')).toBeNull();});++ it('suppresses the provenance chip in edit mode (readings are off-screen)', async () => {+ // Edit mode swaps the urgency/activity-budget read view for the edit form, so+ // a chip attributing those readings would point at content no longer shown.+ renderPanel();+ expect(screen.getByText('Inferred')).toBeTruthy(); // read mode: present+ fireEvent.click(screen.getByText('Edit'));+ expect(screen.queryByText('Inferred')).toBeNull();+ });});