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(hive): a 1:1 hold toggle that tells Michael to leave an agent alone

Chaitanya Giri98442d24f039
diff --git a/src/main/hive.ts b/src/main/hive.ts
index 7d05ad4d..f3b9c03d 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -149,6 +149,11 @@ export interface RegistryAgent extends AgentMeta {
* (not deleted) so its history/memory survive; only agents with a live PTY
* are 'active'. Broadcast fan-out + roster reads skip archived agents. */
archived?: boolean;
+ /** The human has this agent 1:1 and Michael must leave it alone until they
+ * flip it back. Held agents stay ACTIVE and keep their terminal — this is
+ * "do not dispatch to them", not "they are gone", which is why it is its own
+ * flag rather than a reuse of `archived` or a breaker level. */
+ onHold?: boolean;
/** Most recent Claude Code session_id seen for this agent (Lane A #6.6a),
* captured from hook payloads. Doubles as the `--resume` key (idempotent
* resume after a crash/restart) AND the cost accounting/dedup key on every
@@ -916,6 +921,43 @@ export class HiveManager {
* `fleet.json` is patched in the same operation so god's next prompt receives
* the new name immediately rather than waiting for the periodic fleet refresh.
*/
+ /**
+ * Put an agent on hold, or take it off, and tell Michael immediately.
+ *
+ * `fleet.json` is patched in the same operation for the same reason
+ * `renameAgent` does it: god's roster is injected from that file on its next
+ * prompt, and waiting up to 8s for the periodic refresh means one more
+ * dispatch can still land on someone the human has just claimed.
+ */
+ setAgentHold(id: string, hold: boolean): { ok: boolean; onHold?: boolean; error?: string } {
+ const root = this.root();
+ if (!root) return { ok: false, error: 'hive disabled (no harnessHome)' };
+ try {
+ const reg = this.registry();
+ const agent = reg.agents[id];
+ if (!agent) return { ok: false, error: 'Agent not found' };
+ if (!!agent.onHold === hold) return { ok: true, onHold: hold };
+
+ agent.onHold = hold;
+ this.writeJson(join(root, 'registry.json'), reg);
+
+ const fleetPath = join(root, 'fleet.json');
+ if (existsSync(fleetPath)) {
+ try {
+ const fleet = this.readJson<{ agents?: Array<{ id?: string; onHold?: boolean }> }>(fleetPath, {});
+ if (Array.isArray(fleet.agents)) {
+ const row = fleet.agents.find((candidate) => candidate.id === id);
+ if (row) { row.onHold = hold; this.writeJson(fleetPath, fleet); }
+ }
+ } catch { /* fleet is a cache — the registry above is the record */ }
+ }
+ this.appendLog({ kind: 'agent-hold', id, onHold: hold });
+ return { ok: true, onHold: hold };
+ } catch (e) {
+ return { ok: false, error: e instanceof Error ? e.message : String(e) };
+ }
+ }
+
renameAgent(id: string, name: string): { ok: boolean; name?: string; error?: string } {
const root = this.root();
if (!root) return { ok: false, error: 'hive disabled (no harnessHome)' };
@@ -2108,6 +2150,7 @@ export class HiveManager {
id: string; name?: string; role?: string; isGod?: boolean;
breaker?: string; tokens?: number; usd?: number;
lastTool?: string | null; lastActiveSecAgo?: number | null; inboxBacklog?: number;
+ onHold?: boolean;
}>;
};
const agents = Array.isArray(snap.agents) ? snap.agents : [];
@@ -2124,6 +2167,7 @@ export class HiveManager {
const MAX = 24;
const shown = agents.slice(0, MAX);
let anyCtx = false;
+ let anyHold = false;
const rows = shown.map((a) => {
const bits = [a.role ?? 'agent',
typeof a.lastActiveSecAgo === 'number' ? `active ${ago(a.lastActiveSecAgo)}` : 'no activity yet'];
@@ -2132,6 +2176,10 @@ export class HiveManager {
if (a.inboxBacklog) bits.push(`inbox ${a.inboxBacklog}`);
if (a.breaker && a.breaker !== 'ok' && a.breaker !== 'none') bits.push(`breaker ${a.breaker}`);
if (a.isGod) bits.push('you');
+ // First in the row after the role would be louder, but this reads in
+ // the same scan as `breaker` and `inbox`, and god already treats those
+ // as routing signals.
+ if (a.onHold) { bits.push('ON HOLD — 1:1 with the human'); anyHold = true; }
// Live context-window occupancy from the statusLine shim — lets god see
// which agents are near-full when routing, instead of guessing from the
// cumulative token count. Clamp to 0-100; a fresh meter can briefly
@@ -2154,6 +2202,13 @@ export class HiveManager {
+ (anyCtx
? '`ctx NN%` = live window occupancy; absent = not yet reported (unknown, not empty). '
: '')
+ + (anyHold
+ ? 'An agent marked `ON HOLD — 1:1 with the human` is UNAVAILABLE: the human is working '
+ + 'with them directly. Do NOT message them, do NOT dispatch to them, and do NOT count '
+ + 'them when picking an owner. Route to someone else, or say the work is waiting. They '
+ + 'are still running and their terminal is alive, so this is not a reason to archive '
+ + 'them or spawn a replacement. The human flips it off when they are done. '
+ : '')
+ 'Route work to someone on this list before spawning anyone new.';
} catch { return null; }
}
diff --git a/src/main/index.ts b/src/main/index.ts
index 8100f474..60534716 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -1185,7 +1185,8 @@ function writeFleetSnapshot(): void {
usd: u ? Number(u.usd.toFixed(4)) : 0,
lastTool: spans.length ? spans[spans.length - 1].tool : null,
lastActiveSecAgo: u ? Math.round((now - u.ts) / 1000) : null,
- inboxBacklog: hive.inboxBacklog(id)
+ inboxBacklog: hive.inboxBacklog(id),
+ onHold: !!a.onHold
};
});
hive.writeFleetSnapshot({ ts: now, agents });
@@ -3244,6 +3245,12 @@ ipcMain.handle('hive:renameAgent', (_evt, id: unknown, name: unknown) => {
}
return hive.renameAgent(id, name);
});
+ipcMain.handle('hive:setAgentHold', (_evt, id: unknown, hold: unknown) => {
+ if (typeof id !== 'string' || typeof hold !== 'boolean') {
+ return { ok: false, error: 'Invalid hold request' };
+ }
+ return hive.setAgentHold(id, hold);
+});
ipcMain.handle('hive:board', () => hive.board());
ipcMain.handle('hive:tasks', () => hive.tasks());
ipcMain.handle('hive:log', (_evt, n: unknown) => hive.logTail(typeof n === 'number' ? n : 200));
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 8e35015d..d7214d28 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -736,6 +736,10 @@ const api = {
/** Rename an agent's display name. Its id, hive directory, and PTY are unchanged. */
hiveRenameAgent: (id: string, name: string): Promise<{ ok: boolean; name?: string; error?: string }> =>
ipcRenderer.invoke('hive:renameAgent', id, name),
+ /** Put an agent on hold (the human has them 1:1) or take it off. Held agents
+ * keep running; Michael is told to stop routing work to them. */
+ hiveSetAgentHold: (id: string, hold: boolean): Promise<{ ok: boolean; onHold?: boolean; error?: string }> =>
+ ipcRenderer.invoke('hive:setAgentHold', id, hold),
hiveBoard: (): Promise<string> => ipcRenderer.invoke('hive:board'),
hiveTasks: (): Promise<unknown> => ipcRenderer.invoke('hive:tasks'),
hiveLog: (n?: number): Promise<unknown[]> => ipcRenderer.invoke('hive:log', n ?? 200),
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 2d7c2e76..4df3ca4d 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import { useStore, selectedAgent } from '@/store/store';
import { startMockLoop, stopMockLoop } from '@/store/mockEvents';
import type { HarnessConfig } from '@/store/config';
@@ -49,6 +49,16 @@ export function App() {
const ideOpen = useStore(s => s.ideOpen);
const setIdeOpen = useStore(s => s.setIdeOpen);
+ // Whoever the title bar's 1:1 hold acts on: the focused agent when focus mode
+ // is on, otherwise the selection. Michael himself is excluded — putting the
+ // orchestrator on hold would tell him to stop routing to himself.
+ const selectedId = useStore(s => s.selectedId);
+ const holdTarget = useMemo(() => {
+ const id = fullscreenAgentId ?? selectedId;
+ const a = agents.find((x) => x.id === id);
+ return a && !a.isGod ? a : null;
+ }, [agents, fullscreenAgentId, selectedId]);
+
const [config, setConfig] = useState<HarnessConfig | null>(null);
// Whether the user has passed the launch-time hive picker this session. Starts
// true (skip the picker) right after a hive SWITCH — changeHome relaunches and
@@ -333,6 +343,40 @@ export function App() {
</button>
{/* v0.3.4: the IDE button moved to agent level — every agent's header
(sidebar detail, god Command Center, fullscreen) carries it. */}
+ {/* 1:1 hold. Acts on whoever is on screen — the focused agent, else the
+ selection — and the tooltip names them, because a title-bar control
+ that silently picks its own target is how you put the wrong agent on
+ hold. Held agents keep running; all this changes is that Michael is
+ told to stop routing work to them. */}
+ {holdTarget && (
+ <button
+ className="cth-titlebar-nodrag cth-tip"
+ onClick={() => {
+ const next = !holdTarget.onHold;
+ void window.cth.hiveSetAgentHold(holdTarget.id, next).then((r) => {
+ // Only mirror it locally once main has actually written the
+ // registry. Flipping the button optimistically would show a
+ // hold that Michael never heard about.
+ if (r.ok) useStore.getState().updateAgent(holdTarget.id, { onHold: next });
+ });
+ }}
+ data-tip={holdTarget.onHold
+ ? `${holdTarget.name} is on hold — release to Michael`
+ : `Hold ${holdTarget.name} for a 1:1`}
+ aria-label="Toggle 1:1 hold"
+ aria-pressed={!!holdTarget.onHold}
+ style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 28, height: 28, padding: 0,
+ background: holdTarget.onHold ? 'var(--cth-mint-light)' : 'var(--cth-paper-100)',
+ boxShadow: `inset 0 0 0 1px ${holdTarget.onHold ? 'var(--cth-mint)' : 'var(--cth-ink-300)'}`,
+ border: 'none', borderRadius: 2, cursor: 'pointer',
+ color: 'var(--cth-ink-900)'
+ }}
+ >
+ <HoldGlyph on={!!holdTarget.onHold} />
+ </button>
+ )}
<button
className="cth-titlebar-nodrag cth-settings-btn cth-tip"
onClick={() => { setSettingsSection(undefined); setSettingsOpen(true); }}
@@ -531,6 +575,16 @@ function ExpandGlyph() {
);
}
+/** Two bars, the universal pause. "This agent is parked, not gone." Filled when
+ * the hold is ON so the state reads at a glance without hunting for a colour. */
+function HoldGlyph({ on }: { on: boolean }) {
+ return (
+ <Glyph>
+ <path d="M6 3.5v9M10 3.5v9" strokeWidth={on ? 3 : 1.6} />
+ </Glyph>
+ );
+}
+
/** The same brackets turned inward — leave fullscreen. */
function CollapseGlyph() {
return (
diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.ts
index f390ed0e..ccbf681a 100644
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@ -86,6 +86,10 @@ export interface Agent {
/** 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;
+ /** The human has this agent 1:1 and Michael has been told to leave it alone.
+ * Mirrors `RegistryAgent.onHold`; main owns the record, this is the copy the
+ * title bar renders from. */
+ onHold?: 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;
diff --git a/test/hive-roster-injection.test.cjs b/test/hive-roster-injection.test.cjs
index a6292083..b3195832 100644
--- a/test/hive-roster-injection.test.cjs
+++ b/test/hive-roster-injection.test.cjs
@@ -164,3 +164,61 @@ test('a corrupt fleet.json degrades to no injection instead of throwing into a h
const res = await fire('god-1', 'SessionStart');
assert.doesNotMatch(context(res), /LIVE ROSTER/);
});
+
+// --- 1:1 hold ---------------------------------------------------------------
+// The human takes an agent aside. It keeps running and keeps its terminal, but
+// Michael has to stop routing to it — otherwise the human and the orchestrator
+// are driving the same agent at once, which is how a 1:1 turns into a fight
+// over the same terminal.
+
+test('a held agent is marked in the roster and Michael is told to route around it', async (t) => {
+ const { hive } = await floor(t);
+ snapshot(hive);
+ assert.doesNotMatch(hive.rosterContext(), /ON HOLD/,
+ 'nothing says hold until something is held');
+
+ assert.deepEqual(hive.setAgentHold('jim-1', true), { ok: true, onHold: true });
+
+ const line = hive.rosterContext();
+ assert.match(line, /jim-1 "Jim" \([^)]*ON HOLD/, 'the mark belongs on that agent, not the line');
+ assert.match(line, /Do NOT message them/);
+ assert.match(line, /do NOT dispatch to them/);
+ assert.ok(!line.includes('\n'), 'still one compact line');
+});
+
+test('the hold reaches Michael without waiting for the next fleet snapshot', async (t) => {
+ const { home, hive } = await floor(t);
+ snapshot(hive);
+ hive.setAgentHold('jim-1', true);
+ // The registry is the record, but the roster is injected from fleet.json, and
+ // the periodic writer is 8s away. One more dispatch fits in 8s.
+ const fleet = JSON.parse(fs.readFileSync(path.join(home, 'hive', 'fleet.json'), 'utf8'));
+ assert.equal(fleet.agents.find((a) => a.id === 'jim-1').onHold, true);
+});
+
+test('releasing clears the mark and the whole instruction block', async (t) => {
+ const { hive } = await floor(t);
+ snapshot(hive);
+ hive.setAgentHold('jim-1', true);
+ assert.deepEqual(hive.setAgentHold('jim-1', false), { ok: true, onHold: false });
+
+ const line = hive.rosterContext();
+ assert.doesNotMatch(line, /ON HOLD/);
+ assert.doesNotMatch(line, /Do NOT message them/,
+ 'the guidance must go with the last hold, or it reads as always-on and gets ignored');
+});
+
+test('holding is idempotent and a bad id is refused', async (t) => {
+ const { hive } = await floor(t);
+ assert.deepEqual(hive.setAgentHold('jim-1', true), { ok: true, onHold: true });
+ assert.deepEqual(hive.setAgentHold('jim-1', true), { ok: true, onHold: true });
+ assert.equal(hive.setAgentHold('nobody-here', true).ok, false);
+});
+
+test('the hold survives a restart, because the registry is the record', async (t) => {
+ const { home, hive } = await floor(t);
+ hive.setAgentHold('jim-1', true);
+ const reg = JSON.parse(fs.readFileSync(path.join(home, 'hive', 'registry.json'), 'utf8'));
+ assert.equal(reg.agents['jim-1'].onHold, true,
+ 'a hold that evaporated on restart would hand the agent back to Michael silently');
+});