[BUG] Unsuppressable, undocumented system prompt preambles appended by agent sdk

Resolved 💬 3 comments Opened Jan 8, 2026 by maxandrews Closed Feb 21, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I am using the claude agent sdk for researching subtleties of identity prompting in long running stateful agents. It's very important that the indentity prompts are faithfully passed to the API. Well imagine my surprise when I ran a proxy today after getting some odd results to discover that the SDK prepends an undocumented claude system prompt ahead of my custom one! The unskippable preamble added is:

You are a Claude agent, built on Anthropic's Claude Agent SDK.

Obviously this hugely screws up my experiment by introducing competing elements of a different identity, and this behavior is not documented! Claude code doesn't think this happens and will gaslight you until you have it stand up a proxy and see for itself.

I can MITM edit the request to remove this phantom preamble, and that works for haiku but not for sonnet or opus, which use an exact string match to require that the preamble is present.

<img width="994" height="117" alt="Image" src="https://github.com/user-attachments/assets/dc4034d2-80ac-4b07-8626-0916d88346f4" />

<img width="720" height="226" alt="Image" src="https://github.com/user-attachments/assets/45f60b66-f9c2-4fd4-a732-86dc21d54271" />

What Should Happen?

You should stop prepending system prompts that users didn't ask for and let us use the prompts we want (and think we're using). And if you're not willing to do that, you should at least document this behavior clearly in the SDK so that people don't waste their time finding out the hard way after pulling their hair out.

Error Messages/Logs

Steps to Reproduce

  1. Set up a proxy between the sdk and the anthropic endpoint.
  2. Submit an SDK query with a custom system prompt
  3. inspect the request
  4. there is an undocumented preamble block prepended to the system prompt in the request
  5. This can be removed/altered in the proxy for haiku, but sonnet or opus will reject the request saying the preamble is required.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗