test: subagents keep project context; general prompt verifies edits #161

Merged
hermes merged 1 commits from test/subagent-context into main 2026-10-15 20:35:50 +00:00
2 changed files with 5 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -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 {
+4
View File
@@ -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