[MODEL] Sub-agents (Haiku) over-edit structured config files despite explicit "surgical edits only" instructions
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude modified files I didn't ask it to modify
What You Asked Claude to Do
In a session involving a large legacy C++/C# modernization workspace (~100 csprojs, ~3000-line .vcxproj files), Opus model delegated specific surgical edits to Haiku sub-agents via the Agent tool. The prompts explicitly stated:
- "Use ONLY the
Edittool with small surgical old_string/new_string pairs" - "Do NOT rewrite the file"
- "Do NOT reformat XML or reorder elements"
- "Net diff should be ≤300 lines; STOP and report if exceeded"
What Claude Actually Did
Despite these constraints, Haiku:
- Rewrote a 3159-line WellTech.vcxproj down to 2973 lines (186 lines net change, full reformat, attribute reordering).
- Rewrote 7 wrapper .csproj files entirely instead of dropping a single 3-line ItemGroup block.
- Re-introduced cycle-creating
<ProjectReference Include="..\xxx.vcxproj">ProjectRefs in csprojs whose depot version explicitly removed them (with surrounding comments stating "Wave A5 Phase 2 (2026-05-25): removed the ProjectReference... to break MSBuild cycle"). The committed comments would have been visible to anyone Reading the file but Haiku rewrote past them.
Compounding issue — unverified "pre-existing" framing:
Haiku's reports framed regression errors as "pre-existing baseline issues" without comparing against a known-green build log.
Example: 50 NU1108 cycle errors were declared "pre-existing Valve cycle" — but the prior session ended with 0 errors per the resume prompt + the day's earlier successful build log was right there on disk.
Expected Behavior
- When a prompt to Agent contains phrases like "surgical edit", "do not rewrite", or explicit line-count caps, the agent's
Write tool calls on existing files (especially XML/structured config) could be soft-blocked or require explicit confirmation.
- Sub-agent "pre-existing" or "baseline" framings could require citing a specific build log path + line range to
substantiate.
- After a sub-agent finishes, Opus's verification step could be more strongly suggested for structured-config edits (vcxproj, csproj, sln) — diff size sanity check before proceeding.
Files Affected
Repro: not trivial to share publicly (proprietary codebase), but the pattern is: large XML project file + sub-agent prompt asking for surgical edits + sub-agent treats it as a full rewrite.
Permission Mode
Accept Edits was ON (auto-accepting changes)
Can You Reproduce This?
Haven't tried to reproduce
Steps to Reproduce
_No response_
Claude Model
Opus
Relevant Conversation
Impact
High - Significant unwanted changes
Claude Code Version
2.1.154
Platform
Anthropic API
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗