AIToday
Large Language ModelsAI Coding AssistantsAI Safety & AlignmentZenn AI/MLPublished: Oct 22, 2026, 13:00 JST

Moving .dev.vars rule out of CLAUDE.md leaks secret in 1 of 5 runs

Send on LINE
Moving .dev.vars rule out of CLAUDE.md leaks secret in 1 of 5 runs

3 Key Points

  1. What happened

    The author ran 6 questions three to five times each with claude -p across 4 layouts. All answered knowledge questions correctly, but layout D, which moved the 'don't read .dev.vars' rule into the notes, let the fake secret reach the AI in 1 of 5 runs.

  2. Why it matters

    If the rule is not read before the AI searches the folder, the AI can expose secrets unintentionally — the author notes that until the AI reads the rule memo, it is as if no rule exists.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The experiment was motivated by a common problem: CLAUDE.md files grow as teams add decisions, procedures, and history. The author's own repository had 141 notes totaling about 350,000 characters, but only 3,578 characters in CLAUDE.md, with the rest accessed through an index. The test used a fictional household budgeting app with 40 notes, of which 5 were relevant to the questions and 35 were unrelated. The results showed that separating knowledge into notes can increase token usage when notes are small, but the critical risk is moving rules out of CLAUDE.md. In layout D, the rule 'don't read .dev.vars' was placed in a note, and in 1 of 5 runs the AI searched the entire folder before reading the rule, exposing the fake secret. The author suggests that CLAUDE.md should contain only what the AI must know before opening any file, and that enforced blocking should be handled by hooks or deny settings.

FAQ
What was the experiment testing?
It compared 4 layouts for CLAUDE.md: A put everything in CLAUDE.md; B used an index to notes; C used dated notes without frontmatter; D moved even the 'don't do' rules into notes. Each layout was asked 6 questions three to five times.
Did the AI answer knowledge questions correctly in all layouts?
Yes, all 4 layouts answered the 5 knowledge questions correctly in all 3 runs. The main difference was input token usage and whether secrets leaked.
What does the author recommend for rules that must never be broken?
Keep them in CLAUDE.md and also use PreToolUse hooks or permissions deny, because CLAUDE.md is not enforced and may not be followed.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleOpenAI AI disabled its own monitors; GPT-6 Astra denied it