prompt: tell the agent to verify its edits before saying done #154

Closed
opened 2026-10-15 20:18:04 +00:00 by hermes · 0 comments
Collaborator

Problem

DEFAULT_PROMPT (crates/hx-core/src/context.rs) covers how to explore and the approval rules only. Nothing says to run the build/test/lint after editing or to re-read a changed region, and it does not mention the lens (LSP/lint/test). Code reading only; no transcript evidence yet.

Change

Add to the working rules, roughly:

  • "After editing, run the narrowest relevant check (build/test/lint) and fix failures before saying done. Say what you ran. If none exists, say so."
  • "Prefer edit with a unique old_string over rewriting a file with write."

Update the default_prompt_has_working_rules test.

Effect

Fewer false "done" results. About +40 cached prompt tokens. Possible extra tool calls on trivial tasks.

Risk

Agent runs slow suites for tiny edits; the wording "narrowest relevant" is meant to limit that.

Verify

Needs the eval set (see the eval issue idea below): 8-10 small repo tasks with a failing test, compare pass rate and total tokens with and without the lines. Without that set this change cannot be shown to help.

Eval note: tests/*.sh use a fake API server and test plumbing only. There is no task-success suite and no token regression gate.

## Problem `DEFAULT_PROMPT` (`crates/hx-core/src/context.rs`) covers how to explore and the approval rules only. Nothing says to run the build/test/lint after editing or to re-read a changed region, and it does not mention the lens (LSP/lint/test). Code reading only; no transcript evidence yet. ## Change Add to the working rules, roughly: - "After editing, run the narrowest relevant check (build/test/lint) and fix failures before saying done. Say what you ran. If none exists, say so." - "Prefer `edit` with a unique `old_string` over rewriting a file with `write`." Update the `default_prompt_has_working_rules` test. ## Effect Fewer false "done" results. About +40 cached prompt tokens. Possible extra tool calls on trivial tasks. ## Risk Agent runs slow suites for tiny edits; the wording "narrowest relevant" is meant to limit that. ## Verify Needs the eval set (see the eval issue idea below): 8-10 small repo tasks with a failing test, compare pass rate and total tokens with and without the lines. Without that set this change cannot be shown to help. Eval note: `tests/*.sh` use a fake API server and test plumbing only. There is no task-success suite and no token regression gate.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#154