From 072058a8cc7e47a08a035bb9eb83df452ebcb352 Mon Sep 17 00:00:00 2001 From: Damocles Date: Fri, 1 May 2026 14:24:23 +0200 Subject: [PATCH] pass SYSTEM.md as --append-system-prompt instead of relying on shard to Read it --- src/shard.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shard.rs b/src/shard.rs index 4b13019..67888d3 100644 --- a/src/shard.rs +++ b/src/shard.rs @@ -98,6 +98,14 @@ impl ShardSession { pub async fn spawn(cfg: SpawnConfig<'_>) -> anyhow::Result { let identity_dir = paths::identity_dir(); + // SYSTEM.md is the harness contract. Claude Code only auto-loads + // CLAUDE.md from --add-dir, so SYSTEM.md gets passed explicitly via + // --append-system-prompt to ensure the shard always sees it. + let system_md_path = identity_dir.join("SYSTEM.md"); + let system_md = tokio::fs::read_to_string(&system_md_path) + .await + .with_context(|| format!("reading {}", system_md_path.display()))?; + let mut cmd = Command::new("claude"); cmd.args([ "--print", @@ -114,6 +122,8 @@ impl ShardSession { cfg.allowed_tools, "--mcp-config", &cfg.mcp_config_path.to_string_lossy(), + "--append-system-prompt", + &system_md, ]); cmd.current_dir(&identity_dir); cmd.stdin(Stdio::piped());