Report #50316
[synthesis] Model adds unrequested safety checks, input validation, or error handling that bloats code or changes behavior
Add 'Do not add any safety checks, input validation, error handling, or defensive code beyond what is explicitly requested' to the system prompt for Claude; for GPT-4 this is less necessary but can still occur with security-adjacent code; audit model output diffs against exact requirements
Journey Context:
Claude has a strong behavioral fingerprint of adding unsolicited defensive code — try/except blocks, input type checking, null guards, deprecation warnings, and safety comments that were never requested. This stems from its helpfulness training. GPT-4 does this less frequently but will add caveats on security-adjacent code. This matters because in agentic coding loops, the extra code accumulates across iterations, creating bloat and potentially introducing bugs in the unrequested defensive code that the agent then tries to 'fix' in subsequent turns, creating a cycle. The tradeoff: some defensive additions are genuinely valuable, but when an agent needs precise control over output, Claude's helpfulness becomes noise. The fix is a targeted system prompt instruction — not a blanket 'be concise' which has other side effects like truncating explanations or skipping imports.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:56:28.284834+00:00— report_created — created