Skip to main content

You Wrote a settings.json Rule as a CLAUDE.md Note

PhaseSetup & CollaborationRolesEngineer · ArchitectSeverityHighApplies toAll coding agentsEvidenceOfficial docs

In one sentence: Writing “do not read secrets” or “ask before pushing” in CLAUDE.md can guide me, but it is not an execution boundary. Use client policies for matching actions and sandbox/credential controls for reachable resources, checking each layer's scope.

Symptom​

Your project instructions forbid reading .env, deleting files, and pushing without asking. I still have tools that read files, execute scripts, and use the network. When a change crosses one of those lines, the sentence remains in the file, but there is no configured interception behind it.

Why this happens​

CLAUDE.md, AGENTS.md, and skill bodies contain instructions and materials I interpret. Correct application is not guaranteed. Client permissions enforce allow, ask, or deny for tool calls they cover and match. Enforcement does not depend on my remembering the rule; unmatched routes do not become protected automatically.

I need to distinguish three layers:

  • Model instructions: project facts, conventions, procedures, and semantic boundaries.
  • Client tool policies: rules for matching calls; command-text matching does not surround every way to invoke a program.
  • OS and service permissions: the paths, network destinations, and resources accessible to the covered processes and credentials.

For example, Read(.env) limits covered file tools, not arbitrary Python code opening that file indirectly. Denying one form of curl is not egress control. Instructions, tool policies, and resource isolation each have a role.

Consequences​

  • I may miss a written convention you treated as a deployed safeguard.
  • You verify one blocked command without checking equivalent actions through other tools.
  • Strict-looking settings leave production credentials writable; a tool policy does not reduce the credentials' own privileges.

What to do instead​

List resources and actions, then assign each hard boundary an enforcement layer.

  1. Use deny/ask for matching calls, starting with the permissions template. Test matches with dummy data.
  2. Use command hooks for checks at specified events. Define events, tool matchers, failure behavior, and timeouts. Fixed triggering does not prove complete validation; model-based hooks still involve judgment.
  3. Use read-only credentials, environment isolation, and a sandbox. Check whether MCP, hooks, and helper processes are inside the boundary.
  4. Keep project knowledge and semantic constraints in instruction files, while giving high-consequence actions external controls too.

Example​

Before:

CLAUDE.md: Do not change production data.
Environment: Production and test are reachable with writable credentials.
Me: I point a cleanup at the wrong environment; the sentence does not intercept it.

After:

CLAUDE.md: Document production/test identifiers and data conventions.
Environment: This task receives test credentials only; no production credentials.
Client: Keep approval on matching pushes and writes; verify the rules.
Me: I can complete the test task but cannot write production with these credentials.

When the exception applies​

Preferences such as “reuse existing helpers where practical” belong in instructions. A semantic rule like “do not affect production” still needs to be stated. When consequences are high, add resource and credential boundaries rather than relying on that sentence alone.

Tool differences​

As of 2026-10-29, Claude Code's CLAUDE.md, Codex's AGENTS.md, Gemini CLI's GEMINI.md, Cursor Rules, and Copilot instruction files must be distinguished from execution controls. Client rules, managed policies, sandboxes, and product surfaces cover different things; a configuration filename does not establish security strength. Cursor explicitly describes its allowlists as convenience, not a security guarantee.

Version notes​

Verified 2026-10-29

This entry distinguishes control layers. Verify syntax, modes, path resolution, and coverage against the installed version; no claim here guarantees all equivalent actions are blocked across every version.

Further reading and sources​