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(codex): provider-aware auto-mode flags + Codex command reference

Chaitanya Girieb23b84c6e70
diff --git a/src/main/config.ts b/src/main/config.ts
index eaff5395..08da4acc 100644
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@ -2,6 +2,7 @@ import { app } from 'electron';
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { homedir } from 'node:os';
+import { autoModeFlagForProvider, inferAgentProvider, type AgentProvider } from '../shared/agentProvider';
/** A recurring auto-dispatched mission fired on an interval by the scheduler. */
export interface ScheduledMission {
@@ -258,12 +259,17 @@ export function modelForRole(meta: RoleHint): string | undefined {
return MODEL_WORKER;
}
-/** Auto-suggested command string given current autoMode preference. */
-export function commandForAutoMode(config: HarnessConfig): string {
- if (config.autoMode) {
- return `${config.defaultCommand} --permission-mode bypassPermissions`;
- }
- return config.defaultCommand;
+/** Auto-suggested command string given current autoMode preference.
+ * Provider-aware: Claude gets --permission-mode bypassPermissions; Codex gets
+ * --full-auto; custom providers receive no extra flags. */
+export function commandForAutoMode(
+ config: HarnessConfig,
+ provider?: AgentProvider
+): string {
+ if (!config.autoMode) return config.defaultCommand;
+ const p = provider ?? inferAgentProvider(config.defaultCommand);
+ const flag = autoModeFlagForProvider(p);
+ return flag ? `${config.defaultCommand} ${flag}` : config.defaultCommand;
}
/** Ensure harnessHome exists on disk. */
diff --git a/src/main/index.ts b/src/main/index.ts
index 15899bf4..ea0e831b 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -26,7 +26,7 @@ import { SlackWebhookServer } from './slack';
import { TelemetryCollector } from './telemetry';
import { ControlRegistry } from './control';
import { ClosingTimeController } from './closingTime';
-import { inferAgentProvider, isClaudeProvider, type AgentProvider } from '../shared/agentProvider';
+import { inferAgentProvider, isClaudeProvider, nonInteractiveEnvForProvider, type AgentProvider } from '../shared/agentProvider';
const isDev = !!process.env.ELECTRON_RENDERER_URL;
const ptyManager = new PtyManager();
@@ -727,6 +727,12 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta
if (isClaudeProvider(provider)) {
try { ensureClaudePermissionsAccepted(opts.cwd); } catch { /* never block spawn */ }
}
+ // Suppress first-run interactive prompts for providers that need it (e.g. Codex
+ // directory-trust gate). Merges into any env already set on opts.
+ const nonInteractiveEnv = nonInteractiveEnvForProvider(provider);
+ if (Object.keys(nonInteractiveEnv).length > 0) {
+ opts.env = { ...(opts.env ?? {}), ...nonInteractiveEnv };
+ }
const res = ptyManager.spawn(opts);
syncKeepAwake(); // arm the power-save blocker while ≥1 agent PTY is alive (#18)
return res;
diff --git a/src/renderer/src/components/AddAgentModal.tsx b/src/renderer/src/components/AddAgentModal.tsx
index 5fc38dea..a779f3ed 100644
--- a/src/renderer/src/components/AddAgentModal.tsx
+++ b/src/renderer/src/components/AddAgentModal.tsx
@@ -254,7 +254,7 @@ export function AddAgentModal({ onClose, config }: AddAgentModalProps) {
</div>
</Row>}
- <Row label={config.autoMode && isClaudeProvider(provider) ? 'Command (auto mode on)' : 'Command'}>
+ <Row label={config.autoMode && provider !== 'custom' ? 'Command (auto mode on)' : 'Command'}>
<input
value={command}
onChange={(e) => setCommand(e.target.value)}
diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.ts
index e254b434..95925b52 100644
--- a/src/renderer/src/store/config.ts
+++ b/src/renderer/src/store/config.ts
@@ -2,6 +2,7 @@
// so we don't have to reach into the preload package to type-check.
import {
AGENT_PROVIDER_PRESETS,
+ autoModeFlagForProvider,
defaultCommandForProvider,
inferAgentProvider,
isClaudeProvider,
@@ -100,5 +101,7 @@ export function buildSpawnCommand(
? config.defaultCommand || defaultCommandForProvider(provider)
: defaultCommandForProvider(provider, config.defaultCommand || '') || config.defaultCommand || '';
const withModel = isClaudeProvider(provider) && model ? `${base} --model ${model}` : base;
- return isClaudeProvider(provider) && config.autoMode ? `${withModel} --permission-mode bypassPermissions` : withModel;
+ if (!config.autoMode) return withModel;
+ const flag = autoModeFlagForProvider(provider);
+ return flag ? `${withModel} ${flag}` : withModel;
}
diff --git a/src/shared/agentProvider.ts b/src/shared/agentProvider.ts
index 8b94c420..3283e37e 100644
--- a/src/shared/agentProvider.ts
+++ b/src/shared/agentProvider.ts
@@ -1,15 +1,48 @@
+import type { CmdGroup } from './claudeCommands';
+import { COMMAND_GROUPS as CLAUDE_COMMAND_GROUPS } from './claudeCommands';
+import { CODEX_COMMAND_GROUPS } from './codexCommands';
+
export type AgentProvider = 'claude' | 'codex' | 'custom';
export interface AgentProviderPreset {
id: AgentProvider;
label: string;
defaultCommand: string;
+ /** Slash / CLI command reference for this provider. */
+ commandGroups: CmdGroup[];
+ /** Environment variable to set for non-interactive / first-run suppression. */
+ nonInteractiveEnv?: Record<string, string>;
+ /** Flag(s) appended to the command string when auto mode is active. */
+ autoModeFlag: string;
}
export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [
- { id: 'claude', label: 'Claude Code', defaultCommand: 'claude' },
- { id: 'codex', label: 'Codex', defaultCommand: 'codex' },
- { id: 'custom', label: 'Custom', defaultCommand: '' }
+ {
+ id: 'claude',
+ label: 'Claude Code',
+ defaultCommand: 'claude',
+ commandGroups: CLAUDE_COMMAND_GROUPS,
+ autoModeFlag: '--permission-mode bypassPermissions'
+ },
+ {
+ id: 'codex',
+ label: 'Codex',
+ defaultCommand: 'codex',
+ commandGroups: CODEX_COMMAND_GROUPS,
+ // --full-auto: auto-approves workspace operations, keeps OS sandbox scoped to
+ // workspace (no outbound network). Matches the non-interactive intent of
+ // Claude's bypassPermissions while retaining a safety boundary.
+ autoModeFlag: '--full-auto',
+ // Suppresses first-run interactive prompts (directory-trust gate, installer).
+ nonInteractiveEnv: { CODEX_NON_INTERACTIVE: '1' }
+ },
+ {
+ id: 'custom',
+ label: 'Custom',
+ defaultCommand: '',
+ commandGroups: [],
+ autoModeFlag: ''
+ }
];
export function isAgentProvider(value: unknown): value is AgentProvider {
@@ -43,3 +76,18 @@ export function defaultCommandForProvider(provider: AgentProvider, fallback = ''
if (provider === 'custom') return fallback;
return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider)?.defaultCommand ?? fallback;
}
+
+/** Returns the preset's auto-mode CLI flag for the given provider. Empty string = no flag. */
+export function autoModeFlagForProvider(provider: AgentProvider): string {
+ return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider)?.autoModeFlag ?? '';
+}
+
+/** Returns any env vars the provider needs for non-interactive / first-run suppression. */
+export function nonInteractiveEnvForProvider(provider: AgentProvider): Record<string, string> {
+ return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider)?.nonInteractiveEnv ?? {};
+}
+
+/** Returns the command reference groups for the given provider. */
+export function commandGroupsForProvider(provider: AgentProvider): CmdGroup[] {
+ return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider)?.commandGroups ?? [];
+}
diff --git a/src/shared/codexCommands.ts b/src/shared/codexCommands.ts
new file mode 100644
index 00000000..9aa3b286
--- /dev/null
+++ b/src/shared/codexCommands.ts
@@ -0,0 +1,64 @@
+/**
+ * Command reference for the OpenAI Codex CLI.
+ *
+ * Mirrors the shape of claudeCommands.ts so any component that renders a
+ * command reference can switch on provider. Curated from the Codex CLI
+ * reference + slash-commands docs (developers.openai.com/codex/cli/).
+ *
+ * `kind` semantics match claudeCommands.ts:
+ * - `slash` — typed inside the Codex interactive REPL session
+ * - `cli` — shell flags / sub-commands passed at launch
+ */
+import type { CmdGroup } from './claudeCommands';
+
+export const CODEX_COMMAND_GROUPS: CmdGroup[] = [
+ {
+ title: 'SESSION',
+ items: [
+ { cmd: '/clear', kind: 'slash', desc: 'Start a fresh chat without quitting — clears the conversation context.' },
+ { cmd: '/help', kind: 'slash', desc: 'List every available slash command.' },
+ { cmd: '/copy', kind: 'slash', desc: 'Copy the latest model output to the clipboard.' },
+ { cmd: '/logout', kind: 'slash', desc: 'Clear locally stored credentials.' },
+ { cmd: '/rename', kind: 'slash', desc: 'Rename the current conversation.' }
+ ]
+ },
+ {
+ title: 'UI & PREFERENCES',
+ items: [
+ { cmd: '/theme', kind: 'slash', desc: 'Toggle between light and dark themes.' },
+ { cmd: '/vim', kind: 'slash', desc: 'Toggle Vim key-bindings in the input box.' },
+ { cmd: '/raw', kind: 'slash', desc: 'Toggle raw (unformatted) output for the model response.' }
+ ]
+ },
+ {
+ title: 'MEMORY & SKILLS',
+ items: [
+ { cmd: '/memories', kind: 'slash', desc: 'View and manage what Codex has remembered about you.' },
+ { cmd: '/skills', kind: 'slash', desc: 'Browse and manage installed Codex skills / extensions.' },
+ { cmd: '/hooks', kind: 'slash', desc: 'View the configured lifecycle hooks.' }
+ ]
+ },
+ {
+ title: 'APPROVALS & PERMISSIONS',
+ items: [
+ { cmd: 'codex --full-auto', kind: 'cli', desc: 'Run without approval prompts for workspace operations. Maintains an OS-enforced workspace sandbox (no outbound network). Use this for auto mode.' },
+ { cmd: 'codex --dangerously-bypass-approvals-and-sandbox', kind: 'cli', desc: 'Skip all approval prompts AND disable the OS sandbox entirely. Alias: --yolo. For fully-isolated environments (Docker, CI VM) only.' },
+ { cmd: 'codex --ask-for-approval never', kind: 'cli', desc: 'Never ask for approval (fine-grained flag — pair with --sandbox for full control).' },
+ { cmd: 'codex --sandbox danger-full-access', kind: 'cli', desc: 'Remove all sandbox restrictions (fine-grained flag).' }
+ ]
+ },
+ {
+ title: 'AUTOMATION (HEADLESS)',
+ items: [
+ { cmd: 'codex -p "your prompt"', kind: 'cli', desc: 'Non-interactive print mode: run one prompt and exit.', usage: 'codex -p "summarise this file"' },
+ { cmd: 'CODEX_NON_INTERACTIVE=1 codex', kind: 'cli', desc: 'Suppress all interactive installer / first-run prompts. Set automatically by Munder Difflin in auto mode.' }
+ ]
+ },
+ {
+ title: 'CONFIG',
+ items: [
+ { cmd: 'codex --model <model>', kind: 'cli', desc: 'Choose the model (e.g. o4-mini, o3).', usage: 'codex --model o4-mini' },
+ { cmd: 'codex --provider <provider>', kind: 'cli', desc: 'Select the API provider (openai, azure, anthropic…).', usage: 'codex --provider openai' }
+ ]
+ }
+];