Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add persistent mind tools access page
[._.]/ Adam Eivyf833b60ceecb
diff --git a/client/src/App.jsx b/client/src/App.jsxindex 4be06f154b..a8048a2e40 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -284,6 +284,7 @@ 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/: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.jsxindex ff7ec98640..b0d9f6982c 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -197,6 +197,7 @@ 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/constants.js b/client/src/components/cos/constants.jsindex 370c6e4b20..5b336adfb7 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -14,7 +14,8 @@ import {ChartGantt,Play,ScrollText,- MessageCircle+ MessageCircle,+ Wrench} from 'lucide-react';import { normalizeReviewerSlug } from '../../lib/reviewerPins';import { inPlaceClipName } from '../../utils/animationClips';@@ -34,6 +35,7 @@ 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.jsxindex 5da31be37d..23f1f21be8 100644--- a/client/src/components/cos/tabs/MindTab.jsx+++ b/client/src/components/cos/tabs/MindTab.jsx@@ -1,6 +1,7 @@import { useCallback, useEffect, useRef, useState } from 'react';import { useSearchParams } from 'react-router';-import { ArrowUp, Brain, Check, CirclePause, CirclePlay, MessageCircle, RefreshCw, Settings2, Square, StickyNote, Upload } from 'lucide-react';+import { ArrowUp, Brain, Check, CirclePause, CirclePlay, ExternalLink, MessageCircle, RefreshCw, Settings2, Square, StickyNote, Upload } from 'lucide-react';+import { Link } from 'react-router';import useMounted from '../../../hooks/useMounted';import { useSocket } from '../../../hooks/useSocket';import { uuidv4 } from '../../../lib/uuid.js';@@ -456,7 +457,12 @@ export default function MindTab() {onSavingChange={setProfileSaving}/><div className="mt-4 border-t border-port-border pt-4">- <h3 className="text-sm font-semibold text-port-text">Agent task access</h3>+ <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><PersistentMindTaskAccessControlscapabilities={mind?.capabilities}diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsxindex da48ce427e..5c12f62a88 100644--- a/client/src/pages/ChiefOfStaff.jsx+++ b/client/src/pages/ChiefOfStaff.jsx@@ -42,6 +42,7 @@ 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.@@ -1115,6 +1116,13 @@ 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.jsxnew file mode 100644index 0000000000..6bc88f6f48--- /dev/null+++ b/client/src/pages/PersistentMindTools.jsx@@ -0,0 +1,134 @@+import { useCallback, useEffect, useState } from 'react';+import { ArrowLeft, CheckCircle2, LockKeyhole, RefreshCw, ShieldCheck, Wrench } from 'lucide-react';+import { Link } from 'react-router';+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() {+ const [data, setData] = useState(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState(null);++ const load = useCallback(() => {+ setLoading(true);+ api.getPersistentMindTools({ silent: true })+ .then((response) => {+ setData(response);+ setError(null);+ })+ .catch((requestError) => setError(requestError?.message || 'Could not load persistent mind tools'))+ .finally(() => setLoading(false));+ }, []);++ useEffect(() => {+ load();+ }, [load]);++ const tools = Array.isArray(data?.tools) ? data.tools : [];+ const grantedCount = tools.filter((tool) => tool.granted === true).length;+ const updateCapabilities = (capabilities) => setData((current) => current ? {+ ...current,+ capabilities,+ tools: (current.tools || []).map((tool) => ({+ ...tool,+ granted: capabilities[tool.capability] === true,+ })),+ } : current);++ 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">+ {error && <Banner tone="error" title="Tools unavailable">{error}. The last loaded state is preserved; retry when the connection recovers.</Banner>}++ {loading && !data ? (+ <div className="flex justify-center py-12"><BrailleSpinner text="Loading persistent mind tools" /></div>+ ) : data ? (+ <>+ <section aria-labelledby="tools-summary-heading" className="rounded border border-port-border bg-port-card p-4">+ <div className="flex flex-wrap items-start justify-between gap-3">+ <div>+ <h2 id="tools-summary-heading" className="flex items-center gap-2 text-base font-semibold text-port-text">+ <ShieldCheck size={18} className="text-port-accent" aria-hidden="true" />+ Access inventory+ </h2>+ <p className="mt-1 text-sm text-port-text-muted">+ {grantedCount} of {tools.length} persistent-mind capabilities granted. Changes apply to the next eligible wake.+ </p>+ </div>+ <button type="button" onClick={load} disabled={loading} 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 disabled:opacity-50">+ <RefreshCw size={15} className={loading ? 'animate-spin motion-reduce:animate-none' : ''} aria-hidden="true" /> Refresh+ </button>+ </div>+ </section>++ <section aria-labelledby="tools-heading" className="space-y-3">+ <h2 id="tools-heading" className="text-sm font-semibold uppercase tracking-wide text-port-text-muted">Granted capabilities</h2>+ {tools.map((tool) => (+ <article key={tool.id} className="rounded border border-port-border bg-port-card p-4">+ <div className="flex flex-wrap items-start justify-between gap-3">+ <div className="flex min-w-0 items-start gap-3">+ <span className={`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded ${tool.granted ? 'bg-port-success/15 text-port-success' : 'bg-port-border/50 text-port-text-muted'}`}>+ {tool.granted ? <CheckCircle2 size={19} aria-hidden="true" /> : <LockKeyhole size={18} aria-hidden="true" />}+ </span>+ <div className="min-w-0">+ <h3 className="text-sm font-semibold text-port-text">{tool.name}</h3>+ <p className="mt-1 text-sm text-port-text-muted">{tool.description}</p>+ </div>+ </div>+ <span className={`rounded-full border px-2.5 py-1 text-xs font-medium ${tool.granted ? 'border-port-success/40 text-port-success' : 'border-port-border text-port-text-muted'}`}>+ {tool.granted ? 'Granted' : 'Off by default'}+ </span>+ </div>++ {tool.capability === 'createTasks' && (+ <div className="mt-4 border-t border-port-border pt-4">+ <PersistentMindTaskAccessControls+ capabilities={data.capabilities}+ onSaved={updateCapabilities}+ />+ </div>+ )}++ {Array.isArray(tool.guardrails) && tool.guardrails.length > 0 && (+ <div className="mt-4 rounded border border-port-border bg-port-bg/40 px-3 py-2">+ <p className="text-xs font-semibold uppercase tracking-wide text-port-text-muted">Guardrails</p>+ <ul className="mt-2 space-y-1 text-xs text-port-text-muted">+ {tool.guardrails.map((guardrail) => <li key={guardrail}>• {guardrail}</li>)}+ </ul>+ </div>+ )}+ </article>+ ))}+ </section>++ <section aria-labelledby="boundaries-heading" className="rounded border border-port-border bg-port-card p-4">+ <h2 id="boundaries-heading" className="flex items-center gap-2 text-sm font-semibold text-port-text">+ <LockKeyhole size={16} className="text-port-warning" aria-hidden="true" />+ Always outside the persistent mind's authority+ </h2>+ <ul className="mt-3 grid gap-2 text-sm text-port-text-muted sm:grid-cols-3">+ {(data.boundaries || []).map((boundary) => <li key={boundary} className="rounded border border-port-border px-3 py-2">{boundary}</li>)}+ </ul>+ </section>+ </>+ ) : null}+ </div>+ </div>+ </div>+ );+}diff --git a/client/src/pages/PersistentMindTools.test.jsx b/client/src/pages/PersistentMindTools.test.jsxnew file mode 100644index 0000000000..d86538c263--- /dev/null+++ b/client/src/pages/PersistentMindTools.test.jsx@@ -0,0 +1,79 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { MemoryRouter } from 'react-router';++const api = vi.hoisted(() => ({+ getPersistentMindTools: vi.fn(),+ updateCosConfig: vi.fn(),+}));++vi.mock('../services/api', () => api);+vi.mock('../components/ui/Toast', () => ({+ default: { success: vi.fn(), error: vi.fn() },+}));++import PersistentMindTools from './PersistentMindTools';++const response = (overrides = {}) => ({+ schemaVersion: 1,+ capabilities: { schemaVersion: 1, createTasks: false },+ tools: [{+ id: 'cos.create-task',+ capability: 'createTasks',+ name: 'Queue CoS agent tasks',+ description: 'Request a bounded, typed CoS task for an app using a configured coding provider.',+ kind: 'typed-action',+ defaultEnabled: false,+ granted: false,+ guardrails: ['Up to five requests per turn'],+ }],+ boundaries: ['No arbitrary shell or file-system access'],+ ...overrides,+});++const renderPage = () => render(+ <MemoryRouter initialEntries={['/cos/mind/tools']}>+ <PersistentMindTools />+ </MemoryRouter>,+);++describe('PersistentMindTools', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ api.getPersistentMindTools.mockResolvedValue(response());+ api.updateCosConfig.mockResolvedValue({ success: true });+ });++ it('renders the server-described authority inventory and hard boundaries', async () => {+ renderPage();++ expect(await screen.findByRole('heading', { name: 'Access inventory' })).toBeInTheDocument();+ expect(screen.getByText(/persistent-mind capabilities granted/)).toHaveTextContent('0 of 1');+ expect(screen.getByText('No arbitrary shell or file-system access')).toBeInTheDocument();+ expect(screen.getByText('Off by default')).toBeInTheDocument();+ });++ it('edits the typed task grant and updates the inventory without a refetch', async () => {+ const user = userEvent.setup();+ renderPage();++ const toggle = await screen.findByRole('checkbox', { name: 'Allow mind to queue CoS agent tasks' });+ await user.click(toggle);++ await waitFor(() => expect(api.updateCosConfig).toHaveBeenCalledWith(+ { persistentMindCapabilities: { schemaVersion: 1, createTasks: true } },+ { silent: true },+ ));+ expect(await screen.findByText(/persistent-mind capabilities granted/)).toHaveTextContent('1 of 1');+ expect(screen.getByText('Granted')).toBeInTheDocument();+ });++ it('keeps the failure visible instead of presenting an empty inventory', async () => {+ api.getPersistentMindTools.mockRejectedValue(new Error('Server unreachable'));+ renderPage();++ expect(await screen.findByText('Tools unavailable')).toBeInTheDocument();+ expect(screen.queryByText(/persistent-mind capabilities granted/)).not.toBeInTheDocument();+ });+});diff --git a/client/src/services/apiAgents.js b/client/src/services/apiAgents.jsindex b5bfaf5d9f..3c22bf2d88 100644--- a/client/src/services/apiAgents.js+++ b/client/src/services/apiAgents.js@@ -66,6 +66,7 @@ export const repairRunRecords = (body = {}, options = {}) =>export const getPersistentMind = (filters = {}, options = {}) =>request(`/cos/mind${runEventQuery(filters)}`, options);export const getPersistentMindContext = (options = {}) => request('/cos/mind/context', options);+export const getPersistentMindTools = (options = {}) => request('/cos/mind/tools', options);export const getPersistentMindRuntime = (options = {}) => request('/cos/mind/runtime', options);export const sendPersistentMindMessage = (body, options = {}) =>request('/cos/mind/messages', { method: 'POST', body: JSON.stringify(body), ...options });diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 51a001a852..d7e5b266ae 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -158,6 +158,7 @@ const RAW_NAV_COMMANDS = [{ 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.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'] },diff --git a/server/lib/persistentMindCapabilities.js b/server/lib/persistentMindCapabilities.jsindex 7d4e47a4b1..77d45852ea 100644--- a/server/lib/persistentMindCapabilities.js+++ b/server/lib/persistentMindCapabilities.js@@ -12,6 +12,31 @@ import { PR_COMPLETION_VALUES } from './prDisposition.js';export const PERSISTENT_MIND_CAPABILITIES_SCHEMA_VERSION = 1;+// The persistent mind has a deliberately smaller surface than ordinary CoS+// agents. Keep this catalog beside the capability schema so the API and the UI+// describe the same grants instead of maintaining a second client-only list.+export const PERSISTENT_MIND_TOOL_CATALOG = Object.freeze([+ Object.freeze({+ id: 'cos.create-task',+ capability: 'createTasks',+ name: 'Queue CoS agent tasks',+ description: 'Request a bounded, typed CoS task for an app using a configured coding provider.',+ kind: 'typed-action',+ defaultEnabled: false,+ guardrails: [+ 'Up to five requests per turn',+ 'Configured app, provider, model, effort, and completion policy are re-validated before queueing',+ 'Work runs through the normal isolated-worktree, autonomy, budget, review, CI, and PR gates',+ ],+ }),+]);++export const PERSISTENT_MIND_TOOL_BOUNDARIES = Object.freeze([+ 'No arbitrary shell or file-system access',+ 'No direct access to onboard tools such as image generation or browser controls',+ 'No provider credentials or hidden reasoning tokens are exposed as tools',+]);+export const PERSISTENT_MIND_TASK_LIMITS = Object.freeze({maxPerTurn: 5,descriptionChars: 500,diff --git a/server/lib/persistentMindCapabilities.test.js b/server/lib/persistentMindCapabilities.test.jsindex 8693abf8d0..201be84626 100644--- a/server/lib/persistentMindCapabilities.test.js+++ b/server/lib/persistentMindCapabilities.test.js@@ -3,11 +3,18 @@ import {createDefaultPersistentMindCapabilities,mergePersistentMindCapabilities,normalizePersistentMindCapabilities,+ PERSISTENT_MIND_TOOL_CATALOG,persistentMindCapabilitiesSchema,persistentMindTaskRequestSchema,} from './persistentMindCapabilities.js';describe('persistent mind capabilities', () => {+ it('describes every persistent-mind grant from the capability contract', () => {+ expect(PERSISTENT_MIND_TOOL_CATALOG).toEqual([+ expect.objectContaining({ id: 'cos.create-task', capability: 'createTasks', defaultEnabled: false }),+ ]);+ });+it('keeps task creation opt-in across fresh and legacy config', () => {expect(createDefaultPersistentMindCapabilities()).toMatchObject({ createTasks: false });expect(normalizePersistentMindCapabilities(null)).toMatchObject({ createTasks: false });diff --git a/server/routes/cosMindRoutes.js b/server/routes/cosMindRoutes.jsindex 0e6db80819..fe280995b8 100644--- a/server/routes/cosMindRoutes.js+++ b/server/routes/cosMindRoutes.js@@ -5,7 +5,12 @@ import { z } from 'zod';import { asyncHandler, ServerError } from '../lib/errorHandler.js';import { getDomainMode } from '../lib/domainAutonomy.js';import { PERSISTENT_MIND_LIMITS } from '../lib/persistentMind.js';-import { normalizePersistentMindCapabilities } from '../lib/persistentMindCapabilities.js';+import {+ normalizePersistentMindCapabilities,+ PERSISTENT_MIND_CAPABILITIES_SCHEMA_VERSION,+ PERSISTENT_MIND_TOOL_BOUNDARIES,+ PERSISTENT_MIND_TOOL_CATALOG,+} from '../lib/persistentMindCapabilities.js';import {PERSISTENT_MIND_ID,PERSISTENT_MIND_TRAJECTORY_LIMITS,@@ -154,6 +159,23 @@ router.get('/mind/context', asyncHandler(async (_req, res) => {});}));+// Keep the persistent mind's authority inventory separate from the broader+// onboard-tools registry. Those tools belong to other agent surfaces and are+// not direct capabilities of the persistent mind.+router.get('/mind/tools', asyncHandler(async (_req, res) => {+ const root = await loadState();+ const capabilities = normalizePersistentMindCapabilities(root.config?.persistentMindCapabilities);+ res.json({+ schemaVersion: PERSISTENT_MIND_CAPABILITIES_SCHEMA_VERSION,+ capabilities,+ boundaries: PERSISTENT_MIND_TOOL_BOUNDARIES,+ tools: PERSISTENT_MIND_TOOL_CATALOG.map((tool) => ({+ ...tool,+ granted: capabilities[tool.capability] === true,+ })),+ });+}));+router.get('/mind/runtime', asyncHandler(async (_req, res) => {const [root, state] = await Promise.all([loadState(), getPersistentMindState()]);const prompt = normalizePersistentMindPrompt(root.config?.persistentMindPrompt);diff --git a/server/routes/cosMindRoutes.test.js b/server/routes/cosMindRoutes.test.jsindex 95d7e9b2b5..6537852544 100644--- a/server/routes/cosMindRoutes.test.js+++ b/server/routes/cosMindRoutes.test.js@@ -151,6 +151,25 @@ describe('persistent mind routes', () => {}));});+ it('serves a server-described inventory of persistent-mind tools', async () => {+ const res = await get('/mind/tools');+ expect(res.status).toBe(200);+ expect(res.body).toMatchObject({+ schemaVersion: 1,+ capabilities: { schemaVersion: 1, createTasks: true },+ boundaries: expect.arrayContaining([expect.stringMatching(/arbitrary shell/i)]),+ tools: [expect.objectContaining({+ id: 'cos.create-task',+ capability: 'createTasks',+ granted: true,+ defaultEnabled: false,+ })],+ });+ expect(res.body.tools[0].guardrails).toEqual(expect.arrayContaining([+ expect.stringMatching(/isolated-worktree/i),+ ]));+ });+it('exposes live context, system, inference, and model-residency telemetry', async () => {mocks.getPersistentMindState.mockResolvedValue({enabled: true,