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

Merge #177: feat(hive): flag each agent's live context-window occupancy in god's roster

Chaitanya Giri4fa989763fc8
diff --cc src/main/hooks.ts
index e0cfca95,0f8dd82e..0db1e667
--- a/src/main/hooks.ts
+++ b/src/main/hooks.ts
@@@ -264,19 -256,14 +264,24 @@@ export class HookServer
// God-only and one line — every other agent is unaffected.
const wantsRoster = (event === 'SessionStart' || event === 'UserPromptSubmit')
&& !!agentId && this.hive.isGod(agentId);
- const roster = wantsRoster ? this.hive.rosterContext() : null;
+ // Hand the roster the LIVE context-window occupancy (contextById) so each
+ // agent line can carry a `ctx NN%` — god then sees whose context is nearly
+ // full when it routes work, instead of guessing from cumulative token spend.
+ const roster = wantsRoster
+ ? this.hive.rosterContext((id) => this.contextFor(id))
+ : null;
- if (steer || roster) {
+ // Standing goal (hire Briefing) — durable roster field, re-read every cycle so
+ // an Edit Agent save is picked up on the next SessionStart / UserPromptSubmit
+ // without restarting the worker. Kept out of --append-system-prompt (volatile-
+ // free cache invariant); lives on the live hook channel instead.
+ const wantsGoal = (event === 'SessionStart' || event === 'UserPromptSubmit') && !!agentId;
+ const goalRaw = wantsGoal ? (this.getStandingGoal?.(agentId) ?? null) : null;
+ const goal = goalRaw
+ ? `<goal>\n${goalRaw}\n</goal>`
+ : null;
+
+ if (steer || roster || goal) {
this.emit(agentId, event, p);
return {
hookSpecificOutput: {