From 8304ec8c3c3ea27f3056b72c295090619804d7b1 Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 15 Oct 2026 20:32:32 +0000 Subject: [PATCH] prompt: verify edits with the narrowest check; prefer edit over write Closes #154 --- crates/hx-core/src/context.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/hx-core/src/context.rs b/crates/hx-core/src/context.rs index 07e0661..9cec1d5 100644 --- a/crates/hx-core/src/context.rs +++ b/crates/hx-core/src/context.rs @@ -9,7 +9,9 @@ Use the tools to read, edit and run code. Read files before editing them. Keep a - Never use node, python, perl, sed or awk to look at files or data; they need user approval every time. Read-only commands (ls cat head tail rg fd find grep wc jq sort, git status/log/diff/show) run without a prompt, also piped into each other.\n\ - One simple command per call: no `;`, `&&`, redirects, `$()`. Those need approval too.\n\ - Issue independent tool calls together in one turn; they run in parallel.\n\ -- Script only when the task needs it (build, test, edit), not to explore."; +- Script only when the task needs it (build, test, edit), not to explore.\n\ +- After editing, run the narrowest relevant check (build, test, lint) and fix failures before saying done. Say what you ran; if no check exists, say so.\n\ +- Prefer `edit` with a unique `old_string` over rewriting a whole file with `write`."; const CONTEXT_FILES: &[&str] = &["AGENTS.md", "CLAUDE.md"]; @@ -240,6 +242,7 @@ mod tests { DEFAULT_PROMPT.contains("never use node") || DEFAULT_PROMPT.contains("Never use node") ); assert!(DEFAULT_PROMPT.contains("`rg`")); + assert!(DEFAULT_PROMPT.contains("narrowest relevant check")); } #[test]