Skip to content

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

feat: terminal theme toggle - per-session Claude theme mirroring, cream default

Gulum8e67a489ed68
diff --git a/src/main/config.ts b/src/main/config.ts
index 2d9ec8c3..eaff5395 100644
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@ -137,6 +137,10 @@ export interface HarnessConfig {
circuitBreaker?: CircuitBreakerConfig;
/** Fire native desktop notifications on agent lifecycle events (idle finish / waiting for input). */
notifications?: boolean;
+ /** Terminal theme — mirrored into each agent's per-session Claude settings
+ * ("theme" key) at spawn so the TUI's truecolor palette matches. Scoped to
+ * harness agents only; the user's global Claude theme is never touched. */
+ terminalTheme?: 'light' | 'dark';
/** Master toggle for the Slack → Michael's-queue integration. */
slackEnabled?: boolean;
/** Slack app signing secret (Basic Information → Signing Secret). Never logged. */
diff --git a/src/main/hive.ts b/src/main/hive.ts
index 0cc287e8..5664e30c 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -240,7 +240,7 @@ export class HiveManager {
* Ensure an agent's workspace + registry entry, returning the spawn injection
* (extra `claude` args + env) that makes the process hive-aware.
*/
- ensureAgent(meta: AgentMeta, opts: { semanticMemory?: boolean } = {}): SpawnInjection {
+ ensureAgent(meta: AgentMeta, opts: { semanticMemory?: boolean; theme?: 'light' | 'dark' } = {}): SpawnInjection {
const root = this.root();
if (!root) return { args: [], env: {} };
this.ensureHive();
@@ -310,7 +310,7 @@ export class HiveManager {
if (sock && shim) {
env.HIVE_SOCK = sock;
const settingsPath = join(dir, 'settings.json');
- this.writeJson(settingsPath, this.hookSettings(shim));
+ this.writeJson(settingsPath, this.hookSettings(shim, opts.theme));
args.push('--settings', settingsPath);
}
return { args, env };
@@ -366,13 +366,17 @@ export class HiveManager {
}
/** Claude Code settings that route every relevant hook through the shim. */
- private hookSettings(shim: string): unknown {
+ private hookSettings(shim: string, theme?: 'light' | 'dark'): unknown {
const cmd = `node "${shim}"`;
const entry = (matcher?: string) => ({
...(matcher ? { matcher } : {}),
hooks: [{ type: 'command', command: cmd }]
});
return {
+ // Match the TUI's truecolor palette to the harness terminal theme —
+ // PER SESSION, so the user's global Claude theme (their own terminals
+ // outside the app) is never touched.
+ ...(theme ? { theme } : {}),
hooks: {
Stop: [entry()],
SubagentStop: [entry()],
diff --git a/src/main/index.ts b/src/main/index.ts
index 7829477b..1dd9c4c5 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -677,7 +677,10 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta
// identity + protocol (extra --append-system-prompt args + AGENT_* env).
if (opts.hive && hive.enabled()) {
try {
- const inj = hive.ensureAgent({ ...opts.hive, cwd: opts.cwd }, { semanticMemory: memory.active() });
+ const inj = hive.ensureAgent(
+ { ...opts.hive, cwd: opts.cwd },
+ { semanticMemory: memory.active(), theme: readConfig().terminalTheme ?? 'light' }
+ );
opts.args = [...(opts.args ?? []), ...inj.args];
// Point the agent's mempalace CLI at the shared palace (no-op if inactive).
opts.env = { ...(opts.env ?? {}), ...inj.env, ...memory.env() };
@@ -748,6 +751,10 @@ ipcMain.handle('app:copyToClipboard', (_evt, text: unknown) => {
ipcMain.handle('app:readClipboard', () => {
try { return clipboard.readText(); } catch { return ''; }
});
+// NOTE: the terminal theme is mirrored into each agent's per-session Claude
+// settings at spawn (hive.ensureAgent theme option) — deliberately NOT via
+// `claude config set -g theme`, which would also restyle the user's own
+// Claude sessions outside the app.
// ─── IPC: folder picker ─────────────────────────────────────────────────────
ipcMain.handle('dialog:chooseFolder', async (evt) => {
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d44d7060..0cf48983 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -121,6 +121,8 @@ export interface HarnessConfig {
agentTokenCaps?: Record<string, number>;
maxTurns?: number;
circuitBreaker?: CircuitBreakerConfig;
+ /** Terminal theme, mirrored into each agent's per-session Claude settings. */
+ terminalTheme?: 'light' | 'dark';
}
export interface MemoryStatus {
diff --git a/src/renderer/src/components/PtyTerminalView.tsx b/src/renderer/src/components/PtyTerminalView.tsx
index 58d77612..8b814966 100644
--- a/src/renderer/src/components/PtyTerminalView.tsx
+++ b/src/renderer/src/components/PtyTerminalView.tsx
@@ -26,6 +26,9 @@ function loadTheme(): PtyTheme {
const v = window.localStorage.getItem(LS_THEME);
if (v === 'dark' || v === 'light') return v;
} catch { /* noop */ }
+ // Cream by default — safe because each agent's per-session Claude settings
+ // mirror the terminal theme, so the TUI paints the matching truecolor
+ // palette (light on cream, dark on ink).
return 'light';
}
@@ -272,8 +275,20 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
live · pty {ptyId}
<div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: 2 }}>
<button
- onClick={() => setPtyTheme((t) => (t === 'dark' ? 'light' : 'dark'))}
- title={ptyTheme === 'dark' ? 'Switch to light terminal' : 'Switch to dark terminal'}
+ onClick={() => {
+ const next: PtyTheme = ptyTheme === 'dark' ? 'light' : 'dark';
+ setPtyTheme(next);
+ // Mirror into the harness config: every agent (re)spawned from
+ // now on gets the matching `theme` in its per-session Claude
+ // settings, so the TUI's truecolor palette fits the terminal.
+ // Scoped to harness agents — the user's global Claude theme
+ // (their own terminals) is never touched. Running sessions keep
+ // their palette until they restart.
+ void window.cth.updateConfig({ terminalTheme: next });
+ }}
+ title={ptyTheme === 'dark'
+ ? 'Switch terminal + agent sessions to the light theme'
+ : 'Switch terminal + agent sessions to the dark theme'}
style={{ ...zoomBtnStyle, width: 22, marginRight: 4 }}
>{ptyTheme === 'dark' ? '☀' : '☾'}</button>
<button