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
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
Merge branch 'feature/agent-archival' into integration/roadmap
Chaitanya Giriaa583feb45b3
diff --cc src/main/index.tsindex 595388be,24095c21..9b9b3d86--- a/src/main/index.ts+++ b/src/main/index.ts@@@ -187,20 -130,14 +193,27 @@@ ipcMain.handle('pty:resize', (_evt, id});ipcMain.handle('pty:kill', (_evt, id: string) => {if (typeof id !== 'string') return { ok: false, error: 'invalid id' };+ // Closing a terminal tab archives the agent: its registry record is retained+ // and flagged (not deleted), and only live-PTY agents stay 'active'.+ const agentId = ptyToAgent.get(id);+ if (agentId && hive.enabled()) {+ try { hive.setArchived(agentId, true); } catch (e) { console.error('[hive] setArchived failed:', e); }+ }+ ptyToAgent.delete(id);- return ptyManager.kill(id);+ const res = ptyManager.kill(id);+ // Tear down the agent's isolated worktree, if any. Best-effort and non-blocking:+ // we don't await it so the kill result returns immediately, and removal errors+ // (e.g. uncommitted work) are logged rather than surfaced to the renderer.+ const wtPath = worktreePaths.get(id);+ if (wtPath) {+ const origCwd = worktreeOrigins.get(id) ?? wtPath;+ worktreePaths.delete(id);+ worktreeOrigins.delete(id);+ void removeWorktree(origCwd, wtPath)+ .then(r => { if (!r.ok) console.error('[worktree] removeWorktree failed:', r.error); })+ .catch(e => console.error('[worktree] removeWorktree threw:', e));+ }+ return res;});ipcMain.handle('pty:list', () => ptyManager.list());@@@ -307,10 -244,12 +320,16 @@@ ipcMain.handle('hive:send', (_evt, partconst msg = hive.send(partial ?? {}, typeof from === 'string' ? from : 'system');return { ok: true, message: msg };});+ipcMain.handle('hive:writeTasks', (_evt, tasks) => {+ hive.writeTasks(tasks as HiveTask[]);+ return { ok: true };+});+ ipcMain.handle('hive:setArchived', (_evt, id: unknown, archived: unknown) => {+ if (typeof id !== 'string') return { ok: false, error: 'invalid id' };+ if (!hive.enabled()) return { ok: false, error: 'hive disabled (no harnessHome)' };+ hive.setArchived(id, archived === true);+ return { ok: true };+ });// ─── IPC: enrichment assistant (headless Sonnet 1M prompt prep) ─────────────ipcMain.handle('assistant:enrich', async (_evt, payload: unknown) => {diff --cc src/preload/index.tsindex df345325,3f7cd1aa..ed63ea61--- a/src/preload/index.ts+++ b/src/preload/index.ts@@@ -27,21 -27,11 +27,23 @@@ export interface HiveMessageexport interface HiveRegistry {godId: string | null;- agents: Record<string, HiveAgentMeta & { status: string; lastSeen: number }>;+ /** `archived` agents have had their terminal closed — retained + flagged, not+ * deleted; only live-PTY agents are 'active'. */+ agents: Record<string, HiveAgentMeta & { status: string; lastSeen: number; archived?: boolean }>;}+/** A card on the task kanban, persisted to hive/tasks.json. */+export interface HiveTask {+ id: string;+ title: string;+ description?: string;+ assignee?: string;+ status: 'todo' | 'doing' | 'blocked' | 'done';+ dependsOn: string[];+ priority: number;+ createdAt: string;+}+/** A message the router just delivered, with its resolved recipient ids. Drives* the envelope-handoff animation on the office floor. `targets` is `['human']`* when the message was escalated to the human approval queue. */@@@ -276,43 -223,11 +278,49 @@@ const api =* into onboarding. The process exits, so this promise never resolves. */resetAll: (): Promise<void> => ipcRenderer.invoke('app:resetAll'),+ // ─── Token telemetry (real usage + est. cost from CC transcripts) ──────────+ /** Sum input/output/cache tokens + estimated USD cost for an agent from its+ * Claude Code transcripts. Returns null for an invalid cwd. */+ agentUsage: (cwd: string): Promise<AgentUsage | null> =>+ ipcRenderer.invoke('hive:agentUsage', cwd),++ // ─── Task kanban (hive/tasks.json) ───────────────────────────────────────+ /** Overwrite the hive task ledger with the full task list and commit it. */+ hiveWriteTasks: (tasks: HiveTask[]): Promise<{ ok: boolean; error?: string }> =>+ ipcRenderer.invoke('hive:writeTasks', tasks),++ // ─── Scheduled missions (recurring auto-dispatch) ──────────────────────────+ listMissions: (): Promise<ScheduledMission[]> => ipcRenderer.invoke('missions:list'),+ saveMissions: (missions: ScheduledMission[]): Promise<{ ok: boolean }> =>+ ipcRenderer.invoke('missions:save', missions),++ // ─── Full-text search across hive files (board, tasks, memory) ─────────────+ textSearch: (q: string): Promise<{ ok: boolean; results: Array<{ source: string; excerpt: string }> }> =>+ ipcRenderer.invoke('hive:textSearch', q),++ // ─── GitHub issue ingestion (gh CLI) ───────────────────────────────────────+ /** List up to 30 open issues in the repo at `cwd` via the `gh` CLI. Returns+ * `{ ok: false, error }` if `gh` is missing/unauthenticated or `cwd` isn't a repo. */+ githubIssues: (cwd: string): Promise<{ ok: boolean; issues?: GHIssue[]; error?: string }> =>+ ipcRenderer.invoke('github:issues', cwd),++ // ─── GitHub CI status watcher (gh CLI) ─────────────────────────────────────+ /** List up to 5 recent CI (GitHub Actions) runs in the repo at `cwd` via the+ * `gh` CLI. Returns `{ ok: false, error }` if `gh` is missing/unauthenticated,+ * `cwd` isn't a repo, or the repo has no Actions. */+ githubCIRuns: (cwd: string): Promise<{ ok: boolean; runs?: CIRun[]; error?: string }> =>+ ipcRenderer.invoke('github:ciRuns', cwd),++ // ─── Desktop notifications ───────────────────────────────────────────────────+ /** Toggle native desktop notifications for agent lifecycle events. */+ setNotifications: (v: boolean): Promise<HarnessConfig> =>- ipcRenderer.invoke('app:setNotifications', v)++ ipcRenderer.invoke('app:setNotifications', v),+++ // ─── Agent lifecycle (archival) ─────────────────────────────────────────────+ /** Archive/unarchive a hive agent in the registry. Closing a terminal tab+ * archives it automatically via pty:kill; this is the explicit primitive. */+ hiveSetArchived: (id: string, archived: boolean): Promise<{ ok: boolean; error?: string }> =>+ ipcRenderer.invoke('hive:setArchived', id, archived)};contextBridge.exposeInMainWorld('cth', api);diff --cc src/renderer/src/components/CommandCenterPanel.tsxindex a89e7cf6,608809f4..4927c307--- a/src/renderer/src/components/CommandCenterPanel.tsx+++ b/src/renderer/src/components/CommandCenterPanel.tsx@@@ -524,14 -282,57 +526,60 @@@ function FloorTab({ seed }: { seed: { t);}+ // ─── Archived agents — retained + flagged, kept off the floor ────────────────++ function ArchivedSection() {+ const archivedAgents = useStore((s) => s.archivedAgents);+ const removeArchivedAgent = useStore((s) => s.removeArchivedAgent);+ const [open, setOpen] = useState(false);+ if (archivedAgents.length === 0) return null;+ return (+ <Section title={`ARCHIVED (${archivedAgents.length})`}>+ <button+ onClick={() => setOpen((v) => !v)}+ style={{+ display: 'inline-flex', alignItems: 'center', gap: 4,+ padding: '2px 8px 1px', border: 'none', cursor: 'pointer',+ background: 'var(--cth-cream-200)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-700)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12, color: 'var(--cth-ink-900)',+ marginBottom: open ? 6 : 0+ }}+ >{open ? '▾' : '▸'} {open ? 'hide' : 'show'} closed agents</button>+ {open && archivedAgents.map((a) => (+ <div key={a.id} style={{+ display: 'flex', alignItems: 'center', gap: 8,+ padding: 6, marginBottom: 6, opacity: 0.7,+ background: 'var(--cth-paper-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ <div style={{+ width: 24, height: 24, background: `var(--cth-${a.accent}-light)`,+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-900)',+ display: 'flex', alignItems: 'flex-end', justifyContent: 'center', overflow: 'hidden', flexShrink: 0+ }}>+ <SpritePortrait character={a.character} scale={1} />+ </div>+ <div style={{ flex: 1, minWidth: 0 }}>+ <div style={{ fontFamily: 'var(--cth-font-ui)', fontSize: 13, color: 'var(--cth-ink-700)' }}>{a.name}</div>+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', wordBreak: 'break-all' }}>{a.cwd}</div>+ </div>+ <button+ onClick={() => removeArchivedAgent(a.id)}+ style={{ border: 'none', background: 'transparent', cursor: 'pointer', color: 'var(--cth-ink-500)', flexShrink: 0 }}+ ><Icon name="x" /></button>+ </div>+ ))}+ </Section>+ );+ }+// ─── Memory tab ──────────────────────────────────────────────────────────────-function MemoryTab({ godId }: { godId: string }) {+function MemoryTab({ godId, who: controlledWho, onWho }: { godId: string; who?: string; onWho?: (id: string) => void }) {const agents = useStore((s) => s.agents);- const [who, setWho] = useState<string>(godId);+ // Selection is controllable from the graph tab; falls back to local state.+ const [internalWho, setInternalWho] = useState<string>(godId);+ const who = controlledWho ?? internalWho;+ const setWho = onWho ?? setInternalWho;const [mem, setMem] = useState('');const [query, setQuery] = useState('');const [searchOut, setSearchOut] = useState('');diff --cc src/renderer/src/store/store.tsindex 2c3ca81d,05b01020..4c14f9ff--- a/src/renderer/src/store/store.ts+++ b/src/renderer/src/store/store.ts@@@ -61,9 -61,10 +61,13 @@@ export interface Agent/** Michael's prep assistant ("Dwight") — enriches prompts and forwards them to* Michael via the hive. Send-only: never receives inbox/broadcast mail. */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;+ /** True once this agent's terminal was closed. Archived agents are retained+ * (in the store's `archivedAgents` list + the hive registry) but flagged and+ * kept off the floor; only live-PTY agents are 'active'. */+ archived?: boolean;}export interface FeedEntry {