Skip to content

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

feat([issue-2142]): Privacy Center UI shell — Vault & Organizations tabs + nav

Adam Eivy1653a692581c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 92f90f1bfb..4bb78ed0ca 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -29,6 +29,10 @@
- **Partially-completed issues no longer become un-claimable "zombies," and a new scheduled task heals any that already exist.** When a claim run shipped only PART of an issue's scope and merged the PR, the issue was left OPEN with its `in-progress` label (and assignee) still on — and since the claim queue treats `in-progress` as "claimed and being worked," the remaining scope was never re-picked and never finished (real cases: #2220, #2179, #2175). The completion flow was binary (fully-done → close + unlabel) with no "partial ship" path, and the branch reconciler is branch-centric so it never touched the linked issue. Two fixes: **(1)** the `claim-issue` / `-gitlab` / `-jira` prompts now choose the PR trailer deliberately (`Closes` for a full ship, `Refs` + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with an agent-judged hybrid — close + file a scoped follow-up when the remainder is a clean separable chunk, else post a `Done ✓ / Remaining ▢` comment and release the `in-progress` claim so the queue re-picks it (JIRA records remaining scope + files a follow-up ticket). **(2)** a new opt-in per-app `issue-reconcile` CoS task (sibling to `branch-reconcile`, disabled by default) runs a deterministic `gh`/`git` scan for zombie issues — open + `in-progress` yet with their PR merged and no live claim anywhere (no open PR, no local/remote/CoS claim branch, no active agent) — and dispatches a coordinator agent that applies the same hybrid per issue, with an `autoClose` toggle (OFF ⇒ comment + release only) and follow-up dedup so two federated peers can't file duplicates. Perpetual drain with a convergence signature, exactly like branch-reconcile. (`server/services/issueReconcile.js`, `server/services/cosTaskGenerator.js`, `server/services/taskSchedule.js`, `server/lib/cosValidation.js`, `server/services/taskPromptDefaults/`)
+## Privacy Center
+
+- **[issue-2142] A new Privacy Center UI puts your encrypted PII vault and the organizations that hold it in one place.** Building on the Phase 1 encrypted vault (#2140) and Phase 2 trusted-organizations registry (#2141), a deep-linkable `/privacy/:tab` page (Identity → Privacy, `⌘K`/voice-navigable) ships three tabs: **Overview** — a doctor-style readout of whether AES-256-GCM encryption is engaged, vault record counts by type, and org counts by trust stance, with quick-jump cards into the other tabs; **Vault** — records grouped by type showing only the precomputed masked value (`•••, Portland OR` / `a•••@example.com`), with per-record "Share with Twin" / "Use for scans" optimistic toggles (hard-disabled for sensitive SSN/passport/license/financial types), a create/edit `Drawer`, and an explicit per-record **Reveal** action that decrypts plaintext only on click (never cached in list state) — plaintext never renders until you ask for it; **Organizations** — a trust/category/status chip-filtered list with per-org holdings status badges and a create/edit drawer whose holdings picker checkboxes over your vault records (masked) to record which fields each org holds. All mutations update local state directly (no full-list refetch), deletes use an inline confirm row (no `window.confirm`), and every tab is usable at 360px. Each tab path is registered in the nav manifest (`nav.identity.privacy-*`). (`client/src/pages/Privacy.jsx`, `client/src/components/privacy/`, `client/src/services/apiPrivacy.js`, `server/lib/navManifest.js`)
+
## Layered Intelligence
- **[issue-2262] A dedicated Layered Intelligence page now surfaces the self-improvement loop's status across every app.** The perpetual per-app loop was previously visible only inside each app's Edit-App → Intelligence drawer tab, so there was no single place to see which apps had it enabled, when each last ran / is next due, or whether the global sweep job is even on. The new `/layered-intelligence` route (Chief of Staff → Layered Intelligence, `⌘K`/voice-navigable) reads a deterministic cross-app overview — each active app's effective config plus scheduler bookkeeping (`lastRunAt`/`nextDueAt`/due) and the global job's on/off state — with no LLM or forge I/O. It warns when the global job is disabled (per-app configs are inert until it's on), lists enabled apps with their interval, telemetry sources, allowed scopes, and provider, and deep-links each app's "Configure" action straight into its Intelligence tab (`/apps/:id?edit=1&appTab=intelligence`, via a new auto-open trigger on the app-detail drawer). (`server/routes/apps.js`, `server/services/layeredIntelligence.js` `summarizeLoopStatus`, `client/src/pages/LayeredIntelligence.jsx`, `client/src/components/apps/AppDetailView.jsx`, `server/lib/navManifest.js`)
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 6ba68e5a25..56e1781eca 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -76,6 +76,7 @@ const PromptManager = lazyWithReload(() => import('./pages/PromptManager'));
const Brain = lazyWithReload(() => import('./pages/Brain'));
const Security = lazyWithReload(() => import('./pages/Security'));
const DigitalTwin = lazyWithReload(() => import('./pages/DigitalTwin'));
+const Privacy = lazyWithReload(() => import('./pages/Privacy'));
const Agents = lazyWithReload(() => import('./pages/Agents'));
const Uploads = lazyWithReload(() => import('./pages/Uploads'));
const Settings = lazyWithReload(() => import('./pages/Settings'));
@@ -228,6 +229,8 @@ export default function App() {
<Route path="brain/:tab" element={<Brain />} />
<Route path="digital-twin" element={<Navigate to="/digital-twin/overview" replace />} />
<Route path="digital-twin/:tab" element={<DigitalTwin />} />
+ <Route path="privacy" element={<Navigate to="/privacy/overview" replace />} />
+ <Route path="privacy/:tab" element={<Privacy />} />
<Route path="goals" element={<Navigate to="/goals/tree" replace />} />
<Route path="goals/:tab" element={<Goals />} />
<Route path="feature-agents" element={<FeatureAgents />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index b22ca2a2d6..9ee78ef988 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -319,6 +319,7 @@ const navItems = [
{ to: '/digital-twin/import', label: 'Import', icon: Upload },
{ to: '/digital-twin/interview', label: 'Interview', icon: MessageSquare },
{ to: '/digital-twin/overview', label: 'Overview', icon: Heart },
+ { to: '/privacy/overview', label: 'Privacy', icon: Shield },
{ to: '/digital-twin/taste', label: 'Taste', icon: Palette },
{ to: '/digital-twin/test', label: 'Test', icon: CheckCircle },
{ to: '/digital-twin/time-capsule', label: 'Time Capsule', icon: Archive },
diff --git a/client/src/components/privacy/OrgDrawer.jsx b/client/src/components/privacy/OrgDrawer.jsx
new file mode 100644
index 0000000000..27bafbe785
--- /dev/null
+++ b/client/src/components/privacy/OrgDrawer.jsx
@@ -0,0 +1,167 @@
+import { useState, useEffect } from 'react';
+import Drawer from '../Drawer';
+import FormField from '../ui/FormField';
+import { useAsyncAction } from '../../hooks/useAsyncAction';
+import {
+ createPrivacyOrg, updatePrivacyOrg, getOrgHoldings, setOrgHoldings,
+} from '../../services/api';
+import toast from '../ui/Toast';
+import { ORG_CATEGORIES, ORG_TRUST_LEVELS, ORG_STATUSES, VAULT_TYPES, labelFor } from './constants';
+
+const inputCls = 'w-full bg-port-bg border border-port-border rounded px-3 py-2 text-white text-sm focus:outline-none focus:border-port-accent';
+
+const EMPTY = {
+ name: '', category: 'other', website: '', trust: 'trusted', status: 'active',
+ contactEmail: '', contactPhone: '', notes: '',
+};
+
+// Create/edit an organization plus which vault records it holds. The holdings
+// picker is a checkbox list over the user's vault records (masked values only).
+// Holdings are saved via the replace-set endpoint after the org exists (on
+// create we POST the org first, then set holdings against the returned id).
+export default function OrgDrawer({ open, org, vaultRecords, onClose, onSaved }) {
+ const editing = !!org;
+ const [form, setForm] = useState(EMPTY);
+ const [selected, setSelected] = useState(() => new Set()); // vaultRecordId set
+
+ useEffect(() => {
+ if (!open) return;
+ setForm(org
+ ? {
+ name: org.name ?? '',
+ category: org.category ?? 'other',
+ website: org.website ?? '',
+ trust: org.trust ?? 'trusted',
+ status: org.status ?? 'active',
+ contactEmail: org.contact?.email ?? '',
+ contactPhone: org.contact?.phone ?? '',
+ notes: org.notes ?? '',
+ }
+ : { ...EMPTY });
+ setSelected(new Set());
+ // Load existing holdings for an org being edited.
+ if (org?.id) {
+ getOrgHoldings(org.id, { silent: true })
+ .then((h) => setSelected(new Set((h || []).map((x) => x.vaultRecordId))))
+ .catch(() => {});
+ }
+ }, [open, org]);
+
+ const set = (k, v) => setForm((prev) => ({ ...prev, [k]: v }));
+ const toggleHolding = (id) => setSelected((prev) => {
+ const next = new Set(prev);
+ if (next.has(id)) next.delete(id); else next.add(id);
+ return next;
+ });
+
+ const [save, saving] = useAsyncAction(async () => {
+ if (!form.name.trim()) { toast.error('Name is required'); return null; }
+ const contact = {};
+ if (form.contactEmail.trim()) contact.email = form.contactEmail.trim();
+ if (form.contactPhone.trim()) contact.phone = form.contactPhone.trim();
+ const payload = {
+ name: form.name.trim(),
+ category: form.category,
+ website: form.website,
+ trust: form.trust,
+ status: form.status,
+ contact,
+ notes: form.notes,
+ };
+
+ const savedOrg = editing
+ ? await updatePrivacyOrg(org.id, payload, { silent: true })
+ : await createPrivacyOrg(payload, { silent: true });
+ if (!savedOrg) return null;
+
+ // Persist holdings (replace-set). Skip the call on create when nothing is selected.
+ const holdings = [...selected].map((vaultRecordId) => ({ vaultRecordId }));
+ if (editing || holdings.length > 0) {
+ await setOrgHoldings(savedOrg.id, holdings, { silent: true }).catch(() => {
+ toast.error('Organization saved, but holdings could not be updated');
+ });
+ }
+
+ toast.success(editing ? 'Organization updated' : 'Organization created');
+ onSaved(savedOrg, editing, selected.size);
+ return savedOrg;
+ }, { errorMessage: editing ? 'Failed to update organization' : 'Failed to create organization' });
+
+ return (
+ <Drawer
+ open={open}
+ onClose={onClose}
+ title={editing ? 'Edit organization' : 'New organization'}
+ subtitle={editing ? org?.name : undefined}
+ size="md"
+ closeOnEsc={false}
+ closeOnBackdrop={false}
+ >
+ <form className="space-y-4" onSubmit={(e) => { e.preventDefault(); save(); }}>
+ <FormField label="Name">
+ <input type="text" value={form.name} onChange={(e) => set('name', e.target.value)} placeholder="e.g. Acme Bank" className={inputCls} maxLength={200} />
+ </FormField>
+
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
+ <FormField label="Category">
+ <select value={form.category} onChange={(e) => set('category', e.target.value)} className={inputCls}>
+ {ORG_CATEGORIES.map((c) => <option key={c.id} value={c.id}>{c.label}</option>)}
+ </select>
+ </FormField>
+ <FormField label="Trust">
+ <select value={form.trust} onChange={(e) => set('trust', e.target.value)} className={inputCls}>
+ {ORG_TRUST_LEVELS.map((t) => <option key={t.id} value={t.id}>{t.label}</option>)}
+ </select>
+ </FormField>
+ <FormField label="Status">
+ <select value={form.status} onChange={(e) => set('status', e.target.value)} className={inputCls}>
+ {ORG_STATUSES.map((s) => <option key={s.id} value={s.id}>{s.label}</option>)}
+ </select>
+ </FormField>
+ </div>
+
+ <FormField label="Website">
+ <input type="text" value={form.website} onChange={(e) => set('website', e.target.value)} placeholder="https://…" className={inputCls} maxLength={2000} />
+ </FormField>
+
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
+ <FormField label="Contact email">
+ <input type="email" value={form.contactEmail} onChange={(e) => set('contactEmail', e.target.value)} className={inputCls} maxLength={320} />
+ </FormField>
+ <FormField label="Contact phone">
+ <input type="tel" value={form.contactPhone} onChange={(e) => set('contactPhone', e.target.value)} className={inputCls} maxLength={64} />
+ </FormField>
+ </div>
+
+ <div>
+ <span className="block text-sm text-gray-400 mb-1">Holdings — which vault records does this org have?</span>
+ {(!vaultRecords || vaultRecords.length === 0) ? (
+ <p className="text-xs text-gray-500">No vault records yet. Add records in the Vault tab first.</p>
+ ) : (
+ <div className="max-h-52 overflow-y-auto border border-port-border rounded divide-y divide-port-border">
+ {vaultRecords.map((rec) => (
+ <label key={rec.id} className="flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-port-bg/50">
+ <input type="checkbox" checked={selected.has(rec.id)} onChange={() => toggleHolding(rec.id)} className="accent-port-accent" />
+ <span className="text-gray-300 truncate flex-1">{rec.label}</span>
+ <span className="text-[11px] text-gray-500">{labelFor(VAULT_TYPES, rec.type)}</span>
+ <span className="font-mono text-[11px] text-gray-500 truncate max-w-[40%]">{rec.maskedValue}</span>
+ </label>
+ ))}
+ </div>
+ )}
+ </div>
+
+ <FormField label="Notes">
+ <textarea value={form.notes} onChange={(e) => set('notes', e.target.value)} rows={3} className={inputCls} maxLength={5000} />
+ </FormField>
+
+ <div className="flex items-center justify-end gap-2 pt-2">
+ <button type="button" onClick={onClose} className="px-3 py-2 text-sm text-gray-400 hover:text-white">Cancel</button>
+ <button type="submit" disabled={saving} className="px-4 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50">
+ {saving ? 'Saving…' : (editing ? 'Save changes' : 'Create organization')}
+ </button>
+ </div>
+ </form>
+ </Drawer>
+ );
+}
diff --git a/client/src/components/privacy/PrivacyOrgsTab.jsx b/client/src/components/privacy/PrivacyOrgsTab.jsx
new file mode 100644
index 0000000000..f450144716
--- /dev/null
+++ b/client/src/components/privacy/PrivacyOrgsTab.jsx
@@ -0,0 +1,201 @@
+import { useState, useEffect, useCallback } from 'react';
+import { Plus, Pencil, Trash2, ExternalLink, Building2 } from 'lucide-react';
+import {
+ getPrivacyOrgs, deletePrivacyOrg, getVaultRecords, getOrgHoldings,
+} from '../../services/api';
+import toast from '../ui/Toast';
+import InlineConfirmRow from '../ui/InlineConfirmRow';
+import OrgDrawer from './OrgDrawer';
+import {
+ ORG_CATEGORIES, ORG_TRUST_LEVELS, ORG_STATUSES, ORG_HOLDING_STATUSES,
+ TRUST_TONE, HOLDING_TONE, labelFor,
+} from './constants';
+
+// Filter chip row — a single-select toggle group over a list of {id,label}.
+function ChipFilter({ label, options, value, onChange }) {
+ return (
+ <div className="flex flex-wrap items-center gap-1.5">
+ <span className="text-[11px] uppercase tracking-wide text-gray-500 mr-1">{label}</span>
+ <button
+ onClick={() => onChange(null)}
+ className={`text-xs px-2 py-1 rounded border ${value == null ? 'border-port-accent/50 text-port-accent bg-port-accent/10' : 'border-port-border text-gray-400 hover:text-white'}`}
+ >
+ All
+ </button>
+ {options.map((o) => (
+ <button
+ key={o.id}
+ onClick={() => onChange(value === o.id ? null : o.id)}
+ className={`text-xs px-2 py-1 rounded border ${value === o.id ? 'border-port-accent/50 text-port-accent bg-port-accent/10' : 'border-port-border text-gray-400 hover:text-white'}`}
+ >
+ {o.label}
+ </button>
+ ))}
+ </div>
+ );
+}
+
+export default function PrivacyOrgsTab() {
+ const [orgs, setOrgs] = useState([]);
+ const [vaultRecords, setVaultRecords] = useState([]);
+ const [holdingsByOrg, setHoldingsByOrg] = useState({}); // orgId -> [holdings]
+ const [loading, setLoading] = useState(true);
+ const [filters, setFilters] = useState({ trust: null, category: null, status: null });
+ const [drawerOpen, setDrawerOpen] = useState(false);
+ const [editing, setEditing] = useState(null);
+ const [confirmDelete, setConfirmDelete] = useState(null);
+
+ const load = useCallback(() => {
+ setLoading(true);
+ Promise.allSettled([getPrivacyOrgs(), getVaultRecords()]).then(async ([o, v]) => {
+ const orgList = o.status === 'fulfilled' ? o.value : [];
+ setOrgs(orgList);
+ setVaultRecords(v.status === 'fulfilled' ? v.value : []);
+ // Fetch holdings per org (single-user scale — a handful of orgs).
+ const entries = await Promise.all(orgList.map(async (org) => {
+ const h = await getOrgHoldings(org.id, { silent: true }).catch(() => []);
+ return [org.id, h || []];
+ }));
+ setHoldingsByOrg(Object.fromEntries(entries));
+ setLoading(false);
+ });
+ }, []);
+
+ useEffect(() => { load(); }, [load]);
+
+ const openCreate = () => { setEditing(null); setDrawerOpen(true); };
+ const openEdit = (org) => { setEditing(org); setDrawerOpen(true); };
+
+ const handleSaved = async (savedOrg, wasEditing) => {
+ setDrawerOpen(false);
+ setOrgs((prev) => (wasEditing ? prev.map((o) => (o.id === savedOrg.id ? savedOrg : o)) : [...prev, savedOrg]));
+ // Refresh this org's holdings badges.
+ const h = await getOrgHoldings(savedOrg.id, { silent: true }).catch(() => []);
+ setHoldingsByOrg((prev) => ({ ...prev, [savedOrg.id]: h || [] }));
+ };
+
+ const handleDelete = async (org) => {
+ setConfirmDelete(null);
+ const ok = await deletePrivacyOrg(org.id, { silent: true }).catch(() => null);
+ if (ok) {
+ setOrgs((prev) => prev.filter((o) => o.id !== org.id));
+ toast.success('Organization deleted');
+ } else {
+ toast.error('Failed to delete organization');
+ }
+ };
+
+ const visible = orgs.filter((o) => (
+ (!filters.trust || o.trust === filters.trust)
+ && (!filters.category || o.category === filters.category)
+ && (!filters.status || o.status === filters.status)
+ ));
+
+ // Holdings status → count for an org's badge row.
+ const holdingCounts = (orgId) => {
+ const counts = {};
+ for (const h of holdingsByOrg[orgId] || []) counts[h.status] = (counts[h.status] || 0) + 1;
+ return counts;
+ };
+
+ return (
+ <div className="space-y-4">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <div className="space-y-2">
+ <ChipFilter label="Trust" options={ORG_TRUST_LEVELS} value={filters.trust} onChange={(v) => setFilters((f) => ({ ...f, trust: v }))} />
+ <ChipFilter label="Category" options={ORG_CATEGORIES} value={filters.category} onChange={(v) => setFilters((f) => ({ ...f, category: v }))} />
+ <ChipFilter label="Status" options={ORG_STATUSES} value={filters.status} onChange={(v) => setFilters((f) => ({ ...f, status: v }))} />
+ </div>
+ <button onClick={openCreate} className="inline-flex items-center gap-1.5 px-3 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 self-start">
+ <Plus size={16} /> New organization
+ </button>
+ </div>
+
+ {loading ? (
+ <div className="text-gray-500 text-sm py-8 text-center">Loading organizations…</div>
+ ) : visible.length === 0 ? (
+ <div className="border border-dashed border-port-border rounded-lg p-8 text-center text-gray-500 text-sm">
+ {orgs.length === 0
+ ? 'No organizations yet. Track every bank, utility, employer, or platform that holds your PII.'
+ : 'No organizations match the current filters.'}
+ </div>
+ ) : (
+ <div className="space-y-2">
+ {visible.map((org) => {
+ const counts = holdingCounts(org.id);
+ return (
+ <div key={org.id} className="bg-port-card border border-port-border rounded-lg p-3">
+ <div className="flex flex-wrap items-start justify-between gap-3">
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-2 flex-wrap">
+ <Building2 size={15} className="text-gray-500 shrink-0" />
+ <span className="text-sm font-medium text-white truncate">{org.name}</span>
+ <span className={`text-[10px] px-1.5 py-0.5 rounded border ${TRUST_TONE[org.trust] || ''}`}>
+ {labelFor(ORG_TRUST_LEVELS, org.trust)}
+ </span>
+ <span className="text-[10px] px-1.5 py-0.5 rounded border border-port-border text-gray-400">
+ {labelFor(ORG_CATEGORIES, org.category)}
+ </span>
+ {org.status !== 'active' && (
+ <span className="text-[10px] px-1.5 py-0.5 rounded border border-port-border text-gray-400">
+ {labelFor(ORG_STATUSES, org.status)}
+ </span>
+ )}
+ </div>
+ <div className="mt-2 flex items-center gap-1.5 flex-wrap">
+ {Object.keys(counts).length === 0 ? (
+ <span className="text-[11px] text-gray-600">No holdings recorded</span>
+ ) : (
+ ORG_HOLDING_STATUSES.filter((s) => counts[s.id]).map((s) => (
+ <span key={s.id} className={`text-[10px] px-1.5 py-0.5 rounded border ${HOLDING_TONE[s.id] || ''}`}>
+ {counts[s.id]} {s.label.toLowerCase()}
+ </span>
+ ))
+ )}
+ </div>
+ </div>
+ <div className="flex items-center gap-1 shrink-0">
+ {org.website && (
+ <a
+ href={org.website}
+ target="_blank"
+ rel="noreferrer"
+ title="Open website"
+ aria-label="Open website"
+ className="p-2 rounded text-gray-400 hover:text-white hover:bg-port-border/50"
+ >
+ <ExternalLink size={16} />
+ </a>
+ )}
+ <button onClick={() => openEdit(org)} title="Edit organization" aria-label="Edit organization" className="p-2 rounded text-gray-400 hover:text-white hover:bg-port-border/50">
+ <Pencil size={16} />
+ </button>
+ <button onClick={() => setConfirmDelete(org.id)} title="Delete organization" aria-label="Delete organization" className="p-2 rounded text-gray-400 hover:text-port-error hover:bg-port-border/50">
+ <Trash2 size={16} />
+ </button>
+ </div>
+ </div>
+ {confirmDelete === org.id && (
+ <InlineConfirmRow
+ className="mt-3"
+ question={`Delete "${org.name}"? Holdings links are removed too.`}
+ onConfirm={() => handleDelete(org)}
+ onCancel={() => setConfirmDelete(null)}
+ />
+ )}
+ </div>
+ );
+ })}
+ </div>
+ )}
+
+ <OrgDrawer
+ open={drawerOpen}
+ org={editing}
+ vaultRecords={vaultRecords}
+ onClose={() => setDrawerOpen(false)}
+ onSaved={handleSaved}
+ />
+ </div>
+ );
+}
diff --git a/client/src/components/privacy/PrivacyOverviewTab.jsx b/client/src/components/privacy/PrivacyOverviewTab.jsx
new file mode 100644
index 0000000000..9de42f658f
--- /dev/null
+++ b/client/src/components/privacy/PrivacyOverviewTab.jsx
@@ -0,0 +1,113 @@
+import { useState, useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { ShieldCheck, ShieldAlert, KeyRound, Building2, ArrowRight } from 'lucide-react';
+import { getPrivacyStatus, getPrivacyOrgs } from '../../services/api';
+import { VAULT_TYPES, ORG_TRUST_LEVELS, TRUST_TONE, labelFor } from './constants';
+
+export default function PrivacyOverviewTab() {
+ const navigate = useNavigate();
+ const [status, setStatus] = useState(null);
+ const [orgs, setOrgs] = useState([]);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ Promise.allSettled([getPrivacyStatus(), getPrivacyOrgs()]).then(([s, o]) => {
+ setStatus(s.status === 'fulfilled' ? s.value : { keyConfigured: false, recordCounts: {} });
+ setOrgs(o.status === 'fulfilled' ? o.value : []);
+ setLoading(false);
+ });
+ }, []);
+
+ if (loading) return <div className="text-gray-500 text-sm py-8 text-center">Loading privacy status…</div>;
+
+ const recordCounts = status?.recordCounts || {};
+ const totalRecords = Object.values(recordCounts).reduce((a, b) => a + b, 0);
+ const keyConfigured = status?.keyConfigured !== false;
+
+ const trustCounts = ORG_TRUST_LEVELS.map((t) => ({
+ ...t,
+ count: orgs.filter((o) => o.trust === t.id).length,
+ }));
+
+ return (
+ <div className="space-y-6">
+ <p className="text-sm text-gray-500 max-w-2xl">
+ The Privacy Center is your system of record for personal identity facts and who holds them.
+ Vault values are encrypted at rest and never shown until you explicitly reveal them.
+ </p>
+
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
+ {/* Encryption status */}
+ <div className="bg-port-card border border-port-border rounded-lg p-5">
+ <div className="flex items-center gap-2 mb-3">
+ <KeyRound size={18} className="text-port-accent" />
+ <span className="text-sm font-semibold text-white">Encryption</span>
+ </div>
+ {keyConfigured ? (
+ <div className="flex items-center gap-2 text-port-success text-sm">
+ <ShieldCheck size={16} /> Engaged (AES-256-GCM)
+ </div>
+ ) : (
+ <div className="flex items-center gap-2 text-port-warning text-sm">
+ <ShieldAlert size={16} /> Key auto-provisions on first record
+ </div>
+ )}
+ <p className="text-xs text-gray-500 mt-2">
+ Protects against DB / backup / disk exposure — not a live host compromise.
+ </p>
+ </div>
+
+ {/* Vault records */}
+ <button
+ onClick={() => navigate('/privacy/vault')}
+ className="text-left bg-port-card border border-port-border rounded-lg p-5 hover:border-port-accent/50 transition-colors group"
+ >
+ <div className="flex items-center justify-between mb-3">
+ <span className="text-sm font-semibold text-white">Vault records</span>
+ <ArrowRight size={16} className="text-gray-600 group-hover:text-port-accent transition-colors" />
+ </div>
+ <div className="text-2xl font-bold text-white mb-1">{totalRecords}</div>
+ <div className="flex flex-wrap gap-1.5">
+ {VAULT_TYPES.filter((t) => recordCounts[t.id]).map((t) => (
+ <span key={t.id} className="text-[10px] px-1.5 py-0.5 rounded border border-port-border text-gray-400">
+ {recordCounts[t.id]} {t.label.toLowerCase()}
+ </span>
+ ))}
+ {totalRecords === 0 && <span className="text-xs text-gray-500">No records yet</span>}
+ </div>
+ </button>
+
+ {/* Organizations */}
+ <button
+ onClick={() => navigate('/privacy/organizations')}
+ className="text-left bg-port-card border border-port-border rounded-lg p-5 hover:border-port-accent/50 transition-colors group"
+ >
+ <div className="flex items-center justify-between mb-3">
+ <span className="inline-flex items-center gap-1.5 text-sm font-semibold text-white">
+ <Building2 size={16} className="text-gray-500" /> Organizations
+ </span>
+ <ArrowRight size={16} className="text-gray-600 group-hover:text-port-accent transition-colors" />
+ </div>
+ <div className="text-2xl font-bold text-white mb-1">{orgs.length}</div>
+ <div className="flex flex-wrap gap-1.5">
+ {trustCounts.filter((t) => t.count > 0).map((t) => (
+ <span key={t.id} className={`text-[10px] px-1.5 py-0.5 rounded border ${TRUST_TONE[t.id] || ''}`}>
+ {t.count} {labelFor(ORG_TRUST_LEVELS, t.id).toLowerCase()}
+ </span>
+ ))}
+ {orgs.length === 0 && <span className="text-xs text-gray-500">None tracked yet</span>}
+ </div>
+ </button>
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <button onClick={() => navigate('/privacy/vault')} className="px-3 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80">
+ Manage vault
+ </button>
+ <button onClick={() => navigate('/privacy/organizations')} className="px-3 py-2 text-sm rounded border border-port-border text-gray-300 hover:text-white hover:bg-port-card">
+ Manage organizations
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/components/privacy/PrivacyVaultTab.jsx b/client/src/components/privacy/PrivacyVaultTab.jsx
new file mode 100644
index 0000000000..1d269a5e8f
--- /dev/null
+++ b/client/src/components/privacy/PrivacyVaultTab.jsx
@@ -0,0 +1,212 @@
+import { useState, useEffect, useCallback } from 'react';
+import { Plus, Eye, EyeOff, Pencil, Trash2, ShieldCheck, ShieldAlert } from 'lucide-react';
+import {
+ getVaultRecords, deleteVaultRecord, revealVaultRecord, updateVaultRecord, getPrivacyStatus,
+} from '../../services/api';
+import toast from '../ui/Toast';
+import InlineConfirmRow from '../ui/InlineConfirmRow';
+import VaultRecordDrawer from './VaultRecordDrawer';
+import { VAULT_TYPES, SENSITIVE_TYPES } from './constants';
+
+// Toggle switch for share_with_twin / use_for_scans — optimistic PATCH, reverts
+// on failure. Disabled + off for the toggle when the type forbids it.
+function Toggle({ checked, disabled, onChange, label }) {
+ return (
+ <label className={`inline-flex items-center gap-1.5 text-xs cursor-pointer ${disabled ? 'opacity-40 cursor-not-allowed' : ''}`}>
+ <input type="checkbox" checked={checked} disabled={disabled} onChange={(e) => onChange(e.target.checked)} className="accent-port-accent" />
+ <span className="text-gray-400">{label}</span>
+ </label>
+ );
+}
+
+export default function PrivacyVaultTab() {
+ const [records, setRecords] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const [drawerOpen, setDrawerOpen] = useState(false);
+ const [editing, setEditing] = useState(null);
+ const [revealed, setRevealed] = useState({}); // id -> plaintext (never persisted)
+ const [confirmDelete, setConfirmDelete] = useState(null);
+ const [keyConfigured, setKeyConfigured] = useState(true);
+
+ const load = useCallback(() => {
+ setLoading(true);
+ Promise.allSettled([getVaultRecords(), getPrivacyStatus()]).then(([recs, status]) => {
+ setRecords(recs.status === 'fulfilled' ? recs.value : []);
+ if (status.status === 'fulfilled') setKeyConfigured(status.value.keyConfigured !== false);
+ setLoading(false);
+ });
+ }, []);
+
+ useEffect(() => { load(); }, [load]);
+
+ const openCreate = () => { setEditing(null); setDrawerOpen(true); };
+ const openEdit = (rec) => { setEditing(rec); setDrawerOpen(true); };
+
+ const handleSaved = (saved, wasEditing) => {
+ setDrawerOpen(false);
+ setRecords((prev) => (wasEditing
+ ? prev.map((r) => (r.id === saved.id ? saved : r))
+ : [saved, ...prev]));
+ // A replaced value invalidates any revealed plaintext.
+ setRevealed((prev) => { const next = { ...prev }; delete next[saved.id]; return next; });
+ };
+
+ const handleReveal = async (rec) => {
+ if (revealed[rec.id]) {
+ setRevealed((prev) => { const next = { ...prev }; delete next[rec.id]; return next; });
+ return;
+ }
+ const res = await revealVaultRecord(rec.id).catch(() => null);
+ if (res) setRevealed((prev) => ({ ...prev, [rec.id]: res.value }));
+ };
+
+ const handleDelete = async (rec) => {
+ setConfirmDelete(null);
+ const ok = await deleteVaultRecord(rec.id, { silent: true }).catch(() => null);
+ if (ok) {
+ setRecords((prev) => prev.filter((r) => r.id !== rec.id));
+ toast.success('Vault record deleted');
+ } else {
+ toast.error('Failed to delete record');
+ }
+ };
+
+ const handleToggle = async (rec, field, value) => {
+ const prevVal = rec[field];
+ setRecords((prev) => prev.map((r) => (r.id === rec.id ? { ...r, [field]: value } : r)));
+ const res = await updateVaultRecord(rec.id, { [field]: value }, { silent: true }).catch(() => null);
+ if (!res) {
+ setRecords((prev) => prev.map((r) => (r.id === rec.id ? { ...r, [field]: prevVal } : r)));
+ toast.error('Failed to update record');
+ } else {
+ // The server may coerce (e.g. useForScans forced false for sensitive types).
+ setRecords((prev) => prev.map((r) => (r.id === rec.id ? res : r)));
+ }
+ };
+
+ // Group records by type for a scannable table.
+ const groups = VAULT_TYPES
+ .map((t) => ({ ...t, rows: records.filter((r) => r.type === t.id) }))
+ .filter((g) => g.rows.length > 0);
+
+ return (
+ <div className="space-y-4">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <div className="flex items-center gap-2 text-sm">
+ {keyConfigured ? (
+ <span className="inline-flex items-center gap-1.5 text-port-success">
+ <ShieldCheck size={16} /> Encryption engaged
+ </span>
+ ) : (
+ <span className="inline-flex items-center gap-1.5 text-port-warning">
+ <ShieldAlert size={16} /> Encryption key not yet configured
+ </span>
+ )}
+ </div>
+ <button
+ onClick={openCreate}
+ className="inline-flex items-center gap-1.5 px-3 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80"
+ >
+ <Plus size={16} /> New record
+ </button>
+ </div>
+
+ {loading ? (
+ <div className="text-gray-500 text-sm py-8 text-center">Loading vault…</div>
+ ) : records.length === 0 ? (
+ <div className="border border-dashed border-port-border rounded-lg p-8 text-center text-gray-500 text-sm">
+ No vault records yet. Add your identity facts (name, addresses, phones, emails) — each is encrypted at rest.
+ </div>
+ ) : (
+ <div className="space-y-6">
+ {groups.map((g) => (
+ <div key={g.id}>
+ <h3 className="text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2">{g.label}</h3>
+ <div className="space-y-2">
+ {g.rows.map((rec) => {
+ const sensitive = SENSITIVE_TYPES.includes(rec.type);
+ return (
+ <div key={rec.id} className="bg-port-card border border-port-border rounded-lg p-3">
+ <div className="flex flex-wrap items-start justify-between gap-3">
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-2 flex-wrap">
+ <span className="text-sm font-medium text-white truncate">{rec.label}</span>
+ <span className={`text-[10px] px-1.5 py-0.5 rounded border ${rec.status === 'previous' ? 'border-gray-600 text-gray-400' : 'border-port-accent/40 text-port-accent'}`}>
+ {rec.status}
+ </span>
+ </div>
+ <div className="mt-1 font-mono text-sm text-gray-300 break-all">
+ {revealed[rec.id] ?? rec.maskedValue}
+ </div>
+ {(rec.validFrom || rec.validTo) && (
+ <div className="mt-1 text-[11px] text-gray-500">
+ {rec.validFrom || '…'} → {rec.validTo || 'present'}
+ </div>
+ )}
+ <div className="mt-2 flex items-center gap-4">
+ <Toggle
+ label="Twin"
+ checked={!!rec.shareWithTwin}
+ onChange={(v) => handleToggle(rec, 'shareWithTwin', v)}
+ />
+ <Toggle
+ label="Scans"
+ checked={!!rec.useForScans}
+ disabled={sensitive}
+ onChange={(v) => handleToggle(rec, 'useForScans', v)}
+ />
+ </div>
+ </div>
+ <div className="flex items-center gap-1 shrink-0">
+ <button
+ onClick={() => handleReveal(rec)}
+ title={revealed[rec.id] ? 'Hide value' : 'Reveal value'}
+ aria-label={revealed[rec.id] ? 'Hide value' : 'Reveal value'}
+ className="p-2 rounded text-gray-400 hover:text-white hover:bg-port-border/50"
+ >
+ {revealed[rec.id] ? <EyeOff size={16} /> : <Eye size={16} />}
+ </button>
+ <button
+ onClick={() => openEdit(rec)}
+ title="Edit record"
+ aria-label="Edit record"
+ className="p-2 rounded text-gray-400 hover:text-white hover:bg-port-border/50"
+ >
+ <Pencil size={16} />
+ </button>
+ <button
+ onClick={() => setConfirmDelete(rec.id)}
+ title="Delete record"
+ aria-label="Delete record"
+ className="p-2 rounded text-gray-400 hover:text-port-error hover:bg-port-border/50"
+ >
+ <Trash2 size={16} />
+ </button>
+ </div>
+ </div>
+ {confirmDelete === rec.id && (
+ <InlineConfirmRow
+ className="mt-3"
+ question={`Delete "${rec.label}"? This can't be undone.`}
+ onConfirm={() => handleDelete(rec)}
+ onCancel={() => setConfirmDelete(null)}
+ />
+ )}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ ))}
+ </div>
+ )}
+
+ <VaultRecordDrawer
+ open={drawerOpen}
+ record={editing}
+ onClose={() => setDrawerOpen(false)}
+ onSaved={handleSaved}
+ />
+ </div>
+ );
+}
diff --git a/client/src/components/privacy/VaultRecordDrawer.jsx b/client/src/components/privacy/VaultRecordDrawer.jsx
new file mode 100644
index 0000000000..403ec16554
--- /dev/null
+++ b/client/src/components/privacy/VaultRecordDrawer.jsx
@@ -0,0 +1,180 @@
+import { useState, useEffect } from 'react';
+import Drawer from '../Drawer';
+import FormField from '../ui/FormField';
+import { useAsyncAction } from '../../hooks/useAsyncAction';
+import { createVaultRecord, updateVaultRecord } from '../../services/api';
+import toast from '../ui/Toast';
+import { VAULT_TYPES, VAULT_STATUSES, SENSITIVE_TYPES } from './constants';
+
+// Create/edit a single encrypted vault record. Form state is hoisted into this
+// component (never left in uncontrolled inputs) per the drawer convention. On
+// edit the plaintext `value` is NOT prefilled (the list only ever holds the
+// masked value) — an empty value on edit means "leave the stored value
+// unchanged"; typing a new value re-encrypts it server-side.
+const inputCls = 'w-full bg-port-bg border border-port-border rounded px-3 py-2 text-white text-sm focus:outline-none focus:border-port-accent';
+
+const EMPTY = {
+ type: 'legal_name', label: '', value: '', status: 'current',
+ validFrom: '', validTo: '', shareWithTwin: false, useForScans: null, notes: '',
+};
+
+export default function VaultRecordDrawer({ open, record, onClose, onSaved }) {
+ const editing = !!record;
+ const [form, setForm] = useState(EMPTY);
+
+ useEffect(() => {
+ if (!open) return;
+ setForm(record
+ ? {
+ type: record.type,
+ label: record.label ?? '',
+ value: '',
+ status: record.status ?? 'current',
+ validFrom: record.validFrom ?? '',
+ validTo: record.validTo ?? '',
+ shareWithTwin: !!record.shareWithTwin,
+ useForScans: !!record.useForScans,
+ notes: record.notes ?? '',
+ }
+ : { ...EMPTY });
+ }, [open, record]);
+
+ const set = (k, v) => setForm((prev) => ({ ...prev, [k]: v }));
+ const isSensitive = SENSITIVE_TYPES.includes(form.type);
+
+ const [save, saving] = useAsyncAction(async () => {
+ if (!form.label.trim()) { toast.error('Label is required'); return null; }
+ if (!editing && !form.value.trim()) { toast.error('Value is required'); return null; }
+
+ const payload = {
+ label: form.label.trim(),
+ status: form.status,
+ validFrom: form.validFrom || null,
+ validTo: form.validTo || null,
+ shareWithTwin: form.shareWithTwin,
+ notes: form.notes,
+ // Sensitive types are hard-false server-side; only send an explicit choice
+ // for non-sensitive types.
+ ...(isSensitive ? {} : { useForScans: !!form.useForScans }),
+ };
+
+ let result;
+ if (editing) {
+ // Only send `value` when the user actually typed a replacement.
+ if (form.value.trim()) payload.value = form.value;
+ result = await updateVaultRecord(record.id, payload, { silent: true });
+ } else {
+ result = await createVaultRecord({ type: form.type, value: form.value, ...payload }, { silent: true });
+ }
+ if (result) {
+ toast.success(editing ? 'Vault record updated' : 'Vault record created');
+ onSaved(result, editing);
+ }
+ return result;
+ }, { errorMessage: editing ? 'Failed to update record' : 'Failed to create record' });
+
+ return (
+ <Drawer
+ open={open}
+ onClose={onClose}
+ title={editing ? 'Edit vault record' : 'New vault record'}
+ subtitle={editing ? record?.label : undefined}
+ size="md"
+ closeOnEsc={false}
+ closeOnBackdrop={false}
+ >
+ <form
+ className="space-y-4"
+ onSubmit={(e) => { e.preventDefault(); save(); }}
+ >
+ <FormField label="Type">
+ <select
+ value={form.type}
+ onChange={(e) => set('type', e.target.value)}
+ disabled={editing}
+ className={`${inputCls} ${editing ? 'opacity-60 cursor-not-allowed' : ''}`}
+ >
+ {VAULT_TYPES.map((t) => <option key={t.id} value={t.id}>{t.label}</option>)}
+ </select>
+ {editing && <p className="text-xs text-gray-500 mt-1">Type is immutable — delete and re-create to change it.</p>}
+ </FormField>
+
+ <FormField label="Label">
+ <input
+ type="text"
+ value={form.label}
+ onChange={(e) => set('label', e.target.value)}
+ placeholder="e.g. Home address"
+ className={inputCls}
+ maxLength={200}
+ />
+ </FormField>
+
+ <FormField
+ label={editing ? 'Value (leave blank to keep unchanged)' : 'Value'}
+ hint={editing ? 'Stored values are encrypted and never shown here. Type a new value to replace it.' : 'Encrypted at rest — never stored or logged in plaintext.'}
+ >
+ <input
+ type="text"
+ value={form.value}
+ onChange={(e) => set('value', e.target.value)}
+ placeholder={editing ? '••••••••' : ''}
+ autoComplete="off"
+ className={inputCls}
+ />
+ </FormField>
+
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
+ <FormField label="Status">
+ <select value={form.status} onChange={(e) => set('status', e.target.value)} className={inputCls}>
+ {VAULT_STATUSES.map((s) => <option key={s.id} value={s.id}>{s.label}</option>)}
+ </select>
+ </FormField>
+ <FormField label="Valid from">
+ <input type="date" value={form.validFrom || ''} onChange={(e) => set('validFrom', e.target.value)} className={inputCls} />
+ </FormField>
+ <FormField label="Valid to">
+ <input type="date" value={form.validTo || ''} onChange={(e) => set('validTo', e.target.value)} className={inputCls} />
+ </FormField>
+ </div>
+
+ <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
+ <input type="checkbox" checked={form.shareWithTwin} onChange={(e) => set('shareWithTwin', e.target.checked)} />
+ Share with Digital Twin
+ </label>
+
+ <label className={`flex items-center gap-2 text-sm cursor-pointer ${isSensitive ? 'text-gray-600 cursor-not-allowed' : 'text-gray-300'}`}>
+ <input
+ type="checkbox"
+ checked={isSensitive ? false : !!form.useForScans}
+ disabled={isSensitive}
+ onChange={(e) => set('useForScans', e.target.checked)}
+ />
+ Use for broker scans
+ {isSensitive && <span className="text-xs text-gray-500">(disabled for sensitive types)</span>}
+ </label>
+
+ <FormField label="Notes">
+ <textarea
+ value={form.notes}
+ onChange={(e) => set('notes', e.target.value)}
+ rows={3}
+ className={inputCls}
+ maxLength={5000}
+ />
+ </FormField>
+
+ <div className="flex items-center justify-end gap-2 pt-2">
+ <button type="button" onClick={onClose} className="px-3 py-2 text-sm text-gray-400 hover:text-white">Cancel</button>
+ <button
+ type="submit"
+ disabled={saving}
+ className="px-4 py-2 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50"
+ >
+ {saving ? 'Saving…' : (editing ? 'Save changes' : 'Create record')}
+ </button>
+ </div>
+ </form>
+ </Drawer>
+ );
+}
diff --git a/client/src/components/privacy/constants.js b/client/src/components/privacy/constants.js
new file mode 100644
index 0000000000..c987172574
--- /dev/null
+++ b/client/src/components/privacy/constants.js
@@ -0,0 +1,74 @@
+// Privacy Center shared enums + display labels (issue #2142). Kept in sync with
+// the server Zod schemas in server/lib/privacyValidation.js — a mismatch would
+// let the UI offer a value the API rejects.
+
+export const VAULT_TYPES = [
+ { id: 'legal_name', label: 'Legal name' },
+ { id: 'address', label: 'Address' },
+ { id: 'phone', label: 'Phone' },
+ { id: 'email', label: 'Email' },
+ { id: 'dob', label: 'Date of birth' },
+ { id: 'ssn', label: 'SSN' },
+ { id: 'passport', label: 'Passport' },
+ { id: 'drivers_license', label: "Driver's license" },
+ { id: 'financial_account', label: 'Financial account' },
+ { id: 'custom', label: 'Custom' },
+];
+
+// Mirrors PRIVACY_SENSITIVE_TYPES — these can never be used for broker scans.
+export const SENSITIVE_TYPES = ['ssn', 'passport', 'drivers_license', 'financial_account'];
+
+export const VAULT_STATUSES = [
+ { id: 'current', label: 'Current' },
+ { id: 'previous', label: 'Previous' },
+];
+
+export const ORG_CATEGORIES = [
+ { id: 'bank', label: 'Bank' },
+ { id: 'utility', label: 'Utility' },
+ { id: 'government', label: 'Government' },
+ { id: 'employer', label: 'Employer' },
+ { id: 'subscription', label: 'Subscription' },
+ { id: 'medical', label: 'Medical' },
+ { id: 'insurance', label: 'Insurance' },
+ { id: 'platform', label: 'Platform' },
+ { id: 'broker', label: 'Data broker' },
+ { id: 'other', label: 'Other' },
+];
+
+export const ORG_TRUST_LEVELS = [
+ { id: 'trusted', label: 'Trusted' },
+ { id: 'tolerated', label: 'Tolerated' },
+ { id: 'unwanted', label: 'Unwanted' },
+];
+
+export const ORG_STATUSES = [
+ { id: 'active', label: 'Active' },
+ { id: 'closed', label: 'Closed' },
+ { id: 'opted_out', label: 'Opted out' },
+];
+
+export const ORG_HOLDING_STATUSES = [
+ { id: 'current', label: 'Current' },
+ { id: 'update_pending', label: 'Update pending' },
+ { id: 'updated', label: 'Updated' },
+ { id: 'removed', label: 'Removed' },
+ { id: 'unknown', label: 'Unknown' },
+];
+
+// Tailwind tone classes per trust level (pre-composed — the JIT needs whole tokens).
+export const TRUST_TONE = {
+ trusted: 'bg-port-success/15 text-port-success border-port-success/30',
+ tolerated: 'bg-port-warning/15 text-port-warning border-port-warning/30',
+ unwanted: 'bg-port-error/15 text-port-error border-port-error/30',
+};
+
+export const HOLDING_TONE = {
+ current: 'bg-gray-700/40 text-gray-300 border-gray-600/40',
+ update_pending: 'bg-port-warning/15 text-port-warning border-port-warning/30',
+ updated: 'bg-port-success/15 text-port-success border-port-success/30',
+ removed: 'bg-gray-700/40 text-gray-400 border-gray-600/40',
+ unknown: 'bg-gray-700/40 text-gray-400 border-gray-600/40',
+};
+
+export const labelFor = (list, id) => list.find((x) => x.id === id)?.label ?? id;
diff --git a/client/src/pages/Privacy.jsx b/client/src/pages/Privacy.jsx
new file mode 100644
index 0000000000..0c56bfbab0
--- /dev/null
+++ b/client/src/pages/Privacy.jsx
@@ -0,0 +1,51 @@
+import { useNavigate } from 'react-router-dom';
+import { Shield, LayoutDashboard, KeyRound, Building2 } from 'lucide-react';
+import { useValidTab } from '../hooks/useValidTab';
+import PageHeader from '../components/PageHeader';
+import TabPills from '../components/ui/TabPills';
+import PrivacyOverviewTab from '../components/privacy/PrivacyOverviewTab';
+import PrivacyVaultTab from '../components/privacy/PrivacyVaultTab';
+import PrivacyOrgsTab from '../components/privacy/PrivacyOrgsTab';
+
+// Exported for the nav-manifest tab-coverage guard (server/lib/navManifest.test.js).
+// Each id maps to `/privacy/<id>` and needs a NAV_COMMANDS entry.
+export const TABS = [
+ { id: 'overview', label: 'Overview', icon: LayoutDashboard },
+ { id: 'vault', label: 'Vault', icon: KeyRound },
+ { id: 'organizations', label: 'Organizations', icon: Building2 },
+];
+
+export default function Privacy() {
+ const navigate = useNavigate();
+ const activeTab = useValidTab(TABS, 'overview');
+
+ const renderTab = () => {
+ switch (activeTab) {
+ case 'vault': return <PrivacyVaultTab />;
+ case 'organizations': return <PrivacyOrgsTab />;
+ case 'overview':
+ default: return <PrivacyOverviewTab />;
+ }
+ };
+
+ return (
+ <div className="flex flex-col">
+ <PageHeader
+ icon={Shield}
+ title="Privacy Center"
+ subtitle="Your PII vault and who holds it"
+ />
+ <TabPills
+ tabs={TABS}
+ activeTab={activeTab}
+ onChange={(id) => navigate(`/privacy/${id}`)}
+ mobileDropdown
+ mobileSelectId="privacy-tab-select"
+ ariaLabel="Privacy Center sections"
+ />
+ <div className="pt-4">
+ {renderTab()}
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/pages/Privacy.test.jsx b/client/src/pages/Privacy.test.jsx
new file mode 100644
index 0000000000..4efe74e1c3
--- /dev/null
+++ b/client/src/pages/Privacy.test.jsx
@@ -0,0 +1,87 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor, fireEvent } from '@testing-library/react';
+import { MemoryRouter, Routes, Route } from 'react-router-dom';
+
+// ── Mock the API surface ─────────────────────────────────────────────────────
+vi.mock('../services/api', () => ({
+ getPrivacyStatus: vi.fn().mockResolvedValue({
+ keyConfigured: true,
+ recordCounts: { address: 1, email: 1 },
+ }),
+ getVaultRecords: vi.fn().mockResolvedValue([
+ {
+ id: 'rec-1', type: 'address', label: 'Home address', maskedValue: '•••, Portland OR',
+ status: 'current', validFrom: null, validTo: null, shareWithTwin: false, useForScans: true,
+ },
+ {
+ id: 'rec-2', type: 'email', label: 'Primary email', maskedValue: 'a•••@example.com',
+ status: 'current', validFrom: null, validTo: null, shareWithTwin: true, useForScans: true,
+ },
+ ]),
+ revealVaultRecord: vi.fn().mockResolvedValue({ id: 'rec-1', type: 'address', value: '123 Main St, Portland OR' }),
+ deleteVaultRecord: vi.fn().mockResolvedValue({ ok: true }),
+ updateVaultRecord: vi.fn(),
+ createVaultRecord: vi.fn(),
+ getPrivacyOrgs: vi.fn().mockResolvedValue([
+ { id: 'org-1', name: 'Acme Bank', category: 'bank', trust: 'trusted', status: 'active', website: '', contact: {} },
+ ]),
+ getPrivacyOrg: vi.fn(),
+ createPrivacyOrg: vi.fn(),
+ updatePrivacyOrg: vi.fn(),
+ deletePrivacyOrg: vi.fn().mockResolvedValue({ ok: true }),
+ getOrgHoldings: vi.fn().mockResolvedValue([]),
+ setOrgHoldings: vi.fn(),
+}));
+
+import Privacy from './Privacy';
+import { revealVaultRecord } from '../services/api';
+
+function renderAt(path) {
+ return render(
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ <Route path="/privacy/:tab" element={<Privacy />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+}
+
+describe('Privacy Center', () => {
+ beforeEach(() => { vi.clearAllMocks(); });
+
+ it('renders the Overview tab with encryption status and counts', async () => {
+ renderAt('/privacy/overview');
+ await waitFor(() => expect(screen.getByText(/Engaged/i)).toBeInTheDocument());
+ // Total record count (1 address + 1 email = 2).
+ expect(screen.getByText('2')).toBeInTheDocument();
+ });
+
+ it('renders vault records masked — no plaintext in the DOM until reveal', async () => {
+ renderAt('/privacy/vault');
+ await waitFor(() => expect(screen.getByText('Home address')).toBeInTheDocument());
+ // Masked value shows; plaintext does NOT.
+ expect(screen.getByText('•••, Portland OR')).toBeInTheDocument();
+ expect(screen.queryByText('123 Main St, Portland OR')).not.toBeInTheDocument();
+ });
+
+ it('reveals plaintext only after clicking Reveal', async () => {
+ renderAt('/privacy/vault');
+ await waitFor(() => screen.getByText('Home address'));
+ const revealBtn = screen.getAllByLabelText('Reveal value')[0];
+ fireEvent.click(revealBtn);
+ await waitFor(() => expect(screen.getByText('123 Main St, Portland OR')).toBeInTheDocument());
+ expect(revealVaultRecord).toHaveBeenCalledWith('rec-1');
+ });
+
+ it('renders the Organizations tab with a trust badge', async () => {
+ renderAt('/privacy/organizations');
+ await waitFor(() => expect(screen.getByText('Acme Bank')).toBeInTheDocument());
+ // "Trusted" appears both as a filter chip and the org's trust badge.
+ expect(screen.getAllByText('Trusted').length).toBeGreaterThanOrEqual(1);
+ });
+
+ it('stale :tab param falls back to Overview', async () => {
+ renderAt('/privacy/bogus');
+ await waitFor(() => expect(screen.getByText(/system of record/i)).toBeInTheDocument());
+ });
+});
diff --git a/client/src/services/README.md b/client/src/services/README.md
index b7109aff2a..2f189247e3 100644
--- a/client/src/services/README.md
+++ b/client/src/services/README.md
@@ -115,6 +115,7 @@ toasts on throw). **Custom catch ⇒ `silent: true`** — otherwise toasts fire
| `apiPalette.js` | Command-palette manifest + action dispatch. |
| `apiVoice.js` | Voice synthesis / processing. |
| `apiCity.js` | CyberCity snapshots — historical city-state series for the timeline scrubber (GET /snapshots, GET /config, POST /capture). |
+| `apiPrivacy.js` | Privacy Center — encrypted PII Vault + Trusted Organizations registry (status, vault CRUD + reveal, org CRUD, org holdings replace-set). |
## Browser-facing (DOM, voice, build) — not pure API wrappers
diff --git a/client/src/services/api.js b/client/src/services/api.js
index b517b6b6c6..d701cef7f4 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -68,6 +68,7 @@ export * from './apiStoryBuilder.js';
export * from './apiVoice.js';
export * from './apiAuth.js';
export * from './apiCity.js';
+export * from './apiPrivacy.js';
// Default export for simplified imports (get/post/put/delete helpers)
export { default } from './apiCore.js';
diff --git a/client/src/services/apiPrivacy.js b/client/src/services/apiPrivacy.js
new file mode 100644
index 0000000000..d7a07e9c7d
--- /dev/null
+++ b/client/src/services/apiPrivacy.js
@@ -0,0 +1,65 @@
+import { request } from './apiCore.js';
+
+// Privacy Center — encrypted PII Vault + Trusted Organizations registry
+// (issues #2140, #2141; UI shell #2142). Every wrapper takes an optional
+// `options` object so callers that own their own error UI (useAsyncAction,
+// custom catch) can pass `{ silent: true }` per the toasting convention.
+
+// ── Status (doctor-style readout) ───────────────────────────────────────────
+export const getPrivacyStatus = (options) => request('/privacy/status', options);
+
+// ── Vault records ───────────────────────────────────────────────────────────
+export const getVaultRecords = (type, options) =>
+ request(`/privacy/vault${type ? `?type=${encodeURIComponent(type)}` : ''}`, options);
+export const getVaultRecord = (id, options) => request(`/privacy/vault/${id}`, options);
+export const createVaultRecord = (data, options) => request('/privacy/vault', {
+ method: 'POST',
+ body: JSON.stringify(data),
+ ...options,
+});
+export const updateVaultRecord = (id, patch, options) => request(`/privacy/vault/${id}`, {
+ method: 'PUT',
+ body: JSON.stringify(patch),
+ ...options,
+});
+export const deleteVaultRecord = (id, options) => request(`/privacy/vault/${id}`, {
+ method: 'DELETE',
+ ...options,
+});
+// The ONE decrypt path — explicit user action. Returns { id, type, value }.
+export const revealVaultRecord = (id, options) => request(`/privacy/vault/${id}/reveal`, {
+ method: 'POST',
+ ...options,
+});
+
+// ── Trusted Organizations registry ──────────────────────────────────────────
+export const getPrivacyOrgs = (filters = {}, options) => {
+ const qs = new URLSearchParams(
+ Object.entries(filters).filter(([, v]) => v != null && v !== ''),
+ ).toString();
+ return request(`/privacy/orgs${qs ? `?${qs}` : ''}`, options);
+};
+export const getPrivacyOrg = (id, options) => request(`/privacy/orgs/${id}`, options);
+export const createPrivacyOrg = (data, options) => request('/privacy/orgs', {
+ method: 'POST',
+ body: JSON.stringify(data),
+ ...options,
+});
+export const updatePrivacyOrg = (id, patch, options) => request(`/privacy/orgs/${id}`, {
+ method: 'PUT',
+ body: JSON.stringify(patch),
+ ...options,
+});
+export const deletePrivacyOrg = (id, options) => request(`/privacy/orgs/${id}`, {
+ method: 'DELETE',
+ ...options,
+});
+
+// ── Org holdings (which vault records an org holds) ─────────────────────────
+export const getOrgHoldings = (id, options) => request(`/privacy/orgs/${id}/holdings`, options);
+// Replace-set semantics: `holdings` is the FULL list of { vaultRecordId, status }.
+export const setOrgHoldings = (id, holdings, options) => request(`/privacy/orgs/${id}/holdings`, {
+ method: 'PUT',
+ body: JSON.stringify({ holdings }),
+ ...options,
+});
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index a23c3a6e64..7ce36b2699 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -142,6 +142,9 @@ export const NAV_COMMANDS = [
{ id: 'nav.twin.test', path: '/digital-twin/test', label: 'Test', section: 'Identity', aliases: ['twin-test'] },
{ id: 'nav.twin.time-capsule', path: '/digital-twin/time-capsule', label: 'Time Capsule', section: 'Identity', aliases: ['time-capsule', 'twin-time-capsule', 'capsule'], keywords: ['legacy', 'archive', 'snapshot'] },
{ id: 'nav.twin.voice', path: '/digital-twin/voice', label: 'Voice', section: 'Identity', aliases: ['twin-voice', 'voice-style', 'spoken-written'], keywords: ['speech', 'spoken', 'written', 'transcript', 'style', 'comparison', 'communication'] },
+ { id: 'nav.identity.privacy-overview', path: '/privacy/overview', label: 'Privacy', section: 'Identity', aliases: ['privacy', 'privacy-center', 'my-data'], keywords: ['pii', 'privacy', 'personal data', 'identity facts', 'who has my data'] },
+ { id: 'nav.identity.privacy-vault', path: '/privacy/vault', label: 'Vault', section: 'Identity', aliases: ['vault', 'pii-vault', 'privacy-vault'], keywords: ['pii', 'vault', 'encrypted', 'ssn', 'address', 'passport', 'identity'] },
+ { id: 'nav.identity.privacy-organizations', path: '/privacy/organizations', label: 'Organizations', section: 'Identity', aliases: ['organizations', 'orgs', 'trusted-orgs'], keywords: ['organizations', 'banks', 'utilities', 'who holds my data', 'registry', 'holdings'] },
{ id: 'nav.meatspace.overview', path: '/meatspace/overview', label: 'Overview', section: 'Health', aliases: ['meatspace'] },
{ id: 'nav.meatspace.health', path: '/meatspace/health', label: 'Body Health', section: 'Health', aliases: ['meatspace-health', 'body-health'], keywords: ['health', 'vitals', 'wellbeing', 'biometrics'] },
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index f59f54f5ac..0ef94f24d5 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -29,6 +29,7 @@ const TABBED_PAGES = [
{ prefix: '/calendar', file: 'client/src/pages/Calendar.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/goals', file: 'client/src/pages/Goals.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/insights', file: 'client/src/pages/Insights.jsx', kind: 'ids', constName: 'TABS' },
+ { prefix: '/privacy', file: 'client/src/pages/Privacy.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/messages', file: 'client/src/pages/Messages.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/wiki', file: 'client/src/pages/Wiki.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/settings', file: 'client/src/components/settings/SettingsTabsHeader.jsx', kind: 'links', constName: 'TABS' },