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
49 lines
2.4 KiB
Nix
49 lines
2.4 KiB
Nix
# Named, explicitly-filtered source views of this repo. Each real
|
|
# consumer gets its own filtered derivation used as `src`, rather than
|
|
# an inline filter at the use site. Companion to the rust `cleanSrc`
|
|
# (crane's cargo-source filter — see ./rust.nix).
|
|
{ lib }:
|
|
{
|
|
# Filtered view of this repo handed to hive-c0re as the `hyperhive`
|
|
# meta-flake input. Drops files no nix or cargo derivation reads —
|
|
# shell helper scripts and root-level markdown — so editing them
|
|
# does NOT change the store path and therefore does NOT force a
|
|
# rebuild of every agent container.
|
|
#
|
|
# Dropped: scripts/, docs/, root-level *.md (README/AGENTS/TODO/…).
|
|
# Kept (build needs them): .nix, .rs, Cargo.*, branding/,
|
|
# frontend/, prompts/, flake.lock. docs/ is deliberately dropped:
|
|
# it is shipped to agent containers as its OWN narrow meta-flake
|
|
# input (`hyperhiveDocsSource`, below), threaded through hive-c0re
|
|
# → the meta flake → `services.hyperhive.agent.docs.source`. Keeping docs/ out of
|
|
# THIS source means a doc edit only re-hashes the docs input (a
|
|
# cheap re-link), not the whole flake source (which would rebuild
|
|
# every agent container). The `reference-docs` build from `../docs`
|
|
# stays only for standalone `nix build .#reference-docs` from a
|
|
# full checkout — the meta path never evaluates it.
|
|
hyperhiveFlakeSource = lib.cleanSourceWith {
|
|
name = "hyperhive-flake-source";
|
|
src = ../.;
|
|
filter =
|
|
path: type:
|
|
let
|
|
# Repo-relative path (strip the absolute source-dir prefix).
|
|
rel = lib.removePrefix (toString ../. + "/") (toString path);
|
|
in
|
|
!(lib.hasPrefix "scripts/" rel || rel == "scripts")
|
|
&& !(lib.hasPrefix "docs/" rel || rel == "docs")
|
|
&& !(type == "regular" && !lib.hasInfix "/" rel && lib.hasSuffix ".md" rel);
|
|
};
|
|
|
|
# The repo `docs/` tree as a standalone narrow source. Its store
|
|
# path moves ONLY on doc edits, decoupled from `hyperhiveFlakeSource`.
|
|
# hive-c0re threads this to the meta flake as the `hyperhive-docs`
|
|
# input (same pattern as the `hyperhive` input); the harness resolves
|
|
# `$HIVE_DOCS_DIR` from it via `services.hyperhive.agent.docs.source`. Evaluated
|
|
# here on the host where docs/ exists — it cannot be derived from
|
|
# inside the docs-stripped `hyperhiveFlakeSource`.
|
|
hyperhiveDocsSource = lib.cleanSourceWith {
|
|
name = "hyperhive-docs-source";
|
|
src = ../docs;
|
|
};
|
|
}
|