
Agentwhy Session Audit
Checks which private files (.env, keys, secrets) Claude Code and its subagents reached...
Install
npx skills add davepoon/buildwithclaude --skill agentwhy-session-audit -g -a claude-code -y- Repository
- davepoon/buildwithclaude3.7k
- Category
- AI and agents
- Updated
- 3d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 1,692 tokens
- Runs scripts
- No, instructions only
What it does
Checks which private files (.env, keys, secrets) Claude Code and its subagents reached in this project, whether a value came into an agent's context, and which key to change, by running the open source agentwhy CLI over the session records Claude Code already keeps on disk. Use when the user asks whether the agent or a subagent read their .env or other secrets, which private files a session touched, whether a key leaked into the conversation, or which key to rotate. Runs locally and never prints a secret value.
agentwhy session audit
agentwhy (Apache 2.0, npm @agentwhy/cli) reads the session records Claude
Code keeps on disk, including each subagent's own transcript, and says which private files were reached and how. It
works by fixed rules: no AI model, no account, no network request once the package is installed. Values are replaced
before the report is built, so its output names files, never their contents. It needs Node 22 or later.
By default it treats these as private: .env*, *.env, .npmrc, secrets/, .ssh/, id_rsa*.
Run every command below from the folder Claude Code was started in, the project root. If command -v agentwhy finds
it installed, use agentwhy in place of npx -y @agentwhy/cli@0.4.1. The first npx run downloads that pinned
version from npm; agentwhy never updates itself.
Which command to run depends on what the user asked:
- A question ("did an agent read my .env?", "which key do I change?", "did anything leak?"): run
check(section 1) and answer it here. - A request for the report ("show me the report", "open agentwhy", "what happened session by session"), or a question about Codex sessions: open the page (section 2).
If either command answers that no sessions are stored for this directory, the user is in a different folder from the one they worked in. Ask which folder it was and run it there.
1. Answer a question: the short check
npx -y @agentwhy/cli@0.4.1 check
It covers Claude Code sessions (Codex's are on the page), writes nothing, and exits 0 whatever it found. Options:
--since 30d or --since 2026-09-01 for another range, --full for who reached each file, the task that led there
and the rule that would close the route, --share for paths relative to the project root.
It prints one line per file, the strongest finding first:

