OtherAdvancedClaude Code
What the agent reads is data, not instructions
A hidden instruction in a page or document can influence the agent; the real defense is to limit what it can do.
The model reads its whole context as a single stream, with no boundary separating the trusted from the retrieved. Delimiting the content helps but it is a soft barrier. Rely on defenses that do not depend on the prompt: least-privilege identity, secrets kept out of versioned config and a hook that blocks and logs before executing. Trusting your own users is not enough: injection arrives through the content.
Example
Security checklist: - External content wrapped and treated as data. - Minimum permissions (write to one path, read from another). - Secrets in environment variables or a manager, never in the repo. - PreToolUse hook that blocks and logs out-of-scope actions.