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: unify persistent mind dashboard

Adam Eivy99a129bed436
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 164fde913e..7155d0edf5 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -285,7 +285,8 @@ export default function App() {
<Route path="ai/edit/:providerId" element={<AIProviders />} />
<Route path="prompts" element={<PromptManager />} />
<Route path="cos" element={<Navigate to="/cos/tasks" replace />} />
- <Route path="cos/mind/tools" element={<Navigate to="/cos/tools" replace />} />
+ <Route path="cos/mind/tools" element={<Navigate to="/cos/mind?panel=tools" replace />} />
+ <Route path="cos/tools" element={<Navigate to="/cos/mind?panel=tools" replace />} />
<Route path="cos/:tab" element={<ChiefOfStaff />} />
<Route path="calendar" element={<Navigate to="/calendar/agenda" replace />} />
<Route path="calendar/:tab" element={<CalendarPage />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index a31355f7b5..8fbd712686 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -201,7 +201,6 @@ export const NAV_PRESENTATION = {
'/cos/learning': { icon: GraduationCap },
'/cos/memory': { icon: Brain },
'/cos/mind': { icon: MessageSquare },
- '/cos/tools': { icon: Wrench },
'/cos/run-events': { icon: ScrollText },
'/cos/runs': { icon: Play },
'/cos/schedule': { icon: Clock },
diff --git a/client/src/components/cos/PersistentMindContextPanel.jsx b/client/src/components/cos/PersistentMindContextPanel.jsx
index 49d7228f09..fcf467cb6f 100644
--- a/client/src/components/cos/PersistentMindContextPanel.jsx
+++ b/client/src/components/cos/PersistentMindContextPanel.jsx
@@ -18,7 +18,7 @@ const harnessTone = (recommendation) => recommendation === 'recommended'
? 'success'
: recommendation === 'not-recommended' ? 'warning' : 'info';
-export default function PersistentMindContextPanel() {
+export default function PersistentMindContextPanel({ view = 'all' }) {
const [data, setData] = useState(null);
const [draft, setDraft] = useState(() => promptDraft(null));
const [loading, setLoading] = useState(true);
@@ -55,7 +55,7 @@ export default function PersistentMindContextPanel() {
<div className="space-y-4">
{error && <Banner tone="error" title="Context unavailable">{error}</Banner>}
- <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-architecture-heading">
+ {view !== 'memories' && <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-architecture-heading">
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 id="mind-architecture-heading" className="flex items-center gap-2 text-sm font-semibold text-port-text">
@@ -80,15 +80,15 @@ export default function PersistentMindContextPanel() {
</div>
))}
</div>
- </section>
+ </section>}
- {data?.harness && (
+ {view !== 'memories' && data?.harness && (
<Banner tone={harnessTone(data.harness.recommendation)} title={`${data.harness.label} · ${data.harness.recommendation}`}>
{data.harness.detail}
</Banner>
)}
- <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-prompt-heading">
+ {view !== 'memories' && <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-prompt-heading">
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
<h3 id="mind-prompt-heading" className="text-sm font-semibold text-port-text">Identity and operating prompt</h3>
@@ -108,9 +108,9 @@ export default function PersistentMindContextPanel() {
<textarea id="persistent-mind-instructions" rows={7} maxLength={12000} value={draft.instructions} onChange={(event) => setDraft((current) => ({ ...current, instructions: event.target.value }))} className="mt-1 w-full resize-y rounded border border-port-border bg-port-bg px-3 py-2 text-sm font-normal text-port-text" />
</label>
</div>
- </section>
+ </section>}
- <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-memory-heading">
+ {view !== 'context' && <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-memory-heading">
<div>
<h3 id="mind-memory-heading" className="flex items-center gap-2 text-sm font-semibold text-port-text"><Database size={16} aria-hidden="true" /> Curated memories</h3>
<p className="mt-1 text-xs text-port-text-muted">Memories created by the persistent mind and memories added here enter its bounded context automatically. You can edit them here at any time.</p>
@@ -121,9 +121,9 @@ export default function PersistentMindContextPanel() {
<p className="rounded border border-dashed border-port-border p-4 text-center text-xs text-port-text-muted">No curated memories yet.</p>
) : (data.memories || []).map((memory) => <MemoryEditor key={memory.id} memory={memory} onSaved={load} />)}
</div>
- </section>
+ </section>}
- <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-preview-heading">
+ {view !== 'memories' && <section className="rounded border border-port-border bg-port-card p-4" aria-labelledby="mind-preview-heading">
<h3 id="mind-preview-heading" className="flex items-center gap-2 text-sm font-semibold text-port-text"><Eye size={16} aria-hidden="true" /> Effective context preview</h3>
<p className="mt-1 text-xs text-port-text-muted">
This is the actual bounded text projection used on the next wake: {data?.preview?.chars || 0} characters, about {data?.preview?.approximateTokens || 0} tokens, summary cache {data?.preview?.summaryState || 'unknown'}.
@@ -141,7 +141,7 @@ export default function PersistentMindContextPanel() {
))}
</div>
</details>
- </section>
+ </section>}
</div>
);
}
diff --git a/client/src/components/cos/PersistentMindRuntimePanel.jsx b/client/src/components/cos/PersistentMindRuntimePanel.jsx
index 614acfcb70..23cdb56202 100644
--- a/client/src/components/cos/PersistentMindRuntimePanel.jsx
+++ b/client/src/components/cos/PersistentMindRuntimePanel.jsx
@@ -52,16 +52,17 @@ export default function PersistentMindRuntimePanel({ runtime, error, loading, on
const processMemory = runtime?.system?.process;
const residency = runtime?.inference?.residency;
const usagePercent = Number.isFinite(memory?.usagePercent) ? memory.usagePercent : null;
+ const ContextSurface = onOpenContext ? 'button' : 'div';
return (
<section aria-label="Persistent mind runtime" className="grid gap-3 md:grid-cols-3">
- <button type="button" onClick={onOpenContext} className="rounded border border-port-border bg-port-card p-3 text-left hover:bg-port-border/20">
+ <ContextSurface {...(onOpenContext ? { type: 'button', onClick: onOpenContext } : {})} className={`rounded border border-port-border bg-port-card p-3 text-left ${onOpenContext ? 'hover:bg-port-border/20' : ''}`}>
<span className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-port-accent"><Brain size={15} aria-hidden="true" /> Effective context</span>
<span className="mt-2 block text-lg font-semibold text-port-text">~{number(context?.approximateTokens)} tokens</span>
<span className="mt-1 block text-xs text-port-text-muted">
{number(context?.chars)} / {number(context?.maxChars)} characters · {number(context?.memoryCount)} curated memories · summary {context?.summaryState || 'unknown'}
</span>
- </button>
+ </ContextSurface>
<div className="rounded border border-port-border bg-port-card p-3">
<span className="flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-port-accent"><Gauge size={15} aria-hidden="true" /> System memory</span>
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index 1e2b484646..a214ef0655 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -14,8 +14,7 @@ import {
ChartGantt,
Play,
ScrollText,
- MessageCircle,
- Wrench
+ MessageCircle
} from 'lucide-react';
import { normalizeReviewerSlug } from '../../lib/reviewerPins';
import { inPlaceClipName } from '../../utils/animationClips';
@@ -35,7 +34,6 @@ export const TABS = [
{ id: 'learning', label: 'Learning', icon: GraduationCap },
{ id: 'memory', label: 'Memory', icon: Brain },
{ id: 'mind', label: 'Mind', icon: MessageCircle },
- { id: 'tools', label: 'Mind Tools', icon: Wrench },
{ id: 'health', label: 'Health', icon: Activity },
{ id: 'config', label: 'Config', icon: Settings }
];
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsx
index 9320dc1c15..1e16d46200 100644
--- a/client/src/components/cos/tabs/MindTab.jsx
+++ b/client/src/components/cos/tabs/MindTab.jsx
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { useSearchParams } from 'react-router';
-import { ArrowUp, Brain, Check, CirclePause, CirclePlay, ExternalLink, ImagePlus, MessageCircle, RefreshCw, Settings2, Square, StickyNote, Upload, X } from 'lucide-react';
+import { ArrowUp, Brain, Check, CirclePause, CirclePlay, Cpu, Database, ImagePlus, MessageCircle, RefreshCw, Settings2, Square, StickyNote, Upload, Wrench, X } from 'lucide-react';
import { Link } from 'react-router';
import useMounted from '../../../hooks/useMounted';
import { useSocket } from '../../../hooks/useSocket';
@@ -15,8 +15,8 @@ import TabPills from '../../ui/TabPills';
import PersistentMindContextPanel from '../PersistentMindContextPanel';
import PersistentMindProfileControls from '../PersistentMindProfileControls';
import PersistentMindRuntimePanel, { PersistentMindThoughtStatus } from '../PersistentMindRuntimePanel';
-import PersistentMindTaskAccessControls from '../PersistentMindTaskAccessControls';
import PersistentMindVisibilityPanel from '../PersistentMindVisibilityPanel';
+import PersistentMindTools from '../../../pages/PersistentMindTools';
import { readFileAsBase64, UPLOAD_IMAGE_ACCEPT, validateImageFile } from '../../../utils/fileUpload';
const PAGE_LIMIT = 200;
@@ -24,11 +24,12 @@ const MAX_BACKFILL_PAGES = 5;
const MAX_VISIBLE_EVENTS = PAGE_LIMIT * MAX_BACKFILL_PAGES;
const MAX_MESSAGE_IMAGES = 8;
const MAX_MESSAGE_IMAGE_BYTES = 10 * 1024 * 1024;
-const MIND_VIEWS = new Set(['conversation', 'context', 'setup']);
-const MIND_TABS = [
- { id: 'conversation', label: 'Chat', icon: MessageCircle },
+const MIND_PANELS = new Set(['context', 'memories', 'tools', 'settings']);
+const MIND_PANEL_TABS = [
{ id: 'context', label: 'Context', icon: Brain },
- { id: 'setup', label: 'Settings', icon: Settings2 },
+ { id: 'memories', label: 'Memories', icon: Database },
+ { id: 'tools', label: 'Tools', icon: Wrench },
+ { id: 'settings', label: 'Settings', icon: Settings2 },
];
const ACTIVITY_KINDS = new Set([
@@ -142,7 +143,9 @@ const buildConversationItems = (events, showActivity) => {
export default function MindTab() {
const [searchParams, setSearchParams] = useSearchParams();
const selectedEventId = searchParams.get('event');
- const activeView = MIND_VIEWS.has(searchParams.get('view')) ? searchParams.get('view') : 'conversation';
+ const legacyView = searchParams.get('view');
+ const requestedPanel = searchParams.get('panel') || (legacyView === 'setup' ? 'settings' : legacyView);
+ const activePanel = MIND_PANELS.has(requestedPanel) ? requestedPanel : null;
const socket = useSocket();
const [events, setEvents] = useState(null);
const [mind, setMind] = useState(null);
@@ -162,7 +165,6 @@ export default function MindTab() {
const [eventActionPending, setEventActionPending] = useState(null);
const [lifecycleError, setLifecycleError] = useState(null);
const [profileSaving, setProfileSaving] = useState(false);
- const [taskAccessSaving, setTaskAccessSaving] = useState(false);
const [showActivity, setShowActivity] = useState(false);
const [runtime, setRuntime] = useState(null);
const [runtimeError, setRuntimeError] = useState(null);
@@ -517,20 +519,26 @@ export default function MindTab() {
const profileReady = Boolean(mind?.profile?.enabled && mind.profile.providerId && mind.profile.model);
const { status: imageCapabilityStatus, guidance: imageCapabilityGuidance } = imageCapability(mind);
const imageAttachmentsUnavailable = imageCapabilityStatus === 'unsupported';
- const setupSaving = profileSaving || taskAccessSaving;
+ const setupSaving = profileSaving;
const conversationItems = buildConversationItems(events || [], showActivity);
- const changeView = (view) => setSearchParams((current) => {
+ const openPanel = (panel) => setSearchParams((current) => {
const next = new URLSearchParams(current);
- if (view === 'conversation') next.delete('view');
- else {
- next.set('view', view);
- next.delete('event');
- }
+ next.set('panel', panel);
+ next.delete('view');
+ next.delete('event');
+ return next;
+ });
+ const closePanel = () => setSearchParams((current) => {
+ const next = new URLSearchParams(current);
+ next.delete('panel');
+ next.delete('view');
return next;
});
const selectEvent = (eventId) => setSearchParams((current) => {
const next = new URLSearchParams(current);
next.set('event', eventId);
+ next.delete('panel');
+ next.delete('view');
return next;
});
const closeSelectedEvent = () => setSearchParams((current) => {
@@ -540,99 +548,45 @@ export default function MindTab() {
});
return (
- <section aria-labelledby="mind-heading" className="mx-auto max-w-6xl space-y-4 pb-4">
- {activeView === 'conversation' ? (
- <h2 id="mind-heading" className="sr-only">Persistent Mind</h2>
- ) : (
- <header className="flex flex-col gap-3 px-1 sm:flex-row sm:items-center sm:justify-between">
- <div className="flex min-w-0 items-center gap-3">
- <span className="flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-port-accent/15 text-port-accent ring-1 ring-port-accent/30">
- <Brain size={23} aria-hidden="true" />
- </span>
- <div className="min-w-0">
- <h2 id="mind-heading" className="truncate text-lg font-semibold text-port-text">Persistent Mind</h2>
- <p className="truncate text-xs text-port-text-muted">
- {mind ? `${mind.profile?.model || 'No model'} · ${mind.profile?.providerId || 'No provider'} · machine-local` : 'Loading profile…'}
- </p>
- </div>
- </div>
- <div className="flex flex-wrap items-center gap-2" role="group" aria-label="Persistent mind lifecycle">
- <PersistentMindThoughtStatus
- state={state}
- model={state?.activeTurnId && state.activeTurnId === runtime?.inference?.turnId
- ? runtime.inference.model
- : mind?.profile?.model}
- />
- {state?.started && !isPaused && <ActionButton label="Pause" icon={CirclePause} pending={lifecyclePending === 'pause'} onClick={() => runLifecycle('pause')} />}
- {state?.started && isPaused && <ActionButton label="Resume" icon={CirclePlay} pending={lifecyclePending === 'resume'} onClick={() => runLifecycle('resume')} />}
- {state?.started && <ActionButton label="Stop" icon={Square} pending={lifecyclePending === 'stop'} onClick={() => runLifecycle('stop')} />}
- <ActionButton label="Reload" icon={RefreshCw} pending={loading || runtimeLoading} onClick={() => {
- void loadHistory({ reset: true });
- void loadRuntime();
- void loadVisibility({ refresh: true });
- }} />
+ <section aria-labelledby="mind-heading" className="mx-auto max-w-[100rem] space-y-4 pb-4">
+ <header className="flex flex-col gap-3 rounded-2xl border border-port-border bg-port-card/70 p-3 sm:flex-row sm:items-center sm:justify-between sm:p-4">
+ <div className="flex min-w-0 items-center gap-3">
+ <span className="relative flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-port-accent/15 text-port-accent ring-1 ring-port-accent/30">
+ <Brain size={23} aria-hidden="true" />
+ <span className={`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-port-card ${state?.started && !isPaused ? 'bg-port-success' : 'bg-port-text-muted'}`} aria-hidden="true" />
+ </span>
+ <div className="min-w-0">
+ <h2 id="mind-heading" className="truncate text-lg font-semibold text-port-text">Persistent Mind</h2>
+ <p className="truncate text-xs text-port-text-muted">
+ {mind ? `${mind.profile?.model || 'No model'} · ${mind.profile?.providerId || 'No provider'} · machine-local` : 'Loading profile…'}
+ </p>
</div>
- </header>
- )}
-
- <TabPills tabs={MIND_TABS} activeTab={activeView} onChange={changeView} variant="pills" size="sm" ariaLabel="Persistent mind view" />
+ </div>
+ <div className="flex flex-wrap items-center gap-2" role="group" aria-label="Persistent mind lifecycle">
+ <PersistentMindThoughtStatus
+ state={state}
+ model={state?.activeTurnId && state.activeTurnId === runtime?.inference?.turnId
+ ? runtime.inference.model
+ : mind?.profile?.model}
+ />
+ {!state?.started && <ActionButton label={profileReady ? 'Start' : 'Configure'} icon={profileReady ? CirclePlay : Settings2} disabled={loading} onClick={() => openPanel('settings')} />}
+ {state?.started && !isPaused && <ActionButton label="Pause" icon={CirclePause} pending={lifecyclePending === 'pause'} onClick={() => runLifecycle('pause')} />}
+ {state?.started && isPaused && <ActionButton label="Resume" icon={CirclePlay} pending={lifecyclePending === 'resume'} onClick={() => runLifecycle('resume')} />}
+ {state?.started && <ActionButton label="Stop" icon={Square} pending={lifecyclePending === 'stop'} onClick={() => runLifecycle('stop')} />}
+ <ActionButton label="Reload" icon={RefreshCw} pending={loading || runtimeLoading} onClick={() => {
+ void loadHistory({ reset: true });
+ void loadRuntime();
+ void loadVisibility({ refresh: true });
+ }} />
+ </div>
+ </header>
{gap && <Banner tone="warning" title="History gap detected">The saved cursor is no longer retained. The visible trace was reloaded from the newest bounded snapshot.</Banner>}
{loadError && <Banner tone="error" title="Conversation unavailable">{loadError}. Existing messages are preserved; retry when the connection recovers.</Banner>}
{lifecycleError && <Banner tone="error" title="Action failed">{lifecycleError}</Banner>}
- {activeView !== 'conversation' && (
- <>
- <PersistentMindVisibilityPanel
- visibility={visibility}
- error={visibilityError}
- loading={visibilityLoading}
- onRefresh={() => loadVisibility({ refresh: true })}
- />
- <PersistentMindRuntimePanel runtime={runtime} error={runtimeError} loading={runtimeLoading} onOpenContext={() => changeView('context')} />
- </>
- )}
-
- {activeView === 'setup' && (
- <section aria-labelledby="mind-profile-heading" className="rounded border border-port-border bg-port-card p-4">
- <div className="mb-3">
- <h3 id="mind-profile-heading" className="text-sm font-semibold text-port-text">AI profile</h3>
- <p className="mt-1 text-xs text-port-text-muted">Pin the provider, model, and effort used on every wake. Changes apply to the next wake and never silently fall back to another model.</p>
- </div>
- <PersistentMindProfileControls
- profile={mind?.profile}
- disabled={!mind}
- onSaved={(profile) => setMind((current) => current ? { ...current, profile } : current)}
- onSavingChange={setProfileSaving}
- />
- <div className="mt-4 border-t border-port-border pt-4">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <h3 className="text-sm font-semibold text-port-text">Agent task access</h3>
- <Link to="/cos/tools" className="inline-flex items-center gap-1 text-xs font-medium text-port-accent hover:underline">
- View and edit tools <ExternalLink size={13} aria-hidden="true" />
- </Link>
- </div>
- <p className="mb-3 mt-1 text-xs text-port-text-muted">Choose whether this mind may turn a concrete recommendation into a typed task with its own run profile and landing gate.</p>
- <PersistentMindTaskAccessControls
- capabilities={mind?.capabilities}
- disabled={!mind}
- onSaved={(capabilities) => setMind((current) => current ? { ...current, capabilities } : current)}
- onSavingChange={setTaskAccessSaving}
- />
- </div>
- {!state?.started && (
- <div className="mt-4 flex flex-col gap-2 border-t border-port-border pt-4 sm:flex-row sm:items-center sm:justify-between">
- <p className="text-xs text-port-text-muted">{setupSaving ? 'Saving persistent mind settings…' : profileReady ? 'The saved AI profile is ready.' : 'Enable the profile and select both an AI provider and model to start.'}</p>
- <ActionButton label="Start persistent mind" icon={CirclePlay} pending={lifecyclePending === 'start'} disabled={loading || setupSaving || !profileReady} onClick={() => runLifecycle('start')} />
- </div>
- )}
- </section>
- )}
-
- {activeView === 'context' && <PersistentMindContextPanel />}
-
- {activeView === 'conversation' && (
- <section data-testid="mind-chat" aria-label="Persistent mind chat" className="flex h-[60dvh] min-h-[27rem] max-h-[48rem] flex-col overflow-hidden rounded-[1.5rem] border border-port-border bg-port-card shadow-lg shadow-black/10 sm:h-[72dvh] sm:min-h-[30rem]">
+ <div className="grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_19rem]">
+ <section data-testid="mind-chat" aria-label="Persistent mind chat" className="flex h-[68dvh] min-h-[30rem] max-h-[54rem] flex-col overflow-hidden rounded-[1.5rem] border border-port-border bg-port-card shadow-lg shadow-black/10 sm:min-h-[34rem]">
<header className="flex shrink-0 items-center justify-between gap-3 border-b border-port-border bg-port-card/95 px-3 py-2.5 sm:px-4">
<div className="flex min-w-0 items-center gap-2.5">
<span className="relative flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-port-accent/15 text-port-accent">
@@ -717,10 +671,77 @@ export default function MindTab() {
</div>
</form>
</section>
- )}
+
+ <aside aria-labelledby="mind-state-heading" className="space-y-3 xl:sticky xl:top-0">
+ <section className="rounded-2xl border border-port-border bg-port-card p-4">
+ <div className="flex items-center justify-between gap-3">
+ <div>
+ <p className="text-[11px] font-semibold uppercase tracking-[0.16em] text-port-text-muted">Live workspace</p>
+ <h3 id="mind-state-heading" className="mt-1 text-base font-semibold text-port-text">Mind state</h3>
+ </div>
+ <span className={`h-2.5 w-2.5 rounded-full ${state?.status === 'thinking' ? 'animate-pulse bg-port-accent' : state?.started && !isPaused ? 'bg-port-success' : 'bg-port-text-muted'}`} aria-hidden="true" />
+ </div>
+ <p className="mt-3 text-sm text-port-text-muted">
+ {state?.status === 'thinking' ? 'Working through the current turn.' : state?.pauseReason || (state?.started ? 'Listening for messages and scheduled wakes.' : 'Configure the AI profile to begin.')}
+ </p>
+ {state?.queuedMessageCount > 0 && <p className="mt-2 text-xs font-medium text-port-accent">{state.queuedMessageCount} queued message{state.queuedMessageCount === 1 ? '' : 's'}</p>}
+ </section>
+
+ <div className="grid grid-cols-2 gap-2 xl:grid-cols-1">
+ <MindStateButton icon={Brain} label="Context" value={runtime?.context?.approximateTokens == null ? 'Unavailable' : `~${runtime.context.approximateTokens.toLocaleString()} tokens`} detail={`${runtime?.context?.chars?.toLocaleString() || '—'} characters`} onClick={() => openPanel('context')} />
+ <MindStateButton icon={Database} label="Memories" value={runtime?.context?.memoryCount == null ? 'Unavailable' : `${runtime.context.memoryCount} accessible`} detail="Created and curated" onClick={() => openPanel('memories')} />
+ <MindStateButton icon={Wrench} label="Tools" value={mind?.capabilities?.createTasks ? 'Task access on' : 'No grants'} detail="Narrow, typed authority" onClick={() => openPanel('tools')} />
+ <MindStateButton icon={Cpu} label="Settings" value={runtime?.inference?.active ? 'Running now' : runtime?.inference?.residency?.status === 'loaded' ? 'Loaded in memory' : 'Not running'} detail={runtime?.inference?.model || mind?.profile?.model || 'Not configured'} onClick={() => openPanel('settings')} />
+ </div>
+
+ {(runtimeError || visibilityError) && <p className="rounded-xl border border-port-warning/40 bg-port-warning/10 p-3 text-xs text-port-warning">Some live status is delayed. The last successful snapshot remains visible.</p>}
+ </aside>
+ </div>
<Drawer
- open={activeView === 'conversation' && Boolean(selectedEventId)}
+ open={Boolean(activePanel)}
+ onClose={closePanel}
+ title="Mind workspace"
+ subtitle="Inspect and configure the state available to Persistent Mind"
+ size="xl"
+ closeLabel="Close mind workspace"
+ >
+ <div className="mb-4">
+ <TabPills tabs={MIND_PANEL_TABS} activeTab={activePanel || 'context'} onChange={openPanel} variant="pills" size="sm" mobileDropdown ariaLabel="Mind workspace sections" />
+ </div>
+ {activePanel === 'context' && (
+ <div className="space-y-4">
+ <PersistentMindRuntimePanel runtime={runtime} error={runtimeError} loading={runtimeLoading} />
+ <PersistentMindVisibilityPanel visibility={visibility} error={visibilityError} loading={visibilityLoading} onRefresh={() => loadVisibility({ refresh: true })} />
+ <PersistentMindContextPanel view="context" />
+ </div>
+ )}
+ {activePanel === 'memories' && <PersistentMindContextPanel view="memories" />}
+ {activePanel === 'tools' && <PersistentMindTools onCapabilitiesChange={(capabilities) => setMind((current) => current ? { ...current, capabilities } : current)} />}
+ {activePanel === 'settings' && (
+ <section aria-labelledby="mind-profile-heading" className="rounded border border-port-border bg-port-card p-4">
+ <div className="mb-3">
+ <h3 id="mind-profile-heading" className="text-sm font-semibold text-port-text">AI profile</h3>
+ <p className="mt-1 text-xs text-port-text-muted">Pin the provider, model, and effort used on every wake. Changes apply to the next wake and never silently fall back to another model.</p>
+ </div>
+ <PersistentMindProfileControls
+ profile={mind?.profile}
+ disabled={!mind}
+ onSaved={(profile) => setMind((current) => current ? { ...current, profile } : current)}
+ onSavingChange={setProfileSaving}
+ />
+ {!state?.started && (
+ <div className="mt-4 flex flex-col gap-2 border-t border-port-border pt-4 sm:flex-row sm:items-center sm:justify-between">
+ <p className="text-xs text-port-text-muted">{setupSaving ? 'Saving persistent mind settings…' : profileReady ? 'The saved AI profile is ready.' : 'Enable the profile and select both an AI provider and model to start.'}</p>
+ <ActionButton label="Start persistent mind" icon={CirclePlay} pending={lifecyclePending === 'start'} disabled={loading || setupSaving || !profileReady} onClick={() => runLifecycle('start')} />
+ </div>
+ )}
+ </section>
+ )}
+ </Drawer>
+
+ <Drawer
+ open={Boolean(selectedEventId)}
onClose={closeSelectedEvent}
title={selectedEvent ? eventLabel(selectedEvent.kind) : 'Event details'}
subtitle={selectedEvent?.at ? formatDateTime(selectedEvent.at) : undefined}
@@ -768,6 +789,18 @@ export default function MindTab() {
);
}
+function MindStateButton({ icon: Icon, label, value, detail, onClick }) {
+ return (
+ <button type="button" onClick={onClick} className="group rounded-2xl border border-port-border bg-port-card p-3 text-left transition-colors hover:border-port-accent/60 hover:bg-port-accent/5">
+ <span className="flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-port-text-muted group-hover:text-port-accent">
+ <Icon size={14} aria-hidden="true" /> {label}
+ </span>
+ <span className="mt-2 block text-sm font-semibold text-port-text">{value}</span>
+ <span className="mt-0.5 block truncate text-xs text-port-text-muted">{detail}</span>
+ </button>
+ );
+}
+
function ConversationItem({ event, thoughts, thoughtOnly, selectedEventId, onSelect }) {
const outgoing = event.kind === 'mind.message.accepted';
const incoming = thoughtOnly || ['mind.reply', 'mind.summary'].includes(event.kind);
diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsx
index 6e25fb1174..0444b0c17a 100644
--- a/client/src/components/cos/tabs/MindTab.test.jsx
+++ b/client/src/components/cos/tabs/MindTab.test.jsx
@@ -19,6 +19,7 @@ const api = vi.hoisted(() => ({
getProviders: vi.fn(),
updateCosConfig: vi.fn(),
getPersistentMindContext: vi.fn(),
+ getPersistentMindTools: vi.fn(),
getPersistentMindRuntime: vi.fn(),
getPersistentMindVisibility: vi.fn(),
createPersistentMindMemory: vi.fn(),
@@ -115,6 +116,19 @@ describe('MindTab', () => {
rollups: [],
harness: { type: 'api', label: 'Direct API', recommendation: 'recommended', detail: 'Structured and reliable.' },
});
+ api.getPersistentMindTools.mockResolvedValue({
+ capabilities: { schemaVersion: 2, createTasks: false, readPortos: false, writePortos: false },
+ tools: [{
+ id: 'cos.create-task',
+ name: 'Create CoS task',
+ description: 'Queue a supervised coding task.',
+ capability: 'createTasks',
+ granted: false,
+ guardrails: ['Code review then merge', 'Merge when CI is green', 'Leave open for human review'],
+ }],
+ boundaries: ['Shell access'],
+ taskCatalog: null,
+ });
api.getPersistentMindRuntime.mockResolvedValue({
observedAt: '2026-08-27T12:00:00.000Z',
inference: {
@@ -178,7 +192,7 @@ describe('MindTab', () => {
expect(await screen.findByText('Conversation unavailable')).toBeInTheDocument();
expect(screen.queryByText(/No conversation yet/)).not.toBeInTheDocument();
- expect(screen.getByRole('tab', { name: 'Settings' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /Settings/i })).toBeInTheDocument();
});
it('deduplicates a socket-triggered cursor backfill', async () => {
@@ -228,7 +242,7 @@ describe('MindTab', () => {
profile: { enabled: true, providerId: 'codex', model: 'gpt-5', effort: 'high', thinkingInterface: 'text' },
}));
api.updateCosConfig.mockImplementation(() => new Promise((resolve) => { finishSave = resolve; }));
- renderTab('/cos/mind?view=setup');
+ renderTab('/cos/mind?panel=settings');
expect(await screen.findByRole('heading', { name: 'AI profile' })).toBeInTheDocument();
await waitFor(() => expect(screen.getByLabelText('AI provider')).toHaveValue('codex'));
@@ -257,7 +271,7 @@ describe('MindTab', () => {
it('persists the separate opt-in task-creation grant', async () => {
const user = userEvent.setup();
- renderTab('/cos/mind?view=setup');
+ renderTab('/cos/mind?panel=tools');
const taskAccess = await screen.findByRole('checkbox', { name: 'Allow mind to queue CoS agent tasks' });
expect(taskAccess).not.toBeChecked();
@@ -267,9 +281,9 @@ describe('MindTab', () => {
{ persistentMindCapabilities: { schemaVersion: 2, createTasks: true, readPortos: false, writePortos: false } },
{ silent: true },
));
- expect(screen.getByText(/code review then merge/i)).toBeInTheDocument();
- expect(screen.getByText(/merge when CI is green/i)).toBeInTheDocument();
- expect(screen.getByText(/leave open for human review/i)).toBeInTheDocument();
+ expect(screen.getAllByText(/code review then merge/i).length).toBeGreaterThan(0);
+ expect(screen.getAllByText(/merge when CI is green/i).length).toBeGreaterThan(0);
+ expect(screen.getAllByText(/leave open for human review/i).length).toBeGreaterThan(0);
});
it('keeps a failed message for a visible idempotent retry', async () => {
@@ -415,6 +429,7 @@ describe('MindTab', () => {
});
it('animates active thought status and shows context, system, and loaded-model telemetry', async () => {
+ const user = userEvent.setup();
api.getPersistentMind.mockResolvedValue(response({
state: { enabled: true, started: true, status: 'thinking', pauseReason: null, activeTurnId: 'mind-turn-1' },
}));
@@ -434,15 +449,16 @@ describe('MindTab', () => {
cpu: { cores: 8, loadAvg1m: 1.25 },
},
});
- renderTab('/cos/mind?view=setup');
+ renderTab();
const thoughtStatus = await screen.findByRole('status');
expect(thoughtStatus).toHaveTextContent('Thinking with demo-model');
expect(thoughtStatus).toHaveAttribute('aria-busy', 'true');
expect(thoughtStatus.querySelector('.animate-pulse')).toBeInTheDocument();
expect(screen.getByText('~3,000 tokens')).toBeInTheDocument();
+ await user.click(screen.getByRole('button', { name: /Context/i }));
expect(screen.getByText('4 GB / 8 GB')).toBeInTheDocument();
- expect(screen.getByText('Running now')).toBeInTheDocument();
+ expect(screen.getAllByText('Running now').length).toBeGreaterThan(0);
expect(screen.getByText(/ollama · 2 GB/)).toBeInTheDocument();
});
@@ -455,4 +471,20 @@ describe('MindTab', () => {
expect(screen.getByText('# Effective context')).toBeInTheDocument();
expect(api.getPersistentMindContext).toHaveBeenCalledWith({ silent: true });
});
+
+ it('keeps conversation central while exposing created and accessible memories', async () => {
+ api.getPersistentMindContext.mockResolvedValue({
+ prompt: { schemaVersion: 1, identity: 'Resident mind', instructions: 'Stay grounded.' },
+ preview: { text: '# Effective context', chars: 19, approximateTokens: 5, summaryState: 'ready' },
+ memories: [{ id: 'memory-1', content: 'Prefer bounded delivery.', summary: 'Delivery preference', type: 'preference', category: 'workflow', tags: [], importance: 0.8 }],
+ rollups: [],
+ harness: null,
+ });
+ renderTab('/cos/mind?panel=memories');
+
+ expect(screen.getByTestId('mind-chat')).toBeInTheDocument();
+ expect(screen.getByRole('tab', { name: 'Memories' })).toHaveAttribute('aria-selected', 'true');
+ expect(await screen.findByRole('heading', { name: 'Curated memories' })).toBeInTheDocument();
+ expect(screen.getByText('Delivery preference')).toBeInTheDocument();
+ });
});
diff --git a/client/src/pages/ApiExplorer.jsx b/client/src/pages/ApiExplorer.jsx
index 6bc9872aaa..6397173091 100644
--- a/client/src/pages/ApiExplorer.jsx
+++ b/client/src/pages/ApiExplorer.jsx
@@ -330,7 +330,7 @@ function AgentToolsView() {
<div className="rounded-xl border border-port-border bg-port-card p-4">
<h3 className="text-sm font-medium text-white">Persistent Mind adapter</h3>
<p className="mt-1 text-xs text-gray-500">Process-local multi-round tool loop. {catalog.stats.granted} of {catalog.stats.total} actions granted.</p>
- <Link to="/cos/tools" className="mt-2 inline-flex items-center gap-1 text-xs text-port-accent hover:underline">Configure Mind grants <ExternalLink size={11} /></Link>
+ <Link to="/cos/mind?panel=tools" className="mt-2 inline-flex items-center gap-1 text-xs text-port-accent hover:underline">Configure Mind grants <ExternalLink size={11} /></Link>
</div>
<div className="rounded-xl border border-port-border bg-port-card p-4">
<div className="flex flex-wrap items-center gap-2">
@@ -372,7 +372,7 @@ function AgentToolsView() {
{authority.boundaries.map((boundary) => <li key={boundary}>{boundary}</li>)}
</ul>
</div>
- <Link to="/cos/tools" className="inline-flex items-center gap-1 text-sm text-port-accent hover:underline">Configure Mind Tools <ExternalLink size={13} /></Link>
+ <Link to="/cos/mind?panel=tools" className="inline-flex items-center gap-1 text-sm text-port-accent hover:underline">Configure Mind Tools <ExternalLink size={13} /></Link>
</div>
);
}
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 45523bfd88..84da73198f 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -42,7 +42,6 @@ const RunsTab = lazy(() => import('../components/cos/tabs/RunsTab'));
// ledger read path with it.
const RunEventsTab = lazy(() => import('../components/cos/tabs/RunEventsTab'));
const MindTab = lazy(() => import('../components/cos/tabs/MindTab'));
-const PersistentMindTools = lazy(() => import('./PersistentMindTools'));
// The task and agent tabs are the default CoS landing surfaces and stay eager.
// Every other tab is loaded only when selected so the common queue view does
// not pay for charts, memory graphs, briefing readers, or configuration forms.
@@ -1147,13 +1146,6 @@ export default function ChiefOfStaff() {
</Suspense>
</div>
)}
- {activeTab === 'tools' && (
- <div role="tabpanel" id="tabpanel-tools" aria-labelledby="tab-tools">
- <Suspense fallback={<TabLoadFallback label="mind tools" />}>
- <PersistentMindTools />
- </Suspense>
- </div>
- )}
{activeTab === 'schedule' && (
<div role="tabpanel" id="tabpanel-schedule" aria-labelledby="tab-schedule">
<Suspense fallback={<TabLoadFallback label="schedule" />}>
diff --git a/client/src/pages/PersistentMindTools.jsx b/client/src/pages/PersistentMindTools.jsx
index dc98d27faf..95b6b75ad6 100644
--- a/client/src/pages/PersistentMindTools.jsx
+++ b/client/src/pages/PersistentMindTools.jsx
@@ -1,13 +1,11 @@
import { useCallback, useEffect, useRef, useState } from 'react';
-import { ArrowLeft, CheckCircle2, LockKeyhole, RefreshCw, ShieldCheck, Wrench } from 'lucide-react';
-import { Link } from 'react-router';
+import { CheckCircle2, LockKeyhole, RefreshCw, ShieldCheck } from 'lucide-react';
import * as api from '../services/api';
-import PageHeader from '../components/PageHeader';
import BrailleSpinner from '../components/BrailleSpinner';
import Banner from '../components/ui/Banner';
import PersistentMindTaskAccessControls from '../components/cos/PersistentMindTaskAccessControls';
-export default function PersistentMindTools() {
+export default function PersistentMindTools({ onCapabilitiesChange }) {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
@@ -48,25 +46,13 @@ export default function PersistentMindTools() {
granted: capabilities[tool.capability] === true,
})),
} : current);
+ onCapabilitiesChange?.(capabilities);
if (capabilities.createTasks && !data?.taskCatalog) load();
else if (!capabilities.createTasks) setLoading(false);
};
return (
- <div className="flex h-full min-h-0 flex-col">
- <PageHeader
- icon={Wrench}
- title="Persistent Mind Tools"
- subtitle="Inventory and edit the typed authority granted to the resident mind"
- actions={(
- <Link to="/cos/mind" className="inline-flex min-h-10 items-center gap-1.5 rounded border border-port-border px-3 text-sm text-port-text-muted hover:border-port-accent hover:text-port-accent">
- <ArrowLeft size={15} aria-hidden="true" /> Back to mind
- </Link>
- )}
- />
-
- <div className="min-h-0 flex-1 overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-5xl space-y-4">
+ <div className="space-y-4">
{error && <Banner tone="error" title="Tools unavailable">{error}. The last loaded state is preserved; retry when the connection recovers.</Banner>}
{loading && !data ? (
@@ -177,8 +163,6 @@ export default function PersistentMindTools() {
</section>
</>
) : null}
- </div>
- </div>
</div>
);
}
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index 69e79e57ac..9ad10293ea 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -160,8 +160,7 @@ const RAW_NAV_COMMANDS = [
{ id: 'nav.cos.health', path: '/cos/health', label: 'Health', section: 'Chief of Staff', aliases: ['cos-health', 'health'] },
{ id: 'nav.cos.learning', path: '/cos/learning', label: 'Learning', section: 'Chief of Staff', aliases: ['cos-learning'] },
{ id: 'nav.cos.memory', path: '/cos/memory', label: 'Memory', section: 'Chief of Staff', aliases: ['cos-memory'] },
- { id: 'nav.cos.mind', path: '/cos/mind', label: 'Mind', section: 'Chief of Staff', aliases: ['cos-mind', 'persistent-mind', 'mind-chat'], keywords: ['persistent mind', 'chat', 'annotation', 'resident mind', 'conversation'] },
- { id: 'nav.cos.tools', path: '/cos/tools', label: 'Mind Tools', section: 'Chief of Staff', aliases: ['mind-tools', 'persistent-mind-tools', 'tools-access'], keywords: ['persistent mind', 'tools', 'access', 'permissions', 'authority', 'capabilities'] },
+ { id: 'nav.cos.mind', path: '/cos/mind', label: 'Mind', section: 'Chief of Staff', aliases: ['cos-mind', 'persistent-mind', 'mind-chat', 'mind-tools', 'persistent-mind-tools', 'tools-access'], keywords: ['persistent mind', 'chat', 'annotation', 'resident mind', 'conversation', 'tools', 'access', 'permissions', 'authority', 'capabilities'] },
{ id: 'nav.cos.runs', path: '/cos/runs', label: 'Runs', section: 'Chief of Staff', previousPaths: ['/devtools/runs'], aliases: ['runs', 'ai-runs', 'cos-runs', 'recent-runs', 'run-history'], keywords: ['runs', 'run history', 'recent runs', 'ai runs', 'agent runs', 'failed runs'] },
{ id: 'nav.cos.run-events', path: '/cos/run-events', label: 'Run Events', section: 'Chief of Staff', aliases: ['run-events', 'cos-run-events', 'run-event-ledger', 'lifecycle-events'], keywords: ['run events', 'lifecycle', 'ledger', 'replay', 'diagnostics', 'orphaned', 'handoff', 'reconnect', 'interrupted', 'why did this run fail'] },
{ id: 'nav.cos.schedule', path: '/cos/schedule', label: 'Schedule', section: 'Chief of Staff', aliases: ['schedule', 'cos-schedule'] },