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): persist task ledger via writeTasks + hive:writeTasks IPC

Chaitanya Giric7c0c76c69fb
diff --git a/src/main/hive.ts b/src/main/hive.ts
index 39c4cfac..891c0392 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -39,6 +39,17 @@ export interface HiveMessage {
created_at: string;
}
+export interface HiveTask {
+ id: string;
+ title: string;
+ description?: string;
+ assignee?: string;
+ status: 'todo' | 'doing' | 'blocked' | 'done';
+ dependsOn: string[];
+ priority: number;
+ createdAt: string;
+}
+
export interface AgentMeta {
id: string;
name: string;
@@ -432,6 +443,17 @@ export class HiveManager {
const root = this.root();
return root ? this.readJson(join(root, 'tasks.json'), { tasks: [] }) : { tasks: [] };
}
+
+ /** Persist the task ledger to hive/tasks.json and commit it. Mirrors the
+ * board/message persist pattern: write JSON, log the change, single-commit. */
+ writeTasks(tasks: HiveTask[]): void {
+ const root = this.root();
+ if (!root) return;
+ this.ensureHive();
+ this.writeJson(join(root, 'tasks.json'), { tasks });
+ this.appendLog({ kind: 'tasks', count: tasks.length });
+ this.commit(`hive: tasks (${tasks.length})`);
+ }
memory(id: string): string {
const p = join(this.agentDir(id), 'memory.md');
return existsSync(p) ? readFileSync(p, 'utf8') : '';
diff --git a/src/main/index.ts b/src/main/index.ts
index b8771c77..5998bae1 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -11,7 +11,7 @@ import { listDir, readFileText, writeFileText } from './fs';
import {
getBranch, getStatus, getLog, getBranches, getAheadBehind, isRepo
} from './git';
-import { HiveManager, type AgentMeta, type HiveMessage } from './hive';
+import { HiveManager, type AgentMeta, type HiveMessage, type HiveTask } from './hive';
import { HookServer } from './hooks';
import { MemoryManager } from './memory';
import { enrichMessage } from './assistant';
@@ -231,6 +231,10 @@ ipcMain.handle('hive:send', (_evt, partial: Partial<HiveMessage>, from: unknown)
const 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 };
+});
// ─── IPC: enrichment assistant (headless Sonnet 1M prompt prep) ─────────────
ipcMain.handle('assistant:enrich', async (_evt, payload: unknown) => {
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 42e5960a..d0b2ec40 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -30,6 +30,18 @@ export interface HiveRegistry {
agents: Record<string, HiveAgentMeta & { status: string; lastSeen: number }>;
}
+/** 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. */
@@ -219,7 +231,12 @@ const api = {
// ─── Reset ─────────────────────────────────────────────────────────────────
/** Wipe all hive data + the memory palace, reset config, and relaunch the app
* into onboarding. The process exits, so this promise never resolves. */
- resetAll: (): Promise<void> => ipcRenderer.invoke('app:resetAll')
+ resetAll: (): Promise<void> => ipcRenderer.invoke('app:resetAll'),
+
+ // ─── 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)
};
contextBridge.exposeInMainWorld('cth', api);