← sources

Does your Explore subagent ever grep its way into .env? Looking for 10 people to check their history

source: reddit (reddit:ClaudeCode)published 2026-10-14 15:03ingested 2026-10-15 02:42

retained text

About a month ago I found out one of my Explore subagents had pulled part of a .env value into the main conversation, and I want to know if it's just me.

what happened: my `AGENTS.md` had a rule at the top, never open or read `.env*`, "not even partially", "regardless of the reason". I'd removed an old "unless the user asks" exception right before. then I asked Claude Code to debug a webhook returning 500. the main agent handed part of it to an Explore subagent, and the task it wrote ended with "confirm what URL and secret it's configured to use".

the subagent never called Read on a .env file. it grepped for the variable name. the command didn't mention .env, so no deny rule had anything to match, but the grep output was `.env.development:NN:VAR=value`. part of that value went into its report to the main agent. the main agent flagged it before answering me, which is the only reason I noticed.

what I tested afterwards my setup, yours may differ:

- the subagent starts from the task, not from your conversation. "confirm the secret" in the task beats the rules file
- same day, a similar task with "do NOT read or report any actual secret VALUES, only confirm presence/absence of the key NAME" came back with just "the key exists". the word *read* matters, "don't quote values" still lets it open the file
- permissions.deny on Read held, subagents included, but the refused read fired no PreToolUse or PermissionDenied event. my audit hook saw nothing
- permissions.deny on Bash matches command text. `python3 -c "print(open(...).read())"` walked past my cat/grep/head list. only the sandbox (sandbox.filesystem.denyRead) covered Bash
- the whole story is in `~/.claude/projects/`, main transcript plus one jsonl per subagent, refused reads included. nobody reads that by hand

So I wrote a CLI that does. it reconstructs which protected files a session or its subagents reached, the task that led there, and whether the value came back up. reads Claude Code and Codex records, local only, no network, never prints a value, Apache 2.0. I'm the author, so call that the disclosure.

works offline, so if you don't trust it, turn wifi off and run it. one runtime dependency, source is in the repo (link in comments).

n=1 so far. what I'm asking:

- run this once:

        npx @agentwhy/cli

- reply with the section headings and counts only. no paths, no values, no project names. a comment with just numbers is fine, a 15 min call is better if you're up for it
- I'll publish the aggregate ("N machines, M had something") with no names

I care most about what it gets wrong: something flagged that isn't a secret, or a read you know happened that it missed.

should have said this up front. it's only been run on my Mac, in Claude Code/Codex's terminal. VS Code, the desktop apps and Windows aren't tested yet, and it needs Node 22+. if you're on Windows or WSL and it breaks, the error message (no paths) is exactly what I need.

document fetched 2026-10-15 00:43 · canonical https://reddit.com/r/ClaudeCode/comments/1x5tkxl/does_your_explore_subagent_ever_grep_its_way_into