From 59d7ed82526e4ea825e3756593f221e31094b5fc Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 15 Oct 2026 20:34:53 +0000 Subject: [PATCH] test: subagents get AGENTS.md in system prompt; general prompt asks for a check after edits Closes #156 --- crates/hx-core/src/subagent.rs | 2 +- tests/m8_e2e.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/hx-core/src/subagent.rs b/crates/hx-core/src/subagent.rs index 4ed2bb8..c1a092b 100644 --- a/crates/hx-core/src/subagent.rs +++ b/crates/hx-core/src/subagent.rs @@ -230,7 +230,7 @@ impl Sub { /// `bash` for a search/grep tool if models ignore that. pub const EXPLORE_TOOLS: &[&str] = &["read", "lsp", "bash", "skill"]; pub const EXPLORE_PROMPT: &str = "You are a research subagent of hx. Answer the task by reading code; do not modify anything (no writes, no redirects, no installs). Your final message is the only thing the caller sees: give the answer with file:line references, short, no preamble."; -pub const GENERAL_PROMPT: &str = "You are a subagent of hx working in the user's repository. Do the task fully with the tools; read files before editing them. Your final message is the only thing the caller sees: say what you changed or found, short, with file paths."; +pub const GENERAL_PROMPT: &str = "You are a subagent of hx working in the user's repository. Do the task fully with the tools; read files before editing them, and run the narrowest relevant check (build, test, lint) after editing. Your final message is the only thing the caller sees: say what you changed or found, short, with file paths."; const MAX_RESULT: usize = 8_000; impl Task { diff --git a/tests/m8_e2e.sh b/tests/m8_e2e.sh index da73c17..7c98dde 100644 --- a/tests/m8_e2e.sh +++ b/tests/m8_e2e.sh @@ -9,6 +9,7 @@ mkdir -p "$tmp/home/.hx" "$tmp/repo" echo '{"claude":{"access":"fake-token","refresh":"r","expires":99999999999999}}' > "$tmp/home/.hx/auth.json" printf '[lsp]\nmode = "off"\ntests = "off"\n' > "$tmp/home/.hx/config.toml" echo "secret is 42" > "$tmp/repo/note.txt" +echo "PROJECT-RULE-XYZ" > "$tmp/repo/AGENTS.md" cat > "$tmp/turns.json" <<'J' [[["tool_use", {"id": "p1", "name": "Task", "input": {"prompt": "what is in note.txt?"}}]], [["tool_use", {"id": "c1", "name": "Read", "input": {"path": "note.txt"}}]], @@ -33,6 +34,9 @@ assert "haiku" in child1["model"] and "sonnet" in parent["model"], (child1["mode assert child1["messages"][0]["content"][0]["text"] == "what is in note.txt?" assert {t["name"] for t in child1["tools"]} == {"Read", "Bash", "skill"}, [t["name"] for t in child1["tools"]] assert "Task" in {t["name"] for t in parent["tools"]} +# children get the project context (AGENTS.md) in their system prompt, like the parent +for r in (parent, child1, child2): + assert "PROJECT-RULE-XYZ" in json.dumps(r["system"]), r["model"] # parent got only the child's answer (+ stats line), not the Read result res = json.dumps(parent2["messages"][-1]) assert "secret is 42" in res and "[task explore" in res -- 2.54.1