hyperhive/hive-c0re
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas e0b08fe362 hive-c0re: fail on an unparseable permission file, write it atomically
tool_groups::read and capabilities::read returned an empty map when
their file existed but didn't parse. Every set_*/remove_agent is a
read-modify-write, and write() rewrote the file in place, so a crash or
ENOSPC mid-write left a truncated file, and the next write (e.g. the
manager-spawn seed of ruth's tool groups) replaced it with a map holding
only one agent. The scheduling and approval gates then denied every
other agent, recoverable only from meta git history.

- Both registries now read through agent_config::read_map: a missing
  file is still the empty map, any other read failure or a parse
  failure is an io::Error. set_groups / set_caps / remove_agent fail
  without writing.
- Writes go through agent_config::write_map: temp file in the same
  directory, fsync, rename, fsync the directory. hive-c0re had no
  shared atomic-write helper (the existing tmp+rename sites are inline
  and don't fsync).
- Callers of read / groups_for / has_cap now handle the error:
  * dashboard GET /api/tool-groups, /api/capabilities,
    /api/permissions/stale return 500 instead of an empty table;
  * the SSE permission snapshots are skipped with a warn;
  * render_flake returns Result, so sync_agents fails instead of
    rendering every agent without its tool groups / capabilities;
  * set_nspawn_flags propagates has_cap's error;
  * the socket tool-group gates deny with the read error as message;
  * seed_manager_tool_groups logs and does not seed.
- capabilities::write had no callers left once set_caps writes through
  write_map, and is removed.

Closes #4719
2026-09-26 21:11:54 +02:00
..
src hive-c0re: fail on an unparseable permission file, write it atomically 2026-09-26 21:11:54 +02:00
Cargo.toml log: send records natively to journald, keep stdout off-unit 2026-09-21 15:52:57 +02:00
README.md docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00

hive-c0re

The unprivileged host daemon (runs as hive-core). Owns the sqlite broker, the approval/reminder/schedule queues, the generic job-DAG queue, container lifecycle, gateway/forge/matrix provisioning, per-container stats, and the axum operator dashboard. Largest crate in the workspace — bin-only, no separate lib.

When to use it

Host-level, cross-container orchestration: spawning/rebuilding/ destroying agent containers, the approval flow, dashboard-visible state, provisioning per-agent forge/matrix/gateway accounts. Agent-side behavior (turn loop, MCP tools) lives in hive-agent/hive-agent-mcp instead — this daemon only talks to agents over the socket wire types in hive-sh4re.

Shape

Cohesive clusters live in directory submodules, each re-exported at the crate root (crate::broker::… keeps resolving regardless of which subdirectory a module actually lives in). One line each — read the module's own //! doc-comment for real detail, don't expect this file to track it:

  • dashboard/ — the operator dashboard (containers, approvals, schedules, logs, topology).
  • job_queue/ — the job-DAG queue + desired-state reconciliation (docs/scheduler/coordinator.md).
  • lifecycle/ — nixos-container lifecycle + per-agent config flake generation.
  • stores/ — sqlite-backed stores (broker, queues, audit, power).
  • workers/ — background sweeps (crash watch, scheduled prompts, auto-update, knowledge sync).
  • agent_config/ — per-agent registries (tool groups, capabilities, resource limits, topology).
  • stats/ — dashboard metrics aggregation + OTEL export.
  • socket_server/ — the unix-socket request server shared by per-agent + manager sockets.
  • forge/ — optional Forgejo wiring (docs/integrations/forge.md).
  • coordinator.rs — top-level wiring for serve.
  • meta.rs, migrate.rs — the meta flake + schema/state migrations.
  • matrix.rs, gateway_nginx.rs, webhook_secret.rs, priv_client.rs — matrix provisioning, gateway vhosts, webhook secrets, and the hive-priv client respectively.

See the top-level CLAUDE.md/docs/ index for the full reading-path map.