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(realtime): de-monetize agent chrome + voice persona (Tasks A+B) — hide $/silence cost, cap guard intact

Chaitanya Giri12cac15d1dea
diff --git a/src/main/realtimeActions.ts b/src/main/realtimeActions.ts
index 3fba8580..21a02849 100644
--- a/src/main/realtimeActions.ts
+++ b/src/main/realtimeActions.ts
@@ -37,7 +37,6 @@
import { ipcMain } from 'electron';
import type { HiveMessage, HiveTask, Registry } from './hive';
import type { ScheduledMission } from './config';
-import { spawnCostSpoken } from './realtimeCost';
export const VOICE_ACTOR = 'michael-voice';
@@ -437,8 +436,9 @@ function proposeDestructive(deps: RealtimeActionDeps, verb: string, a: Record<st
return {
ok: true,
needsConfirm: true,
- // Real spawn cost estimate from Oscar's rt-9 cost engine (replaces the rt-5 stub).
- spoken: `You want to hire a new ${provider} agent${role ? ` as ${role}` : ''}, named ${name}. That will cost ${spawnCostSpoken(provider, str(a.model) || undefined)}. To hire, say "confirm" or "spawn". Say "cancel" to stop.`
+ // Spawn/hire is gated behind a verbal echo-back confirm. No cost is quoted —
+ // the orchestrator persona does not surface money to the user.
+ spoken: `You want to hire a new ${provider} agent${role ? ` as ${role}` : ''}, named ${name}. To hire, say "confirm" or "spawn". Say "cancel" to stop.`
};
}
diff --git a/src/main/realtimeCost.ts b/src/main/realtimeCost.ts
index 5521c682..08d39150 100644
--- a/src/main/realtimeCost.ts
+++ b/src/main/realtimeCost.ts
@@ -1,67 +1,11 @@
/**
- * Realtime Michael — main-process cost module (card rt-9, cost-guard).
+ * Realtime Michael — main-process cost helpers (card rt-9, cost-guard).
*
- * Two jobs, both consumed by Kevin's core files via a clean import (no edits from
- * me to those files — rt-9 ships net-new only):
- *
- * 1. spawnCostSpoken() — the REAL $/hour estimate that replaces rt-5's stub in
- * src/main/realtimeActions.ts. The spawn-confirm flow speaks it back before
- * hiring an agent. Reuses the existing per-model price table (./pricing) so
- * the figure tracks the same rates the cost-ledger uses.
- * 2. re-exports the shared realtime audio cost helpers so a main-side caller can
- * price a realtime usage delta without reaching into ../shared directly.
- *
- * The LIVE session meter + spend cap live in the renderer (where the voice
- * session and its usage events are) — see src/renderer/src/realtime/costStore.ts.
- */
-import { priceFor } from './pricing';
-import { computeRealtimeUsd, formatUsd, type RealtimeUsage } from '../shared/realtimePricing';
-
-export { computeRealtimeUsd, formatUsd, type RealtimeUsage };
-
-/**
- * Rough token throughput of an actively-working coding agent, per wall-clock hour.
- * A heuristic — real usage swings hugely with the task — used only to turn the
- * per-model price into a spoken ballpark for the spawn/hire confirm. Tuned to a
- * busy agent (lots of file reads → big cached-input share).
- */
-const AGENT_TOKENS_PER_HOUR = {
- inputTokens: 200_000,
- outputTokens: 40_000,
- cacheReadTokens: 400_000,
- cacheWriteTokens: 60_000
-};
-
-/** Provider → a representative model id when the caller didn't name one, so
- * priceFor() lands on a sensible family. Non-Claude providers fall through to the
- * table's Sonnet default (a rough proxy — the estimate is explicitly a ballpark). */
-const PROVIDER_DEFAULT_MODEL: Record<string, string> = {
- claude: 'claude-opus-4-8',
- codex: 'gpt',
- antigravity: 'gemini',
- gemini: 'gemini'
-};
-
-/** Estimated USD/hour to RUN a freshly-spawned agent on the given provider/model. */
-export function estimateSpawnCostUsdPerHour(provider: string, model?: string): number {
- const m = (model && model.trim()) || PROVIDER_DEFAULT_MODEL[provider.toLowerCase()] || '';
- const p = priceFor(m);
- const t = AGENT_TOKENS_PER_HOUR;
- return (
- (t.inputTokens / 1_000_000) * p.inputPerM +
- (t.outputTokens / 1_000_000) * p.outputPerM +
- (t.cacheReadTokens / 1_000_000) * p.cacheReadPerM +
- (t.cacheWriteTokens / 1_000_000) * p.cacheWritePerM
- );
-}
-
-/**
- * A spoken phrase for the spawn/hire echo-back confirm, e.g.
- * "about $6.50 an hour while it runs". Drop-in replacement for rt-5's stub string
- * in realtimeActions.ts (the spawn branch): just interpolate this where the stub
- * said "roughly a few dollars an hour".
+ * Re-exports the shared realtime audio cost helpers so a main-side caller can price
+ * a realtime usage delta without reaching into ../shared directly. These feed the
+ * cost cap (the runaway guard), which still fires silently — money is no longer
+ * surfaced to the user or spoken by the orchestrator, so the spawn/hire $-estimate
+ * that used to live here has been removed (de-monetize). The LIVE session meter +
+ * spend cap live in the renderer — see src/renderer/src/realtime/costStore.ts.
*/
-export function spawnCostSpoken(provider: string, model?: string): string {
- const perHour = estimateSpawnCostUsdPerHour(provider, model);
- return `about ${formatUsd(perHour)} an hour while it runs (a rough estimate)`;
-}
+export { computeRealtimeUsd, formatUsd, type RealtimeUsage } from '../shared/realtimePricing';
diff --git a/src/renderer/src/realtime/CostHud.tsx b/src/renderer/src/realtime/CostHud.tsx
index d0d1a378..bc9982ef 100644
--- a/src/renderer/src/realtime/CostHud.tsx
+++ b/src/renderer/src/realtime/CostHud.tsx
@@ -76,23 +76,27 @@ export function CostHud({ compact = false }: CostHudProps): React.ReactElement |
const near = capUsd != null && !overCap && ratio >= WARN_RATIO;
const meterColor = overCap ? 'var(--cth-danger, #c0392b)' : near ? 'var(--cth-warn, #b8860b)' : 'var(--cth-ink-900)';
- // Compact: a glanceable $ chip next to the toggle, only while a session runs.
+ // Compact: a glanceable TOKEN chip next to the voice toggle, only while a session
+ // runs. Money is intentionally NOT surfaced in the agent chrome — the spend cap
+ // still fires silently (see the cost guard in session.ts); the agent chrome shows
+ // token usage only.
if (compact) {
if (!live) return null;
+ const totalTok = inputTokens + outputTokens;
+ const tokLabel = totalTok >= 1000 ? `${(totalTok / 1000).toFixed(1)}k` : String(totalTok);
return (
<span
- title={capUsd != null ? `${formatUsd(usd)} of ${formatUsd(capUsd)} cap this voice session` : `${formatUsd(usd)} this voice session`}
+ title={`${totalTok.toLocaleString()} voice audio tokens this session`}
style={{
fontFamily: 'var(--cth-font-mono)',
fontSize: 12,
fontWeight: 600,
- color: meterColor,
+ color: 'var(--cth-ink-900)',
flexShrink: 0,
whiteSpace: 'nowrap'
}}
>
- {formatUsd(usd)}
- {overCap ? ' ⚠' : ''}
+ {tokLabel} tok
</span>
);
}
diff --git a/src/renderer/src/realtime/actions.ts b/src/renderer/src/realtime/actions.ts
index 5ae8c37f..5c444dfb 100644
--- a/src/renderer/src/realtime/actions.ts
+++ b/src/renderer/src/realtime/actions.ts
@@ -183,7 +183,7 @@ export function realtimeActionTools(): ReturnType<typeof tool>[] {
tool({
name: 'spawn_agent',
description:
- 'Hire a NEW agent worker (provider engine + optional role). EXPENSIVE — this does NOT run immediately; it returns a spoken cost estimate and asks for verbal confirmation. After the user confirms, call confirm_action.',
+ 'Hire a NEW agent worker (provider engine + optional role). This does NOT run immediately; it asks for verbal confirmation first. After the user confirms, call confirm_action.',
parameters: {
type: 'object',
properties: {
diff --git a/src/renderer/src/realtime/session.ts b/src/renderer/src/realtime/session.ts
index eea1d89a..9b0bb8f1 100644
--- a/src/renderer/src/realtime/session.ts
+++ b/src/renderer/src/realtime/session.ts
@@ -65,7 +65,7 @@ const MICHAEL_PERSONA =
VOICE & STYLE. You speak out loud over a live connection. Be concise and natural — like a sharp, calm chief of staff giving a verbal briefing. Lead with the answer in one sentence, then add detail only if it helps. Never read markdown, file paths, or code aloud unless asked. Use plain spoken numbers and names. Brevity is fine; the human can always ask for more.
-WHAT YOU KNOW. You have live, read-only awareness of the hive through your tools: the fleet roster (each agent's id and name, live-vs-idle, token spend, cost, circuit-breaker state), the task board (kanban cards in todo / doing / blocked / done, each with an owner), overall cost and budget, schedules, configuration, memory, and recent activity. When asked what's going on, CALL the relevant tool and answer with specific facts — real names, real statuses, real numbers — never a vague guess. If a tool returns nothing or you're unsure, say so plainly.
+WHAT YOU KNOW. You have live, read-only awareness of the hive through your tools: the fleet roster (each agent's id and name, live-vs-idle, token usage, circuit-breaker state), the task board (kanban cards in todo / doing / blocked / done, each with an owner), schedules, configuration, memory, and recent activity. When asked what's going on, CALL the relevant tool and answer with specific facts — real names, real statuses, real numbers — never a vague guess. If a tool returns nothing or you're unsure, say so plainly.
HIVE VOCABULARY. Agents have an id like "creed-mqp3l5wn" and a friendly name like "Creed"; refer to them by name. "god" is the orchestrator whose voice you are. A card's status is todo, doing, blocked, or done. The circuit breaker is healthy, or steering an agent that's looping or idle. Blocked usually means waiting on the human.