refactor: per-agent state paths (/agents/{label}/state), centralize in paths.rs

This commit is contained in:
damocles 2026-05-16 14:16:25 +02:00
parent a82009cf8c
commit a6d1464071
10 changed files with 86 additions and 56 deletions

View file

@ -230,15 +230,13 @@ async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<bool>
));
}
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");
// Spawn inside the agent's state dir so relative paths in tool calls
// (Read foo.md, Bash ls, Write notes.md) land in the durable dir
// instead of wherever the harness systemd unit started. Falls back
// silently if the dir is missing (dev / test without the bind mount).
let state_dir = crate::paths::state_dir();
if state_dir.is_dir() {
cmd.current_dir(&state_dir);
}
cmd.arg("--print")
.arg("--verbose")