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

Merge PR #54 (Antigravity provider) into v0.2.3 + reconcile with codex

Chaitanya Girib5de0b0dfb48
diff --cc src/main/hive.ts
index 74aaa5cb,0c02ace0..6b656f94
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@@ -26,7 -27,7 +27,13 @@@ import { spawnSync } from 'node:child_p
import { randomBytes, createHash } from 'node:crypto';
import type { AgentUsageSample } from './usage';
import { COMMAND_GROUPS } from '../shared/claudeCommands';
- import { isClaudeProvider, type AgentProvider } from '../shared/agentProvider';
-import { isHiveAwareProvider, canReceiveInbox, providerPreset, type AgentProvider } from '../shared/agentProvider';
++import {
++ isClaudeProvider,
++ isHiveAwareProvider,
++ canReceiveInbox,
++ providerPreset,
++ type AgentProvider
++} from '../shared/agentProvider';
// ─── Types ──────────────────────────────────────────────────────────────────
@@@ -308,13 -288,38 +319,51 @@@ export class HiveManager
AGENT_DIR: dir
};
- // Non-Claude providers (e.g. Antigravity's `agy`) don't understand Claude
- // Code's flags or hook protocol — no telemetry, no `--settings` hooks, and
- // direct hive mail to them bounces to the god (router). But where the CLI
- // takes an INITIAL prompt (agy's `-i`), we still orient the session with the
- // same hive identity+protocol — the closest thing to `--append-system-prompt`
- // these CLIs offer (it's the first turn, then the session continues). This is
- // what makes a Gemini worker hive-aware without Claude installed at all.
+ const claudeProvider = isClaudeProvider(meta.provider ?? 'claude');
+
++ // Non-hive-aware providers (Antigravity's `agy`, OpenAI's `codex`) don't
++ // understand Claude Code's flags or hook protocol — no telemetry, no
++ // `--settings` hooks. But they DO take an INITIAL prompt to orient the
++ // session, so we still inject the same hive identity+protocol as the first
++ // turn — the closest thing to `--append-system-prompt` these CLIs offer
++ // (after the first turn the session continues normally). This is what makes
++ // a Gemini/Codex worker hive-aware without Claude installed at all.
++ //
++ // How the prompt rides in differs by CLI:
++ // - agy takes it under a flag (`agy -i "<prompt>"`) → push [flag, prompt].
++ // - codex takes it POSITIONALLY (`codex "<prompt>"`, no flag) → push the
++ // bare prompt as a trailing arg (node-pty passes argv literally, so it
++ // arrives as one positional argument after codex's own flags).
+ if (!isHiveAwareProvider(meta.provider)) {
- const flag = providerPreset(meta.provider ?? 'claude').initialPromptFlag;
- if (flag) {
- // agy DOES expose lifecycle hooks (PreToolUse/PostToolUse/Stop/…), just
- // with its own payload shape and config file. Install the bridge so a
- // Gemini worker gets the SAME live status + inbox-drain Claude does — on
- // the subscription, no SDK/API-key. The shim reads HIVE_SOCK + AGENT_ID.
++ const preset = providerPreset(meta.provider ?? 'claude');
++ const flag = preset.initialPromptFlag;
++ const prompt = this.injectedPrompt(meta, dir, root, opts.semanticMemory ?? false);
++ // Only agy exposes a Claude-compatible lifecycle-hook surface we can bridge
++ // (PreToolUse/PostToolUse/Stop/…). Install the agy-hook shim so a Gemini
++ // worker gets the SAME live status + inbox-drain Claude does — on the
++ // subscription, no SDK/API key. Codex has NO such hooks and cannot reuse the
++ // bridge, so it is NOT installed for codex; codex relies on the renderer's
++ // idle inbox-wake nudge to drain its inbox (see useHive.ts) and on its outbox
++ // being drained provider-agnostically by the router.
++ if (meta.provider === 'antigravity') {
+ const sock = this.sockPath();
+ if (sock) {
+ env.HIVE_SOCK = sock;
+ try { this.installAgyHooks(); } catch (e) { console.error('[hive] installAgyHooks failed:', e); }
+ }
- return { args: [flag, this.injectedPrompt(meta, dir, root, opts.semanticMemory ?? false)], env };
+ }
- return { args: [], env };
++ // Inject the protocol text whichever way the CLI accepts it. If a provider
++ // somehow exposes neither a flag nor a positional prompt, spawn bare.
++ if (flag) return { args: [flag, prompt], env };
++ // Positional initial prompt (codex). Append as a trailing argv element.
++ return { args: [prompt], env };
+ }
+
// Stage 7A — first-party Claude Code telemetry → the embedded loopback OTLP
// collector (telemetry.ts). Pure env, no --settings change. Only injected
- // once the collector is up (otelEndpoint set), so telemetry-off installs and
- // tests spawn exactly as before. http/json (no protobuf dep). The resource
- // attrs are the agent↔event join key the collector reads. NOTE: Claude Code
- // reads these at process start, so they apply only to NEW spawns — an agent
- // already running won't emit until respawned.
- if (this._otelEndpoint) {
+ // for Claude Code once the collector is up (otelEndpoint set), so telemetry-
+ // off installs and non-Claude providers spawn exactly as before.
+ if (claudeProvider && this._otelEndpoint) {
env.CLAUDE_CODE_ENABLE_TELEMETRY = '1';
env.OTEL_METRICS_EXPORTER = 'otlp';
env.OTEL_LOGS_EXPORTER = 'otlp';
@@@ -486,7 -488,9 +535,9 @@@
: '';
const godLine = meta.isGod
? 'You are the GOD / ORCHESTRATOR of this hive — your job is to ORCHESTRATE, not to implement: maintain live situational awareness and delegate the work. (1) AWARENESS — always know what is going on: keep an accurate picture of every agent (active vs archived/idle), the task board, and all in-flight work; drain your inbox continually and triage every other agent\'s requests, answering clarifications so the team runs autonomously. (2) DELEGATE — decompose work and fan it out to the hive agents via their inboxes (route messages and assign owners; do not do their jobs); do NOT take on grunt implementation yourself. (3) OWN ONLY THE IMPORTANT, high-leverage things — task decomposition, dispatch decisions, sign-offs, conflict resolution, branch integration, and final QA — and remain the sole scribe of board.md. You are otherwise fully autonomous — there is NO separate approval queue. For the genuinely critical (destructive actions, spending real money, scope changes, unresolvable conflicts), ask the human directly in your own session and let the tool-permission prompt gate the action; the human approves natively, including remotely from their phone via /remote-control. Keep the team unblocked. When you DISPATCH a task, write it as a 4-part contract so the agent can run autonomously: (1) OBJECTIVE — the concrete goal; (2) OUTPUT — the expected deliverable/format; (3) TOOLS — what to use or avoid, and any references to read instead of re-deriving; (4) BOUNDARIES — scope limits + the definition of done. Pass references (file paths, message ids, board sections), not pasted content — keep dispatches short.'
- + ` MONITOR the floor by reading ${root}/fleet.json (live per-agent tokens, cost, status, last tool, breaker level, inbox backlog) and ${root}/registry.json — note that running 'claude agents' will NOT list your hive's sibling agents. A full Claude Code command reference is at ${root}/COMMANDS.md (slash commands act ONLY on your own session; CLI commands run in your shell and can target the fleet). You periodically receive scheduler / "Heartbeat" standup requests — on each, review every agent via fleet.json, re-engage anyone stalled, over-budget, or breaker-armed, and keep board.md and tasks.json accurate. Steward the token budget.`
+ + ` MONITOR the floor by reading ${root}/fleet.json (live per-agent tokens, cost, status, last tool, breaker level, inbox backlog) and ${root}/registry.json — note that running 'claude agents' will NOT list your hive's sibling agents. A full Claude Code command reference is at ${root}/COMMANDS.md (slash commands act ONLY on your own session; CLI commands run in your shell and can target the fleet). You periodically receive scheduler / "Heartbeat" standup requests — on each, review every agent via fleet.json, re-engage anyone stalled, over-budget, or breaker-armed, and keep board.md and tasks.json accurate. In tasks.json, ALWAYS set each task's "assignee" to the worker's agent id the moment you dispatch it, and NEVER clear it on status changes — a done card must still say who did the work (the human reads the board by who-did-what). HUMAN FEEDBACK is first-class in the ledger: when a task can only proceed with the human's input — a QUESTION to answer OR an ACTION only the human can perform (create an account, approve a purchase, provide credentials/screenshots, test on their device) — set its status to "blocked" and append the concrete ask to the card's "humanQA" array (push {"q":"...","askedAt":"<iso>"}; phrase actions as clear to-dos; keep every past entry — the history documents the card's decisions). The harness surfaces open questions on the office floor's ASK ME board; the human's answer lands in the same entry ("a") AND arrives as an inbox message to you — read it, act on it, and unblock the card so work continues. Do NOT park human questions in separate files (no HumanQuestion.md) and never sit waiting on the human in your own session. Steward the token budget.`
+ : meta.isAssistant
+ ? 'You are Michael\'s PREP ASSISTANT. You will be handed short, possibly vague instructions (each begins with "ENRICH TASK:"). For each one: (1) figure out which project it concerns and cd into the most relevant repo — you start in Michael\'s home directory; (2) gather concrete context READ-ONLY (exact file paths, current state, relevant code, conventions, active branch, gotchas) — NEVER modify, create, or delete files; (3) rewrite the instruction into ONE clear, self-contained prompt that Michael can execute autonomously, preserving the user\'s original intent without inventing scope. Then deliver it: write ONE message JSON into your outbox with "to":"god", "act":"request", a short subject, and the finished prompt as the body. Do NOT perform the task yourself — your only output is the improved prompt sent to Michael.'
: 'For anything ambiguous, cross-cutting, or needing sign-off, address a message to "god".';
const guardrailsLine = 'Guardrails: a circuit breaker watches the floor — a "Circuit breaker: steer/constrain" message means you are looping or overspending, so STOP repeating, summarize what you tried, and follow it. Be token-frugal (a floor-wide or per-agent token budget can pause you). The shared plan has two parts: board.md (freeform; god is the sole scribe) and tasks.json (structured kanban — todo/doing/blocked/done).';
return [
@@@ -555,26 -559,44 +606,44 @@@
// at "human" is handled by the god/orchestrator, the human's proxy here.
const resolveTo = (to: string): string => (to === 'human' || to === 'god' ? godId : to);
const targets = msg.to === 'broadcast'
- // The roster for fan-out is the ACTIVE registry: skip non-Claude providers
- // without hook/protocol support, and any archived agent (closed tab) so mail
- // never piles into a dead inbox no one will read.
- ? Object.keys(reg.agents).filter((a) => {
- const agent = reg.agents[a];
- return a !== msg.from
- && !agent?.archived
- && isClaudeProvider(agent?.provider ?? 'claude');
- })
+ // The roster for fan-out is the ACTIVE registry: skip the send-only prep
+ // assistant, any archived agent (closed tab), and providers that can't
+ // drain an inbox (hookless custom commands) so mail never piles into a dead
- // inbox no one reads. Claude AND Antigravity workers ARE included — agy
- // drains its inbox via the agy-hook Stop→drain bridge.
++ // inbox no one reads. Claude, Codex AND Antigravity workers ARE included —
++ // each can drain its inbox: Claude via its Stop hook, Antigravity via the
++ // agy-hook Stop→drain bridge, Codex via the renderer's idle inbox-wake nudge.
+ ? Object.keys(reg.agents).filter((a) =>
+ a !== msg.from
+ && !reg.agents[a]?.isAssistant
+ && !reg.agents[a]?.archived
+ && canReceiveInbox(reg.agents[a]?.provider))
// Never deliver to self — guards a god → "human" message looping back to god.
: [resolveTo(msg.to)].filter((t) => t !== msg.from);
for (const t of targets) {
- const target = reg.agents[t];
- if (target && !isClaudeProvider(target.provider ?? 'claude')) {
- // Route non-Claude (e.g. Codex) agent tasks directly to their REPL
- // instead of bouncing. The renderer enqueues the raw text; the drain
- // effect types it into the agent's terminal when it next goes idle.
- // Codex gets no inbox nudge or /compact — only the task body verbatim.
- const text = [msg.subject, '', msg.body].filter(Boolean).join('\n');
- this.emit?.('hive:enqueueToAgent', { targetId: t, text });
- // Enforce the assistant's send-only contract AT THE ROUTER: it has no
- // composer, is excluded from the inbox-wake nudge, and never reads an
- // inbox — yet direct mail used to be delivered there anyway, where it
- // rotted unread (observed live: a task brief plus the follow-up
- // reprimand about the unread inbox, both unread for hours). Bounce such
- // mail to god instead, so the sender's intent surfaces immediately and
- // nothing is silently lost.
++ // The send-only prep assistant must never be a delivery target: it doesn't
++ // drain an inbox, so direct mail to it would rot unread (observed live: a
++ // task brief plus the follow-up reprimand about the unread inbox, both
++ // unread for hours). Bounce such mail to god instead, so the sender's intent
++ // surfaces immediately and nothing is silently lost.
+ if (reg.agents[t]?.isAssistant) {
+ this.deliver({
+ ...msg,
+ to: godId,
+ subject: `[bounced — "${t}" is the send-only prep assistant; route work to a real agent] ${msg.subject}`
+ }, godId);
+ continue;
+ }
+ // A provider with no way to drain its inbox (a hookless custom command)
+ // would let direct mail rot unread — bounce it to the god to relay as a
- // live prompt. Claude + Antigravity drain their inbox (Stop hook / agy-hook
- // bridge), so they receive directly. God is exempt (the bounce target).
++ // live prompt. Claude (Stop hook), Antigravity (agy-hook Stop→drain bridge)
++ // and Codex (renderer idle inbox-wake nudge) all drain their inbox, so they
++ // receive directly into their inbox/. God is exempt (the bounce target).
+ if (t !== godId && !canReceiveInbox(reg.agents[t]?.provider)) {
+ this.deliver({
+ ...msg,
+ to: godId,
+ subject: `[bounced — "${t}" runs ${reg.agents[t]?.provider ?? 'a hookless CLI'} and can't drain its hive inbox; relay this to it] ${msg.subject}`
+ }, godId);
continue;
}
this.deliver(msg, t);
diff --cc src/main/index.ts
index 1e9e85e2,85b10dc0..cf2918ad
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@@ -20,14 -19,13 +20,20 @@@ import type { UsageProvider } from './u
import { MemoryManager } from './memory';
import { MemoryReflector, type ReflectSettings } from './reflect';
import { PersistStore } from './db';
-import { enrichMessage } from './assistant';
import { readAgentUsage, readContextTokens } from './transcript';
import { listIssues, listCIRuns } from './github';
-import { SlackWebhookServer } from './slack';
+import { SlackWebhookServer, SlackReplyServer, postSlackReply } from './slack';
+import { WebhookServer, type WebhookInbound, type WebhookTaskStatus } from './webhook';
import { TelemetryCollector } from './telemetry';
import { ControlRegistry } from './control';
-import { inferAgentProvider, isClaudeProvider, providerPreset, type AgentProvider } from '../shared/agentProvider';
+import { ClosingTimeController } from './closingTime';
- import { inferAgentProvider, isClaudeProvider, nonInteractiveEnvForProvider, type AgentProvider } from '../shared/agentProvider';
++import {
++ inferAgentProvider,
++ isClaudeProvider,
++ nonInteractiveEnvForProvider,
++ providerPreset,
++ type AgentProvider
++} from '../shared/agentProvider';
const isDev = !!process.env.ELECTRON_RENDERER_URL;
const ptyManager = new PtyManager();
@@@ -922,9 -642,10 +928,14 @@@ ipcMain.handle('pty:spawn', async (_evt
if (!opts || typeof opts.id !== 'string' || typeof opts.cwd !== 'string' || typeof opts.command !== 'string') {
return { ok: false, error: 'invalid SpawnOptions' };
}
- // Which CLI is this? Explicit wins; else inferred from the binary (claude/agy).
- // Non-Claude providers skip every Claude-only spawn step below.
++ // Which CLI is this? Explicit wins; else inferred from the binary
++ // (claude/codex/agy). Non-Claude providers skip every Claude-only spawn step
++ // below. Persist the resolved provider onto opts (+ hive meta) so the registry
++ // record and downstream provider-aware steps agree on one value.
const provider = inferAgentProvider(opts.command, opts.provider ?? opts.hive?.provider);
+ const claudeProvider = isClaudeProvider(provider);
+ opts.provider = provider;
+ if (opts.hive) opts.hive = { ...opts.hive, provider };
// Git isolation: when requested and the cwd is a real repo, give this agent
// its own worktree on an `agent/<id>` branch so it can't clobber other agents'
// (or the user's) working tree. Best-effort — a failure falls back to the
@@@ -1003,15 -732,10 +1023,17 @@@
// Pre-accept Claude Code's bypass-mode warning + folder-trust dialog so the
// agent (spawned with --permission-mode bypassPermissions) doesn't stall on an
// interactive prompt it can't answer and exit code 1. Best-effort, never blocks.
- if (isClaudeProvider(provider)) {
+ // Claude-only — other CLIs handle their own permission UX.
+ if (claudeProvider) {
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.
++ // directory-trust gate via CODEX_NON_INTERACTIVE). 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 --cc src/preload/index.ts
index de28ddb3,829d6f0c..bf948ecc
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@@ -7,11 -4,13 +7,14 @@@ declare const __APP_VERSION__: string
export interface HiveAgentMeta {
id: string;
name: string;
- /** Which CLI this agent runs on (claude/antigravity/custom); defaults claude. */
++ /** Which CLI this agent runs on (claude/codex/antigravity/custom); defaults claude. */
provider?: AgentProvider;
role?: string;
capabilities?: string[];
cwd: string;
isGod?: boolean;
++ /** Michael's prep assistant — send-only; enriches prompts and forwards them. */
+ isAssistant?: boolean;
}
export interface HiveMessage {
diff --cc src/renderer/src/components/AddAgentModal.tsx
index a779f3ed,04ac6eeb..8ab67e64
--- a/src/renderer/src/components/AddAgentModal.tsx
+++ b/src/renderer/src/components/AddAgentModal.tsx
@@@ -7,14 -7,16 +7,16 @@@ import { useStore, type Agent } from '@
import { OFFICE_CAST, DEFAULT_CHARACTER, type OfficeCharacterName } from '@/scene/office/cast';
import { type AccentColorName } from '@/design/tokens';
import {
- type HarnessConfig,
type AgentProvider,
+ type HarnessConfig,
- AGENT_MODELS,
+ AGENT_PROVIDER_PRESETS,
buildSpawnCommand,
+ tokenizeCommand,
+ modelsForProvider,
inferAgentProvider,
+ providerPreset,
isClaudeProvider
} from '@/store/config';
-import { AGENT_PROVIDER_PRESETS } from '@shared/agentProvider';
const ACCENTS: AccentColorName[] = ['coral', 'mint', 'sky', 'lemon', 'lilac', 'peach'];
@@@ -51,17 -56,16 +56,21 @@@ export function AddAgentModal({ onClose
setModel(id);
setCommand(buildSpawnCommand(config, id, provider));
};
-
+ // Switching provider resets the model to that CLI's default and rebuilds the
- // command from the provider's preset binary (so Antigravity spawns `agy`, not
- // the configured `claude`).
++ // command from the provider's preset binary (so Antigravity spawns `agy` and
++ // Codex spawns `codex`, not the configured `claude`). For 'custom' we keep the
++ // user's typed command rather than blanking it.
const pickProvider = (id: AgentProvider) => {
setProvider(id);
const nextModel = isClaudeProvider(id) ? config.defaultModel : undefined;
setModel(nextModel);
+ if (id === 'custom') {
+ setCommand(command.trim() || config.defaultCommand || '');
+ return;
+ }
setCommand(buildSpawnCommand(config, nextModel, id));
};
+ const preset = providerPreset(provider);
const [goal, setGoal] = useState('');
const [isolate, setIsolate] = useState(false);
const [error, setError] = useState<string | undefined>();
@@@ -83,8 -87,10 +92,10 @@@
setBusy(true);
const id = uniqueId(name);
const ptyId = `pty-${id}`;
- // The command field contains `claude --permission-mode bypassPermissions`
- // for auto mode. Split into argv-style for node-pty (quote-aware so an agy
- // model label like "Gemini 3.1 Pro (High)" stays one argument).
+ // Split the editable command field into argv-style pieces for node-pty.
- const [exe, ...args] = command.trim().split(/\s+/);
++ // Quote-aware so an agy model label like "Gemini 3.1 Pro (High)" — or any
++ // auto-mode flags appended to the command — stays one argument.
+ const [exe, ...args] = tokenizeCommand(command.trim());
const spawnRes = await window.cth.spawnPty({
id: ptyId,
cwd,
@@@ -210,7 -216,13 +221,15 @@@
<button
key={p.id}
onClick={() => pickProvider(p.id)}
- title={p.id === 'codex' ? 'Spawn codex without Claude-only flags' : p.label}
+ title={
+ p.id === 'antigravity'
+ ? 'Spawn the Antigravity CLI (agy) with a Gemini model'
- : p.id === 'custom'
- ? 'Run any command — no Claude-only flags'
- : p.label
++ : p.id === 'codex'
++ ? 'Spawn the Codex CLI (codex) without Claude-only flags'
++ : p.id === 'custom'
++ ? 'Run any command — no Claude-only flags'
++ : p.label
+ }
style={{
padding: '3px 8px 1px',
background: active ? `var(--cth-${accent}-light)` : 'var(--cth-cream-100)',
@@@ -258,7 -270,7 +277,15 @@@
<input
value={command}
onChange={(e) => setCommand(e.target.value)}
- placeholder={provider === 'codex' ? 'codex' : provider === 'custom' ? 'your-agent-cli' : 'claude'}
- placeholder={provider === 'antigravity' ? 'agy' : provider === 'custom' ? 'your-agent-cli' : 'claude'}
++ placeholder={
++ provider === 'antigravity'
++ ? 'agy'
++ : provider === 'codex'
++ ? 'codex'
++ : provider === 'custom'
++ ? 'your-agent-cli'
++ : 'claude'
++ }
style={{ ...inputStyle, fontFamily: 'var(--cth-font-mono)' }}
/>
</Row>
diff --cc src/renderer/src/components/AgentStrip.tsx
index df17eb96,3c66f0f8..eff7a457
--- a/src/renderer/src/components/AgentStrip.tsx
+++ b/src/renderer/src/components/AgentStrip.tsx
@@@ -3,7 -3,7 +3,7 @@@ import { AgentCard } from './AgentCard'
import { PixelButton } from './PixelButton';
import { Icon } from './Icon';
import { useStore, type Agent } from '@/store/store';
- import { buildSpawnCommand, inferAgentProvider, type HarnessConfig } from '@/store/config';
-import { buildSpawnCommand, tokenizeCommand, type HarnessConfig } from '@/store/config';
++import { buildSpawnCommand, inferAgentProvider, tokenizeCommand, type HarnessConfig } from '@/store/config';
export interface AgentStripProps {
/** Needed to rebuild a spawn command when a restorable agent predates the
@@@ -51,10 -28,9 +51,10 @@@ export function AgentStrip({ config }:
const prevSel = useStore.getState().selectedId;
try {
for (const a of [...restorableAgents]) {
- const command = (a.command ?? '').trim() || (config ? buildSpawnCommand(config, a.model) : '');
+ const provider = inferAgentProvider(a.command, a.provider);
+ const command = (a.command ?? '').trim() || (config ? buildSpawnCommand(config, a.model, provider) : '');
if (!command || !a.cwd) { useStore.getState().removeRestorableAgent(a.id); continue; }
- const [exe, ...args] = command.split(/\s+/);
+ const [exe, ...args] = tokenizeCommand(command);
const ptyId = a.ptyId ?? `pty-${a.id}`;
const res = await window.cth.spawnPty({
id: ptyId,
diff --cc src/renderer/src/components/CommandCenterPanel.tsx
index 5e33a759,222ba817..ca818847
--- a/src/renderer/src/components/CommandCenterPanel.tsx
+++ b/src/renderer/src/components/CommandCenterPanel.tsx
@@@ -14,7 -13,7 +14,7 @@@ import { useFleetTelemetry } from '@/ho
import { COMMAND_GROUPS } from '@shared/claudeCommands';
import { useStore, type Agent } from '@/store/store';
import { usePtyParser } from '@/hooks/usePtyParser';
- import { buildSpawnCommand, AGENT_MODELS, inferAgentProvider, isClaudeProvider } from '@/store/config';
-import { buildSpawnCommand, AGENT_MODELS, modelsForProvider, tokenizeCommand, inferAgentProvider, isClaudeProvider } from '@/store/config';
++import { buildSpawnCommand, modelsForProvider, tokenizeCommand, inferAgentProvider, isClaudeProvider } from '@/store/config';
/** Michael's control surface. Shown instead of the plain terminal/files panel
* when the god agent is selected: terminal + queue, the floor roster (with
@@@ -304,13 -297,17 +304,18 @@@ function FloorTab({ seed }: { seed: { t
const cfg = await window.cth.getConfig();
await window.cth.killPty(a.ptyId);
disposeTerminal(a.ptyId);
+ // Respawn on the same CLI this agent already runs on (inferred from its
- // command if not explicitly tagged) so an Antigravity worker stays `agy`.
++ // command if not explicitly tagged) so an Antigravity/Codex worker stays
++ // on its own binary. tokenizeCommand keeps quoted model labels one arg.
const provider = inferAgentProvider(a.command, a.provider);
const command = buildSpawnCommand(cfg, model, provider);
- const [exe, ...args] = command.trim().split(/\s+/);
+ const [exe, ...args] = tokenizeCommand(command.trim());
const hive = a.isGod
- ? { id: a.id, name: a.name, provider, cwd: a.cwd, isGod: true, role: 'orchestrator (god)' }
- : { id: a.id, name: a.name, provider, cwd: a.cwd, role: a.description };
- const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, provider, args, cols: 100, rows: 30, hive });
+ ? { id: a.id, name: a.name, cwd: a.cwd, provider, isGod: true, role: 'orchestrator (god)' }
+ : a.isAssistant
+ ? { id: a.id, name: a.name, cwd: a.cwd, provider, isAssistant: true, role: "Michael's prep assistant" }
+ : { id: a.id, name: a.name, cwd: a.cwd, provider, role: a.description };
+ const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, args, provider, cols: 100, rows: 30, hive });
if (res.ok) updateAgent(a.id, { command: command.trim(), provider, model, status: 'idle', action: 'restarting…' });
} catch { /* noop */ } finally {
setRestarting(null);
@@@ -537,13 -533,13 +542,17 @@@
))}
</Select>
<span style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>
- {restarting === a.id ? 'restarting…' : 'model (restarts agent)'}
+ {restarting === a.id
+ ? 'restarting…'
+ : isClaudeProvider(inferAgentProvider(a.command, a.provider))
+ ? 'model (restarts agent)'
+ : `${inferAgentProvider(a.command, a.provider)} · model (restarts agent)`}
</span>
- </div>
+ </div> : (
+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>
+ provider: {inferAgentProvider(a.command, a.provider)}
+ </div>
+ )}
</div>
);
})}
diff --cc src/renderer/src/hooks/useHive.ts
index f371899e,eaba49b7..b1573df5
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@@ -1,11 -1,6 +1,12 @@@
import { useEffect, useRef } from 'react';
-import { useStore, type Agent, type StationKind, type ToolKind } from '@/store/store';
-import { buildSpawnCommand, ASSISTANT_MODEL, inferAgentProvider, isClaudeProvider, type HarnessConfig } from '@/store/config';
+import { useStore, type Agent, type QueuedMessage, type StationKind, type ToolKind } from '@/store/store';
+import {
+ buildSpawnCommand,
++ ASSISTANT_MODEL,
+ inferAgentProvider,
+ isClaudeProvider,
+ type HarnessConfig
+} from '@/store/config';
const GOD_ID = 'god';
const GOD_PTY = `pty-${GOD_ID}`;
@@@ -498,6 -540,8 +522,8 @@@ export function useHive(config: Harness
const { agents, messageQueues, enqueueMessage } = useStore.getState();
for (const a of agents) {
if (!a.ptyId) continue;
- // /compact is a Claude Code slash command — non-Claude CLIs (agy) would
- // just receive it as literal prompt text. Skip them.
++ // /compact is a Claude Code slash command — non-Claude CLIs (agy, codex)
++ // would just receive it as literal prompt text. Skip them.
if (!isClaudeProvider(inferAgentProvider(a.command, a.provider))) continue;
const queued = messageQueues[a.id] ?? [];
if (queued.some((m) => m.text.trimStart().startsWith('/compact'))) continue;
diff --cc src/renderer/src/store/config.ts
index 95925b52,4bf9f81a..bac031f1
--- a/src/renderer/src/store/config.ts
+++ b/src/renderer/src/store/config.ts
@@@ -1,9 -1,9 +1,8 @@@
// Mirrors src/main/config.ts. Kept as a renderer-side type-only module
// so we don't have to reach into the preload package to type-check.
-
import {
AGENT_PROVIDER_PRESETS,
- autoModeFlagForProvider,
- defaultCommandForProvider,
+ providerPreset,
inferAgentProvider,
isClaudeProvider,
type AgentProvider
@@@ -97,11 -134,20 +133,25 @@@ export function buildSpawnCommand
model?: string,
provider: AgentProvider = inferAgentProvider(config.defaultCommand)
): string {
- const base = isClaudeProvider(provider)
- ? config.defaultCommand || defaultCommandForProvider(provider)
- : defaultCommandForProvider(provider, config.defaultCommand || '') || config.defaultCommand || '';
- const withModel = isClaudeProvider(provider) && model ? `${base} --model ${model}` : base;
- if (!config.autoMode) return withModel;
- const flag = autoModeFlagForProvider(provider);
- return flag ? `${withModel} ${flag}` : withModel;
+ const preset = providerPreset(provider);
++ // Claude keeps the user's configured defaultCommand; custom falls back to it
++ // too; every other provider (codex, agy) uses its preset binary so the app
++ // works even without Claude installed.
+ const base =
+ provider === 'claude'
+ ? config.defaultCommand || preset.defaultCommand
+ : provider === 'custom'
+ ? config.defaultCommand || ''
+ : preset.defaultCommand;
+ let cmd = base;
+ if (preset.supportsModel && model && preset.modelFlag) {
+ // Quote model values that contain whitespace (agy labels like
+ // "Gemini 3.1 Pro (High)") so the command tokenizer keeps them one arg.
+ const m = /\s/.test(model) ? `"${model}"` : model;
+ cmd = `${cmd} ${preset.modelFlag} ${m}`;
+ }
++ // Auto (skip-permissions) mode appends each provider's own flag — Claude's
++ // bypassPermissions, codex's `-a never -s workspace-write`, agy's skip flag.
+ if (config.autoMode && preset.autoFlag) cmd = `${cmd} ${preset.autoFlag}`;
+ return cmd;
}
diff --cc src/renderer/src/store/store.ts
index d44f7d35,24f80495..ccaa1204
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@@ -49,18 -49,22 +49,23 @@@ export interface Agent
blockReason?: BlockReason;
/** present iff this agent has a real PTY in the main process */
ptyId?: string;
- /** the command being run in the PTY (e.g. 'claude') */
+ /** the command being run in the PTY (e.g. 'claude' or 'agy') */
command?: string;
- /** which agent CLI preset owns this PTY recipe */
- /** which CLI this agent runs on; drives the model picker + spawn flags.
- * Defaults to 'claude' when unset (legacy agents / inferred from command). */
++ /** which agent CLI preset owns this PTY recipe; drives the model picker +
++ * spawn flags. Defaults to 'claude' when unset (legacy agents / inferred
++ * from command). */
provider?: AgentProvider;
- /** the model this agent runs on (e.g. 'claude-sonnet-4-6[1m]'); drives the
- * model selector + the --model arg used when (re)spawning the agent */
+ /** the model this agent runs on (e.g. 'claude-sonnet-4-6[1m]' or 'gemini-3-pro');
+ * drives the model selector + the --model arg used when (re)spawning the agent */
model?: string;
/** the last prompt the user submitted to this agent in Claude Code —
* shown on the floor as a card above the seated avatar */
lastPrompt?: string;
/** the orchestrator ("god") agent — seated in Michael's room, runs the floor */
isGod?: boolean;
- /** Michael's prep assistant ("Dwight") — enriches prompts and forwards them to
- * Michael via the hive. Send-only: never receives inbox/broadcast mail. */
++ /** Michael's prep assistant — send-only; enriches prompts and forwards them to
++ * the god. Excluded from broadcast fan-out and from the restorable-dead sweep. */
+ isAssistant?: boolean;
/** When git isolation is enabled, the dedicated worktree path the agent runs
* in (its own `agent/<id>` branch); undefined for shared-cwd agents. */
worktreePath?: string;
@@@ -488,10 -473,10 +493,10 @@@ export const useStore = create<State>((
const agents = s.agents.filter((a) => !a.ptyId || live.has(a.ptyId));
if (agents.length === s.agents.length) return s;
// Workers whose terminal died with the previous session become restorable
- // (full spawn recipe retained) instead of silently vanishing. God is excluded
- // — auto-respawns at boot.
+ // (full spawn recipe retained) instead of silently vanishing. God and the
- // assistant are excluded — they auto-respawn at boot.
++ // prep assistant are excluded — they auto-respawn at boot.
const dead = s.agents.filter(
- (a) => a.ptyId && !live.has(a.ptyId) && !a.isGod
+ (a) => a.ptyId && !live.has(a.ptyId) && !a.isGod && !a.isAssistant
);
const restorableAgents = [
...s.restorableAgents.filter((r) => !dead.some((d) => d.id === r.id)),
diff --cc src/shared/agentProvider.ts
index d83ebbc9,7d3d63d2..8c847521
--- a/src/shared/agentProvider.ts
+++ b/src/shared/agentProvider.ts
@@@ -1,19 -1,48 +1,65 @@@
+ /**
+ * Agent providers — the CLI a worker runs on. The app is no longer Claude-only:
- * a worker can run Claude Code or the Antigravity CLI (`agy`, Gemini models), or
- * any custom command. Each provider declares how to build its spawn command
- * (model flag, auto-mode flag) and whether it accepts the hive's Claude-specific
- * identity injection (`--append-system-prompt` + `--settings`).
++ * a worker can run Claude Code, the OpenAI Codex CLI (`codex`), or the
++ * Antigravity CLI (`agy`, Gemini models), or any custom command. Each provider
++ * declares how to build its spawn command (model flag, auto-mode flag) and
++ * whether it accepts the hive's Claude-specific identity injection
++ * (`--append-system-prompt` + `--settings`).
+ *
+ * Shared between main and renderer; keep it dependency-free (no electron, no UI).
+ * Mirrors the shape of the upstream provider-preset work (PR #47 / issue #21) so
- * the two reconcile cleanly — this build adds the `antigravity` preset.
++ * the two reconcile cleanly — this build adds the `antigravity` preset alongside
++ * the existing `codex` preset.
+ */
+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 type AgentProvider = 'claude' | 'antigravity' | 'custom';
++export type AgentProvider = 'claude' | 'codex' | 'antigravity' | 'custom';
export interface AgentProviderPreset {
id: AgentProvider;
label: string;
+ /** The binary spawned when the user hasn't typed a custom command. */
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. */
++ /** Flag(s) appended to the command string when auto mode is active.
++ * Kept alongside `autoFlag` (same value) for the HEAD consumers that read
++ * `autoModeFlag` via `autoModeFlagForProvider`. */
+ autoModeFlag: string;
+ /** Show a model picker and splice the model into the command. */
+ supportsModel: boolean;
+ /** Flag that selects the session model, e.g. `--model`. */
+ modelFlag?: string;
- /** Flag appended when the floor is in auto (skip-permissions) mode. */
++ /** Flag appended when the floor is in auto (skip-permissions) mode.
++ * PR #54 consumers read this; mirrors `autoModeFlag`. */
+ autoFlag?: string;
+ /** Claude Code accepts the hive identity injection (`--append-system-prompt`
+ * + hook `--settings`). Other CLIs don't — they spawn with the shared AGENT_*
+ * env only. Gates the Claude-specific spawn injection in hive.ensureAgent. */
+ hiveAware: boolean;
+ /** Whether the router may DELIVER inbox mail to this provider (vs bouncing it
+ * to the god). Requires a way for the agent to actually drain its inbox: Claude
- * via its Stop hook, Antigravity via the agy-hook bridge's Stop→drain. A
- * provider with no hook surface (custom) can't, so its mail still bounces.
- * Distinct from hiveAware: agy is NOT hiveAware (no Claude injection) but CAN
- * receive inbox (it has the bridged Stop-drain hook). */
++ * via its Stop hook, Antigravity via the agy-hook bridge's Stop→drain, Codex
++ * via the renderer's idle inbox-wake nudge (no hook surface of its own). A
++ * provider with no inbox-drain path (custom) can't, so its mail still bounces.
++ * Distinct from hiveAware: agy/codex are NOT hiveAware (no Claude injection)
++ * but CAN receive inbox. */
+ canReceiveInbox: boolean;
+ /** For non-hive-aware CLIs that still take an INITIAL prompt to orient the
+ * session (Antigravity's `agy -i "<prompt>"`), the flag to pass it under. The
+ * hive identity+protocol rides in as the first turn — the closest thing to
- * Claude's `--append-system-prompt` these CLIs offer. undefined = no way in. */
++ * Claude's `--append-system-prompt` these CLIs offer. undefined = the CLI
++ * takes its initial prompt POSITIONALLY (Codex: `codex "<prompt>"`) and the
++ * injection branch appends it as a quoted trailing arg instead of a flag. */
+ initialPromptFlag?: string;
+ /** Flag to resume a prior session on respawn, given the recorded session id
+ * (Claude `--resume <sid>`, Antigravity `--conversation <id>`). undefined = no
+ * resume support, spawn fresh. */
+ resumeFlag?: string;
}
export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [
@@@ -21,32 -50,37 +67,77 @@@
id: 'claude',
label: 'Claude Code',
defaultCommand: 'claude',
+ commandGroups: CLAUDE_COMMAND_GROUPS,
- autoModeFlag: '--permission-mode bypassPermissions'
++ autoModeFlag: '--permission-mode bypassPermissions',
+ supportsModel: true,
+ modelFlag: '--model',
+ autoFlag: '--permission-mode bypassPermissions',
+ hiveAware: true,
+ canReceiveInbox: true,
+ resumeFlag: '--resume'
},
+ {
+ id: 'codex',
+ label: 'Codex',
+ defaultCommand: 'codex',
+ commandGroups: CODEX_COMMAND_GROUPS,
+ // -a never: never prompt for approval; -s workspace-write: sandbox scoped to
+ // the workspace (no outbound network). Matches the non-interactive intent of
+ // Claude's bypassPermissions while retaining a safety boundary.
+ autoModeFlag: '-a never -s workspace-write',
++ autoFlag: '-a never -s workspace-write',
+ // Suppresses first-run interactive prompts (directory-trust gate, installer).
- nonInteractiveEnv: { CODEX_NON_INTERACTIVE: '1' }
++ nonInteractiveEnv: { CODEX_NON_INTERACTIVE: '1' },
++ supportsModel: true,
++ modelFlag: '--model',
++ // Codex is NOT hiveAware: it has no Claude `--append-system-prompt`/`--settings`
++ // hook surface. The hive protocol is injected as Codex's INITIAL prompt, which
++ // it takes POSITIONALLY (`codex "<prompt>"`) — hence initialPromptFlag is
++ // undefined and hive.ts appends the prompt as a quoted trailing arg.
++ hiveAware: false,
++ // Codex can receive inbox: it has no Stop hook, but the renderer's idle
++ // inbox-wake nudge types the "you have new inbox mail" line into idle Codex
++ // PTYs (same path as agy), so mail is delivered rather than bounced to god.
++ canReceiveInbox: true,
++ initialPromptFlag: undefined,
++ // Codex has no stable session-resume CLI flag in the curated reference; spawn
++ // fresh on respawn (the protocol is re-injected as the initial prompt anyway).
++ resumeFlag: undefined
++ },
+ {
+ id: 'antigravity',
+ label: 'Antigravity · Gemini',
+ defaultCommand: 'agy',
++ commandGroups: [],
++ autoModeFlag: '--dangerously-skip-permissions',
+ supportsModel: true,
+ modelFlag: '--model',
+ autoFlag: '--dangerously-skip-permissions',
+ hiveAware: false,
+ canReceiveInbox: true, // via the agy-hook bridge (Stop→drain); verified agy honors hook decisions
+ initialPromptFlag: '-i', // agy --prompt-interactive: orient the session, then continue
+ resumeFlag: '--conversation' // agy: resume a previous conversation by ID
},
{
id: 'custom',
label: 'Custom',
defaultCommand: '',
+ commandGroups: [],
- autoModeFlag: ''
++ autoModeFlag: '',
+ supportsModel: false,
++ autoFlag: '',
+ hiveAware: false,
- canReceiveInbox: false // no hook surface to drain an inbox → mail bounces to the god
++ canReceiveInbox: false // no inbox-drain path → mail bounces to the god
}
];
export function isAgentProvider(value: unknown): value is AgentProvider {
- return value === 'claude' || value === 'codex' || value === 'custom';
- return value === 'claude' || value === 'antigravity' || value === 'custom';
++ return (
++ value === 'claude' ||
++ value === 'codex' ||
++ value === 'antigravity' ||
++ value === 'custom'
++ );
}
export function normalizeAgentProvider(value: unknown): AgentProvider | undefined {
@@@ -57,37 -95,38 +152,54 @@@ export function isClaudeProvider(provid
return provider === 'claude';
}
+ /** Whether this provider takes the hive's Claude-only identity injection. */
+ export function isHiveAwareProvider(provider: AgentProvider | undefined): boolean {
+ return providerPreset(provider ?? 'claude').hiveAware;
+ }
+
+ /** Whether the router may deliver inbox mail to this provider (else bounce to
+ * the god). True for any provider that can actually drain its inbox — Claude
- * and Antigravity (via the agy-hook Stop→drain bridge); false for hookless
- * custom commands. */
++ * (Stop hook), Antigravity (agy-hook Stop→drain bridge) and Codex (renderer
++ * idle inbox-wake nudge); false for hookless custom commands. */
+ export function canReceiveInbox(provider: AgentProvider | undefined): boolean {
+ return providerPreset(provider ?? 'claude').canReceiveInbox;
+ }
+
+ /** The bare executable from a command string ('agy --model x' → 'agy'). */
function commandBinary(command: string | undefined): string {
const first = (command ?? '').trim().split(/\s+/)[0] ?? '';
- const base = first.split(/[\\/]/).pop() ?? first;
- return base.replace(/\.(cmd|exe)$/i, '').toLowerCase();
+ // strip a path + extension so 'C:\...\agy.exe' and '/usr/bin/claude' both map
+ const leaf = first.split(/[\\/]/).pop() ?? first;
+ return leaf.replace(/\.(exe|cmd|bat|ps1)$/i, '').toLowerCase();
}
+ /** Infer the provider from a command (or honor an explicit override). */
export function inferAgentProvider(command: string | undefined, explicit?: unknown): AgentProvider {
const normalized = normalizeAgentProvider(explicit);
if (normalized) return normalized;
const bin = commandBinary(command);
+ if (bin === 'codex') return 'codex';
+ if (bin === 'agy' || bin === 'antigravity') return 'antigravity';
if (bin === 'claude' || !bin) return 'claude';
return 'custom';
}
export function defaultCommandForProvider(provider: AgentProvider, fallback = ''): string {
if (provider === 'custom') return fallback;
- return AGENT_PROVIDER_PRESETS.find((p) => p.id === provider)?.defaultCommand ?? fallback;
+ return providerPreset(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 ?? '';
++ return providerPreset(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 ?? {};
++ return providerPreset(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 ?? [];
++ return providerPreset(provider).commandGroups ?? [];
+}