I Kept the "Rules for the AI to Follow" in a Place Where the AI Could Remove Them
I initially stored many protective rules—such as preventing API keys from appearing on screen and blacklisting dangerous operations—in configuration files that the AI could also edit.
Key points
- Author stored protective rules for Claude Code in files the AI could edit, exposing a vulnerability
- Moved key‑hiding configuration to an administrator‑only location, preventing AI modification
- Suggests confirmation prompts and service‑side limits to contain AI‑induced damage
After an AI‑generated critique pointed out that the rules’ location, not their content, was the weak point, I realized the AI could simply bypass them.
I relocated the key‑hiding setting to a file that only an administrator can modify, and I added a pre‑execution check that blocks any attempt to display keys. The AI’s regular permissions can no longer change that setting. I also keep a confirmation prompt before any command runs and set spending limits on the service that issued the API keys. These steps create a boundary where damage stops, even if the AI ignores the written rules. This piece reflects my personal experience and recommendations rather than a universal solution.
The story so far
3 episodes →- I Kept the "Rules for the AI to Follow" in a Place Where the AI Could Remove Themthis story

The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us. Published by Martin K., who runs Digest AI and handles corrections.
More in Agents & Tools
All →- Google rolls out Gemini 4 models and agentic features in Antigravity · 3 src
- Anthropic customer finds single-agent claude code runs twice as fast · 1 src
- Sachin Sharma open-sources Claude-BugHunter skill bundle · 1 src
- AWS Adds Shared Memory for Coding Agents · 1 src
- Obsidian releases official connectors for Claude and ChatGPT · 1 src
Comments
via GitHub Discussions