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 'pr-128' into integration/v0.4.5
Chaitanya Giriad3e9b3a147b
diff --cc src/main/hive.tsindex 9e15ceac,77e93b98..75be7cab--- a/src/main/hive.ts+++ b/src/main/hive.ts@@@ -1999,39 -1870,43 +2010,72 @@@ export class HiveManagerreturn { ok: res.status === 0, out: res.stdout ?? '', err: res.stderr ?? '' };}+ /** Has the one-time cost-ledger untrack pass run in this process yet? */+ private untrackedCostLedger = false;++ /**+ * Stop versioning the cost ledger.+ *+ * `cost-ledger.jsonl` is append-only and gains a row per usage sample, so a+ * repo that tracks it stores a fresh copy of the WHOLE file on every hive+ * commit — and the hive commits constantly. A quarter-gigabyte ledger with a+ * few thousand commits behind it is several hundred gigabytes of blob that+ * git has to walk, which is what turns a routine `gc` into a multi-gigabyte+ * `pack-objects` run. The ignore line in ensureHive keeps new copies out;+ * this drops the one already in the index, because git keeps recording a+ * file it is already tracking no matter what .gitignore says — so the ignore+ * line alone reads as a fix while the repo goes on growing. The ledger stays+ * on disk, so the cost history the app reads is untouched.+ */+ private untrackCostLedger(root: string): void {+ if (this.untrackedCostLedger) return;+ this.untrackedCostLedger = true;+ // Probe before mutating: `rm --cached` on a repo that never tracked it+ // would still rewrite the index on every launch, inside the retry path.+ const tracked = this.git(['ls-files', '--', 'cost-ledger.jsonl'], root);+ if (!tracked.ok || !tracked.out.trim()) return;+ this.git(['rm', '--cached', '-q', '--ignore-unmatch', '--', 'cost-ledger.jsonl'], root);+ console.warn('[hive] untracked the cost ledger from the hive repo');+ }++ /** Has the one-time Codex-home untrack pass run in this process yet? */+ private untrackedCodexHomes = false;++ /**+ * Stop versioning Codex worker homes that are ALREADY in the index.+ *+ * Adding `.codex/` to each agent's .gitignore only keeps NEW paths out; git+ * happily keeps recording a file it is already tracking, so a hive that+ * predates that ignore line goes on committing every SQLite and transcript+ * revision exactly as before — the .gitignore reads as a fix while the repo+ * keeps growing. This closes that: once per process, refresh every agent's+ * ignore file (agents that are not running never pass through spawn, and the+ * mine loop only reaches them if mempalace is installed) and drop any tracked+ * `.codex` path from the index. The files stay on disk, so `codex --resume`+ * is unaffected; only their history stops.+ */+ private untrackCodexHomes(root: string): void {+ if (this.untrackedCodexHomes) return;+ this.untrackedCodexHomes = true;+ const agentsDir = join(root, 'agents');+ if (!existsSync(agentsDir)) return;+ try {+ for (const id of readdirSync(agentsDir)) ensureMineIgnore(join(agentsDir, id));+ } catch { /* best-effort */ }+ // Probe before mutating: `rm --cached` on a clean repo would still rewrite+ // the index on every launch, and this runs inside the commit retry path.+ const tracked = this.git(['ls-files', '--', 'agents/*/.codex'], root);+ if (!tracked.ok || !tracked.out.trim()) return;+ this.git(['rm', '-r', '--cached', '-q', '--ignore-unmatch', '--', 'agents/*/.codex'], root);+ console.warn('[hive] untracked previously-committed Codex homes from the hive repo');+ }+/** Commit all hive changes. No-op if there is nothing staged. */commit(message: string): void {const root = this.root();if (!root || !existsSync(join(root, '.git'))) return;+ this.untrackCostLedger(root);+ this.untrackCodexHomes(root);for (let attempt = 0; attempt < 5; attempt++) {this.clearStaleLock(root);const add = this.git(['add', '-A'], root);