Claude Code (>= 2.1.277) and opencode both read AGENTS.md, but Claude
Code reads it only when no CLAUDE.md exists in its cwd or above. So
this is a plain rename with no CLAUDE.md stub left behind.
- hive-agent/src/agents_md_migrate.rs: new. At harness start, before
the first turn, renames state/CLAUDE.md to state/AGENTS.md when only
the former exists; logs an error naming both paths when both exist
and touches neither; does nothing otherwise. Idempotent.
- hive-agent/src/main.rs: calls it in serve_main; checkpoint prompt
and a comment name AGENTS.md.
- hive-agent/src/claude_md_watch.rs: the size watch reads AGENTS.md;
todo text, doc comments and tests follow. Module name, todo
subsystem key ("claude_md") and metric name
(hyperhive.agent.claude_md.lines) are unchanged so existing todo
rows and dashboard history carry over.
- hive-agent/src/turn.rs, hive-agent/prompts/system.md: prompts tell
the agent its file is AGENTS.md.
- hive-agent/src/{otel_turn_metrics,stats}.rs,
frontend/packages/agent/src/stats.js, hive-subagent-mcp/src/*.rs:
comments and a tool parameter description naming the agent's file.
- nix/host-modules/swarm-grafana/dashboards/agents.json: panel title
and description.
- claude-plugins skills claude-subagents, state-hygiene: they mean the
agent's own state file.
- CLAUDE.md -> AGENTS.md at the repo root; docs/crates/README.md link
(checked by check-doc-refs.sh), hive-c0re/README.md,
.prettierignore and the nix/sources.nix comment follow.
- docs/: every prose mention of the agent's file; persistence.md
documents the boot-time rename, claude-invocation.md the shadowing.
Fixes #5509
51 lines
2.2 KiB
Markdown
51 lines
2.2 KiB
Markdown
# hive-c0re
|
|
|
|
The unprivileged host daemon (runs as `hive-core`). Owns the sqlite
|
|
broker, the reminder queue, the generic job-DAG
|
|
queue, container lifecycle, gateway vhost wiring, forge/matrix config
|
|
reconciliation, 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, dashboard-visible
|
|
state, wiring each agent's gateway vhost and reconciling its forge
|
|
config-repo access and matrix room membership. The accounts themselves
|
|
are swarm-controller's (`docs/integrations/forge.md`). 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,
|
|
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,
|
|
autoupdate, knowledge sync).
|
|
- **`agent_config/`** — per-agent registries (permissions,
|
|
resource limits, topology).
|
|
- **`stats/`** — dashboard metrics aggregation + OTEL export.
|
|
- **`socket_server/`** — the unix-socket request server for the
|
|
per-agent 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`**, **`priv_client.rs`** —
|
|
matrix provisioning, gateway vhosts, and the `hive-priv` client
|
|
respectively.
|
|
|
|
See the top-level `AGENTS.md`/`docs/` index for the full reading-path
|
|
map.
|