From 02139efbb177c89f1a1b0c4e09891e311003fda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sat, 16 May 2026 00:46:19 +0200 Subject: [PATCH] turn: spawn claude with cwd = /state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit every claude invocation now runs with current_dir set to /state — relative paths in tool calls (Read notes.md, Bash ls, Write blob) land in the agent's durable bind-mounted dir instead of the harness's systemd cwd. /state is RW + survives destroy/recreate so this matches where the agent is told to keep notes anyway. dev/test setups without the bind silently fall back to the parent cwd. --- hive-ag3nt/src/turn.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hive-ag3nt/src/turn.rs b/hive-ag3nt/src/turn.rs index 8edea91..1c49981 100644 --- a/hive-ag3nt/src/turn.rs +++ b/hive-ag3nt/src/turn.rs @@ -241,6 +241,16 @@ async fn run_claude( )); } let mut cmd = Command::new("claude"); + // Spawn inside /state so any path claude resolves relatively (Read + // foo.md, Bash ls, Write notes.md) lands in the agent's durable + // dir instead of wherever the harness systemd unit started. /state + // is bind-mounted RW from the host so survives destroy/recreate. + // Fall back silently if the dir is missing (dev / test setups + // running without the bind mount) — Command picks up the parent's + // cwd in that case. + if std::path::Path::new("/state").is_dir() { + cmd.current_dir("/state"); + } cmd.arg("--print") .arg("--verbose") .arg("--output-format")