arXiv:2608.23550cs.HCAug 2026

Manuscript Offprint

arXiv:2608.23550

When "Do Not" Is Not Deny: Security Rules in CLAUDE.md vs Built-In Controls

Ting Yan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ting Yan

Abstract—In CLAUDE.md, “do not” is a natural-language instruction that the model interprets. Claude Code’s deny is a built-in control that blocks an action before the agent can take it. Both can express the same security goal, but they control the agent in different ways. We measure this gap in 481 public CLAUDE.md files. An LLM matched the extracted candidate rules against Claude Code’s documented controls, and two security practitioners independently checked a sample without seeing the model’s answers or each other’s labels. Depending on how closely a control had to match the written rule, only about 4–16% of the retrieved security rules had a matching built-in control. Under the strictest standard the estimate was 4.4% (95% CI: 2.6–6.7%), and the two annotators agreed closely on which rules had a match. A manual review of complete files found that our extraction method captured 66.3% of eligible security rules; the reported rates therefore apply to the rules it captured. This is a usable security problem: CLAUDE.md is a write-only channel. A developer writes a security rule but gets no feedback on whether a control will enforce it. The same plain-text form hides two kinds of rule: those a permission rule, mode, or sandbox can enforce, and those left to the model to interpret.

I. INTRODUCTION

Large language models have lowered the barrier to building software. Many people now build applications and coding agents with little security experience, and they increasingly direct those agents in natural language. Agent instruction files such as CLAUDE.md and AGENTS.md extend this to security: a developer writes a rule like “never write secrets to logs,” “ask before deleting production data,” or “only push through the review branch,” in plain prose, and the agent reads it. But this is a write-only channel. In ordinary software, stating a requirement comes with feedback that closes the loop: code compiles or fails, tests pass or fail, and logs show what ran, so a developer can tell whether the requirement took effect. A natural-language security rule returns nothing back, and neither the file nor the agent application signals whether anything will enforce it.

Behind that silence, the rules divide into two kinds. Some match a built-in control, such as a permission rule or a sandbox restriction, that the platform applies directly. Others are only text for the model to interpret, unless a team adds a hook, script, or other check. Claude Code documents the split: CLAUDE.md shapes what the model attempts, whereas permission rules and related controls determine what the platform permits [1]. Prior evidence shows why it matters: shipped command denylists are 69.0 to 98.6% fragile, and removing one declared-scope sentence raises an agent's out-of-scope action rate from 0.0 to 17.1% [2]. Rules with and without a matching control share the same natural-language form.

Several groups of studies lead to our question, but none answers it. First, studies of agent instruction files describe what developers write. Agent READMEs [3] reports security content in 14.8% of files, and a study of 12,110 Cursorrules files [4] also finds security content uncommon. These studies show that security rules appear in real files, but they do not check whether each rule has a matching control. Second, systems such as ContextCov [5] and Prose2Policy [6] turn natural-language instructions or policies into executable checks or code. They show that a new control can be built from text. Our question comes before that step: does Claude Code already provide a built-in control for the rule? Third, studies of agent permission systems examine which controls products provide and how users apply them [7]. They start from controls that already exist, rather than from security rules that developers have written. As a result, they do not tell us how many written rules can use an existing control and how many remain text for the model. A recent review also identifies the writing of agent security rules as an open problem [2]. We address one concrete part of it by measuring the fraction of real CLAUDE.md security rules that match a built-in Claude Code control without extra code.

We collected 481 public repositories that contain CLAUDE.md. We split each file into lines or sentences and kept segments with predefined rule words such as “must,” “never,” or “do not.” An LLM answered two questions for each segment. Could ignoring it cause a security or privacy harm? If so, does Claude Code already provide a built-in control that can apply the same rule without extra code? Two security practitioners independently reviewed the same 180 segments without seeing the model’s answers. We selected 60 segments from each of three groups created by the model: not security-related, security-related without a matching control, and security-related with a matching control. These groups occur at different rates in the full dataset, so we gave each group weight based on its actual size. We used these weights to estimate the share of security rules found by our extraction method that have a matching built-in control.

Consider two rules a developer might write. “Never run npm publish” can be matched by a deny permission rule and checked before the command runs; “never put customer secrets in logs” needs the model to decide what counts as a secret and whether an output is a log. The first is applied deterministically, the second depends on the model’s interpretation, yet both are ordinary sentences the developer writes and moves past. To learn which protection a rule actually has, a developer must leave the file and read the permission and sandbox documentation. So a developer can finish writing a security rule without realizing a separate control is still needed, and a secret can reach a log even though the file says “never.” Usable security research treats this as a design problem: security tools should help people make safe choices rather than place all the security work on them [8], [9], and developers are users of these tools too [10].

The closest study, by Michael and Roesner, examines permission interfaces in five commercial agents, including Claude Code [7]. It asks what controls each product provides and where those controls fall short. We start from the other side. For each security rule that a developer wrote in CLAUDE.md, we ask whether Claude Code already provides a built-in control that matches it. This different starting point produces different evidence. Michael and Roesner show that commercial agents are missing some controls. We analyze 481 public files and count how often a written security rule has no matching control. Our main result is therefore a percentage, rather than a list of missing product features. We also group the rules by the security issue they address, such as authorization, destructive actions, and secrets.

This paper makes two contributions:

  1. We measure this gap in 481 public CLAUDE.md files. Our extraction method found 4,661 candidate segments, and the classifier marked 870 as security-related. Depending on how closely a built-in control had to match the written rule, only about 4–16% of the retrieved security rules had a match. We also group the rules by the security issue they address, such as authorization, destructive actions, and secrets.

  2. We identify a usable security problem: CLAUDE.md is a write-only security channel. The same natural-language form covers rules the platform enforces and rules left to the model to interpret, and neither the file nor the agent shows which is which, so writing a rule gives no feedback on whether it is enforced.

Our replication package includes the list of sampled repositories, the labeling instructions, and the analysis code.

RQ: Among the security rules found by our extraction method in public CLAUDE.md files, what percentage have a matching built-in Claude Code control that can apply the same rule without extra code?

References (47)