feat(#2089): docs pointer via system-prompt line, drop CLAUDE.md mechanism
This commit is contained in:
parent
fc415a72a5
commit
a26bbb15fc
3 changed files with 86 additions and 62 deletions
|
|
@ -100,24 +100,6 @@ let
|
|||
iconPng = pkgs.runCommand "hive-agent-icon.png" { nativeBuildInputs = [ pkgs.librsvg ]; } ''
|
||||
rsvg-convert -f png -w 512 -h 512 ${config.hyperhive.icon} -o $out
|
||||
'';
|
||||
# hyperhive.docs.enable: the reference-docs tree (from
|
||||
# `config.hyperhive.docs.source` — the narrow `hyperhive-docs` meta-flake
|
||||
# input in a hive deployment, or `pkgs.hyperhive-docs` for standalone
|
||||
# builds) with a generic `CLAUDE.md` pointer dropped at the root. The
|
||||
# harness passes this dir to claude via `--add-dir`; paired with
|
||||
# `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` claude loads
|
||||
# `<dir>/CLAUDE.md` ADDITIVELY (alongside, never replacing, the agent's
|
||||
# own `~/.claude/CLAUDE.md`). The pointer prose lives in
|
||||
# `hive-ag3nt/prompts/docs-pointer.md` (prompts belong in prompts/, not
|
||||
# nix/) and is shipped via `hyperhive-assets`. The docs source itself
|
||||
# stays pure (no CLAUDE.md) so the website can reuse the same tree.
|
||||
# Lazy: only forced when `hyperhive.docs.enable` references it below.
|
||||
agentDocs = pkgs.runCommand "hyperhive-agent-docs" { } ''
|
||||
mkdir -p $out
|
||||
cp -r ${config.hyperhive.docs.source}/. $out/
|
||||
chmod -R u+w $out
|
||||
cp ${pkgs.hyperhive-assets}/share/hyperhive/prompts/docs-pointer.md $out/CLAUDE.md
|
||||
'';
|
||||
in
|
||||
{
|
||||
# Shared scaffolding for every hyperhive harness container.
|
||||
|
|
@ -263,12 +245,11 @@ in
|
|||
read-only as the standalone `hyperhive-docs` derivation) available
|
||||
in-container. When enabled the harness exposes the docs dir to claude
|
||||
via `claude --add-dir`, so the markdown is readable at
|
||||
`$HIVE_DOCS_DIR/`. A generic `CLAUDE.md` pointer is dropped at the dir
|
||||
root and loaded additively (via
|
||||
`CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`), so the agent knows
|
||||
the docs exist without its own `~/.claude/CLAUDE.md` being replaced.
|
||||
Default-on for the root/manager agent (see `manager.nix`), off
|
||||
elsewhere; any agent can flip it from its `agent.nix`.
|
||||
`$HIVE_DOCS_DIR/`, and appends a single pointer sentence to the agent's
|
||||
system prompt so it knows the docs exist (see
|
||||
`hive-ag3nt::prompt::render`). Default-on for the root/manager agent
|
||||
(see `manager.nix`), off elsewhere; any agent can flip it from its
|
||||
`agent.nix`.
|
||||
'';
|
||||
|
||||
options.hyperhive.docs.source = lib.mkOption {
|
||||
|
|
@ -1420,18 +1401,14 @@ in
|
|||
HIVE_COMPACT_WATERMARK_TOKENS = "0";
|
||||
}
|
||||
// lib.optionalAttrs config.hyperhive.docs.enable {
|
||||
# hyperhive.docs.enable: the in-container reference-docs tree plus a
|
||||
# generic `CLAUDE.md` pointer at its root (see `agentDocs` above).
|
||||
# The harness reads HIVE_DOCS_DIR and passes it to claude as
|
||||
# `--add-dir` so the docs are readable; with
|
||||
# `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` claude also loads
|
||||
# the pointer additively, telling the agent the docs exist without
|
||||
# clobbering its own memory. See hive-ag3nt::turn. The docs tree
|
||||
# itself comes from `hyperhive.docs.source` (the narrow
|
||||
# hyperhive.docs.enable: the in-container reference-docs tree. The
|
||||
# harness reads HIVE_DOCS_DIR and passes it to claude as `--add-dir`
|
||||
# so the docs are readable, and appends a single pointer sentence to
|
||||
# the system prompt (hive-ag3nt::prompt::render) telling the agent the
|
||||
# docs exist. Source is `hyperhive.docs.source` (the narrow
|
||||
# `hyperhive-docs` meta-flake input, or `pkgs.hyperhive-docs` for
|
||||
# standalone builds) via `agentDocs`.
|
||||
HIVE_DOCS_DIR = "${agentDocs}";
|
||||
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD = "1";
|
||||
# standalone builds). See hive-ag3nt::turn.
|
||||
HIVE_DOCS_DIR = "${config.hyperhive.docs.source}";
|
||||
}
|
||||
// lib.optionalAttrs (config.hyperhive._bashEnvFragments != "") {
|
||||
# Non-interactive bash invocations (claude's `Bash` tool runs
|
||||
|
|
|
|||
Loading…
Reference in a new issue