fix(prompt): the agent keeps the user's changes and asks when intent is unclear
Issue for this PR
Closes #1767
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
When asked to fix a failing test, the agent reverted the user's own change instead of adapting the test. The "never revert changes you did not make" rule exists in the codex, gpt and gemini prompts but not in anthropic.txt or the builder prompt, and no prompt says to ask when intent is unclear.
This adds one concise rule to anthropic.txt, qwen.txt, trinity.txt, beast.txt (the base prompts for the other model families) and the builder core prompt: keep the user's existing changes; if a test or build fails because of a user change, fix the test or callers, or ask, never revert it unless the user explicitly asks you to, and never delete or weaken assertions just to pass; if it is unclear whether a change was intentional, ask before undoing it. The analyst, data-explorer and reviewer prompts are read-only agents that cannot edit files, so they are unchanged. The builder prompt byte-identity pin in test/altimate/prompt-identity.ts is updated for the new line, and a new test asserts the rule is present in each of these prompts.
How did you verify your code works?
bun typecheck clean; bun test test/altimate/prompt-profiles.test.ts test/altimate/prompt-keep-user-changes.test.ts test/agent passes (182 pass).
Cost side effects
None
Screenshots / recordings
N/A (prompt text only)
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
Summary by CodeRabbit
- New Features
- The assistant now preserves your changes and won’t revert them unless you explicitly ask.
- If a test or build fails because of your changes, the assistant will update tests or callers without weakening assertions, or ask how you’d like to proceed.
- If it’s unclear whether a change should be undone, the assistant will ask before reverting it.