an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
merge: Free Flow voice dictation → message queue (onto v0.2.6+KG+multiwin)
Michael (god)e978d374b849
diff --cc src/main/index.tsindex 04842307,dcf01d26..fe9035d3--- a/src/main/index.ts+++ b/src/main/index.ts@@@ -24,8 -22,9 +24,9 @@@ import { MemoryReflector, type ReflectSimport { PersistStore } from './db';import { readAgentUsage, readContextTokens } from './transcript';import { listIssues, listCIRuns } from './github';-import { SlackWebhookServer, SlackReplyServer, postSlackReply } from './slack';+import { SlackWebhookServer, SlackReplyServer, postSlackReply, type SlackEventFile } from './slack';import { WebhookServer, type WebhookInbound, type WebhookTaskStatus } from './webhook';+ import { transcribeWithGroq, DEFAULT_GROQ_MODEL } from './freeflow';import { TelemetryCollector } from './telemetry';import { ControlRegistry } from './control';import { ClosingTimeController } from './closingTime';@@@ -1197,32 -928,41 +1198,53 @@@ function createWindow(opts: { floor?: b}});- mainWindow = win;+ // Capture the webContents once: after 'closed' the window is gone, but this+ // reference stays valid as the per-PTY ownership key.+ const wc = win.webContents;++ allWindows.add(win);+ // Global timer events follow the user — the most-recently-focused window is+ // primary. The primary is also seeded synchronously so boot events route now.+ win.on('focus', () => { mainWindow = win; });+ if (!isFloor) mainWindow = win;+ // Permission gate for the renderer (our own trusted, local content). The only+ // permission we constrain is microphone capture (Free Flow): it's allowed ONLY+ // while Free Flow is enabled, so a disabled flag means zero mic access even at+ // the Electron layer. Every other permission keeps the app's prior permissive+ // behavior (e.g. clipboard for xterm/editor copy must keep working).+ const ses = win.webContents.session;+ ses.setPermissionRequestHandler((_wc, permission, callback, details) => {+ if (permission === 'media') {+ const mediaTypes = details && 'mediaTypes' in details ? details.mediaTypes : undefined;+ const wantsAudio = !mediaTypes || mediaTypes.includes('audio');+ callback(readConfig().freeflowEnabled === true && wantsAudio);+ return;+ }+ callback(true);+ });+ ses.setPermissionCheckHandler((_wc, permission) => {+ if (permission === 'media') return readConfig().freeflowEnabled === true;+ return true;+ });+- // Persist geometry as the user drags/resizes (debounced) and on close. Skip- // while maximized/minimized so a restore doesn't save the fullscreen rect.- const saveBounds = debounce(() => {- if (win.isDestroyed() || win.isMinimized() || win.isMaximized()) return;- try { persist.setKv('window.bounds', win.getBounds()); } catch { /* DB best-effort */ }- }, 400);- win.on('resized', saveBounds);- win.on('moved', saveBounds);- win.on('close', () => {- if (win.isDestroyed() || win.isMinimized() || win.isMaximized()) return;- try { persist.setKv('window.bounds', win.getBounds()); } catch { /* DB best-effort */ }- });+ // Only the primary persists geometry (kv `window.bounds`); floors cascade+ // fresh each launch. Skip while maximized/minimized so a restore doesn't save+ // the fullscreen rect.+ if (!isFloor) {+ const saveBounds = debounce(() => {+ if (win.isDestroyed() || win.isMinimized() || win.isMaximized()) return;+ try { persist.setKv('window.bounds', win.getBounds()); } catch { /* DB best-effort */ }+ }, 400);+ win.on('resized', saveBounds);+ win.on('moved', saveBounds);+ win.on('close', () => {+ if (win.isDestroyed() || win.isMinimized() || win.isMaximized()) return;+ try { persist.setKv('window.bounds', win.getBounds()); } catch { /* DB best-effort */ }+ });+ }++win.once('ready-to-show', () => win.show());win.webContents.setWindowOpenHandler(({ url }) => {diff --cc src/renderer/src/components/MessageQueueComposer.tsxindex ae3aa29d,f67b3b11..b93f1945--- a/src/renderer/src/components/MessageQueueComposer.tsx+++ b/src/renderer/src/components/MessageQueueComposer.tsx@@@ -31,15 -27,27 +32,31 @@@ export function MessageQueueComposer({const setDraft = useStore((s) => s.setDraft);const setText = (t: string) => setDraft(agent.id, t);+ // Free Flow voice dictation (entry point A). The mic button shows only when the+ // feature is enabled in Settings; a transcript is appended to this draft for+ // review before sending (never auto-sent).+ const freeflowEnabled = useStore((s) => s.freeflowEnabled);+ const ff = useFreeflow();+ const ffMine = ff.targetAgentId === agent.id;+ const ffHint = !freeflowEnabled+ ? null+ : ffMine && ff.status === 'recording'+ ? '● recording — click stop to transcribe'+ : ffMine && ff.status === 'transcribing'+ ? 'transcribing…'+ : ff.error && (ffMine || ff.targetAgentId === null)+ ? `voice: ${ff.error}`+ : null;+const idle = agent.status === 'idle';+ // Only the god/Michael agent gets the delegation toggle. Default OFF.+ const [delegate, setDelegate] = useState(false);+const queueIt = () => {if (!text.trim()) return;- enqueueMessage(agent.id, text);+ const out = delegate ? DELEGATE_PREFIX + text : text;+ enqueueMessage(agent.id, out);setText('');};@@@ -167,11 -184,9 +193,12 @@@outline: 'none'}}/>- {/* Right column: Delegate toggle stacked ABOVE Send (god/Michael only). */}- {/* Free Flow mic button sits directly ABOVE Send (only when enabled). */}++ {/* Right column: Delegate toggle (god only) + Free Flow mic stacked ABOVE Send. */}<div style={{ display: 'flex', flexDirection: 'column', gap: 6, alignItems: 'stretch' }}>+ {agent.isGod && (+ <DelegateSwitch on={delegate} onToggle={() => setDelegate((d) => !d)} />+ )}+ {freeflowEnabled && <FreeFlowButton agentId={agent.id} />}<PixelButton variant="primary" size="md" onClick={queueIt} disabled={!text.trim()}><span style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}>send <Icon name="arrow-right" />@@@ -183,42 -198,37 +210,77 @@@);}+/**+ * A pixel-style toggle switch for the god/Michael delegation flag. ON prepends+ * DELEGATE_PREFIX to the enqueued message so Michael fans the task out to other+ * available agents (or does it himself one-by-one if none are free).+ */+function DelegateSwitch({ on, onToggle }: { on: boolean; onToggle: () => void }) {+ return (+ <button+ type="button"+ role="switch"+ aria-checked={on}+ onClick={onToggle}+ title="When ON, Michael hands the task to other available agents (or does it himself one-by-one if none are free)."+ style={{+ display: 'inline-flex', alignItems: 'center', justifyContent: 'space-between', gap: 8,+ padding: '3px 6px', border: 'none', cursor: 'pointer', background: 'transparent',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12,+ color: on ? 'var(--cth-ink-900)' : 'var(--cth-ink-700)'+ }}+ >+ <span>Delegate</span>+ {/* track */}+ <span style={{+ position: 'relative', flexShrink: 0, width: 28, height: 14,+ background: on ? 'var(--cth-lilac)' : 'var(--cth-cream-200)',+ boxShadow: `inset 0 0 0 1px ${on ? 'var(--cth-ink-900)' : 'var(--cth-ink-700)'}`,+ transition: 'background 120ms ease'+ }}>+ {/* knob */}+ <span style={{+ position: 'absolute', top: 2, left: on ? 16 : 2, width: 10, height: 10,+ background: 'var(--cth-paper-100)',+ boxShadow: '0 0 0 1px var(--cth-ink-900)',+ transition: 'left 120ms ease'+ }} />+ </span>+ </button>+ );+}+++ /**+ * Push-to-talk button for the queue composer. Click to start recording, click+ * again to stop → transcribe → the text is appended to this agent's draft. While+ * another agent is mid-dictation it's disabled (one shared recorder). The actual+ * capture + Groq call live in the freeflow recorder singleton.+ */+ function FreeFlowButton({ agentId }: { agentId: string }) {+ const ff = useFreeflow();+ const mine = ff.targetAgentId === agentId;+ const recording = ff.status === 'recording' && mine;+ const transcribing = ff.status === 'transcribing' && mine;+ // Block while another agent's clip is recording/uploading (single recorder).+ const busyElsewhere = ff.status !== 'idle' && !mine;+ return (+ <PixelButton+ variant={recording ? 'destructive' : 'secondary'}+ size="md"+ onClick={() => freeflowRecorder.toggle(agentId)}+ disabled={transcribing || busyElsewhere}+ >+ <span+ title={+ recording ? 'Stop & transcribe'+ : transcribing ? 'Transcribing…'+ : 'Free Flow — dictate into the queue (push to talk)'+ }+ style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}+ >+ <Icon name="mic" />+ {transcribing ? '…' : recording ? 'stop' : 'voice'}+ </span>+ </PixelButton>+ );+ }diff --cc src/renderer/src/components/SettingsModal.tsxindex ea63624b,bd35e8b1..fb27f94c--- a/src/renderer/src/components/SettingsModal.tsx+++ b/src/renderer/src/components/SettingsModal.tsx@@@ -193,41 -194,15 +194,50 @@@ export function SettingsModal({ configconst [showWebhookSecret, setShowWebhookSecret] = useState(false);const [showWebhookHelp, setShowWebhookHelp] = useState(false);+ // ─── Knowledge Graph (enterprise multimodal context for agents) ───────────+ const [kgEnabled, setKgEnabled] = useState<boolean>(+ (config as HarnessConfig & { knowledgeGraph?: { enabled?: boolean } }).knowledgeGraph?.enabled === true+ );+ const [kgDocCount, setKgDocCount] = useState(0);+ const [kgBusy, setKgBusy] = useState(false);+ const [kgNote, setKgNote] = useState('');++ const refreshKgStatus = async () => {+ try { const s = await window.cth.kgStatus(); setKgDocCount(s.docCount); }+ catch { /* status unavailable */ }+ };++ const toggleKg = async () => {+ const next = !kgEnabled;+ setKgEnabled(next);+ try {+ await window.cth.updateConfig({ knowledgeGraph: { enabled: next } });+ if (next) await refreshKgStatus();+ } catch { setKgEnabled(!next); }+ };++ const addKgFiles = async () => {+ setKgBusy(true); setKgNote('');+ try {+ const res = await window.cth.kgAddFiles();+ if (!res.ok) { setKgNote(res.error === 'cancelled' ? '' : (res.error ?? 'failed')); return; }+ const added = res.results.filter((r) => r.ok).length;+ const failed = res.results.length - added;+ setKgNote(`added ${added} document${added === 1 ? '' : 's'}${failed ? `, ${failed} failed` : ''}`);+ await refreshKgStatus();+ } catch (e) { setKgNote(e instanceof Error ? e.message : String(e)); }+ finally { setKgBusy(false); }+ };++ // --- Free Flow (voice dictation → message queue) ---+ const setFreeflowEnabledStore = useStore((s) => s.setFreeflowEnabled);+ const [freeflowEnabled, setFreeflowEnabled] = useState(slackCfg.freeflowEnabled ?? false);+ const [groqKey, setGroqKey] = useState(slackCfg.groqApiKey ?? '');+ const [freeflowModel, setFreeflowModel] = useState(slackCfg.freeflowModel ?? 'whisper-large-v3-turbo');+ const [showGroqKey, setShowGroqKey] = useState(false);+ const [freeflowBusy, setFreeflowBusy] = useState(false);+ const [freeflowNote, setFreeflowNote] = useState('');+// Re-seed every editable field from the on-disk config when the modal opens.// App's `config` prop is loaded once and never refreshed after a save, so// without this the saved budget / velocity / slack values show blank on reopen.@@@ -247,11 -222,10 +257,14 @@@setWebhookEnabled(cc.webhookEnabled ?? false);setWebhookSecret(cc.webhookSecret ?? '');setWebhookPort(String(cc.webhookPort ?? 3849));+ const kgOn = (cc as { knowledgeGraph?: { enabled?: boolean } }).knowledgeGraph?.enabled === true;+ setKgEnabled(kgOn);+ setFreeflowEnabled(cc.freeflowEnabled ?? false);+ setGroqKey(cc.groqApiKey ?? '');+ setFreeflowModel(cc.freeflowModel ?? 'whisper-large-v3-turbo');}).catch(() => { /* keep prop-seeded values */ });+ window.cth.kgStatus().then((s) => { if (alive) setKgDocCount(s.docCount); })+ .catch(() => { /* status unavailable */ });// Hydrate live connection state + the persisted Request URL: the// tunnel URL lives in main, so reopening Settings while connected re-shows it.window.cth.slackStatus().then((s) => {diff --cc src/renderer/src/store/store.tsindex c4c11678,44936905..f2c5bf8f--- a/src/renderer/src/store/store.ts+++ b/src/renderer/src/store/store.ts@@@ -174,10 -169,12 +174,14 @@@ interface State* composer) doesn't eat what the user was typing. */drafts: Record<string, string>;setDraft: (agentId: string, text: string) => void;+ /** Mirror of config.freeflowEnabled so the composer can show/hide the Free Flow+ * mic button reactively (set by App on config load and by Settings on save). */+ freeflowEnabled: boolean;+ setFreeflowEnabled: (on: boolean) => void;- /** Park a message for an agent. Returns nothing; the flush loop delivers it. */- enqueueMessage: (agentId: string, text: string, meta?: { slack?: { channel: string; thread_ts: string } }) => void;+ /** Park a message for an agent. Returns nothing; the flush loop delivers it.+ * `meta.instruction`, when set, is what gets typed into the PTY instead of+ * `text` (UI/card surfaces still show `text`). */+ enqueueMessage: (agentId: string, text: string, meta?: { slack?: { channel: string; thread_ts: string }; instruction?: string }) => void;/** Drop a single queued message (user removed it, or it was just delivered). */removeQueuedMessage: (agentId: string, messageId: string) => void;/** Clear an agent's entire pending queue. */