refactor(#2012): docs in own derivation, ship via claude --add-dir (no ~/.claude clobber)

This commit is contained in:
damocles 2026-06-28 23:53:26 +02:00 committed by mara
commit 362d392993
7 changed files with 123 additions and 67 deletions

View file

@ -694,6 +694,19 @@ async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<(bool,
.arg(mcp::builtin_tools_arg())
.arg("--allowedTools")
.arg(mcp::allowed_tools_arg());
// hyperhive.docs.enable wires HIVE_DOCS_DIR to the in-container
// reference-docs dir (the docs/ tree plus a generic `CLAUDE.md`
// pointer at its root). Expose it to claude as an additional
// directory so the docs are readable, and enable additive CLAUDE.md
// loading so claude picks up `<dir>/CLAUDE.md` ALONGSIDE the agent's
// own memory files — never clobbering ~/.claude/CLAUDE.md or the
// project one. Unset (docs disabled) → neither flag is passed.
if let Some(docs_dir) = std::env::var_os("HIVE_DOCS_DIR")
&& !docs_dir.is_empty()
{
cmd.arg("--add-dir").arg(&docs_dir);
cmd.env("CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD", "1");
}
let mut child = cmd
.stdin(Stdio::piped())
.stdout(Stdio::piped())