# Agentwhy Session Audit

Checks which private files (.env, keys, secrets) Claude Code and its subagents reached...

- Repository: https://github.com/davepoon/buildwithclaude (3705 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add davepoon/buildwithclaude --skill agentwhy-session-audit -g -a claude-code -y`
Codex: `npx skills add davepoon/buildwithclaude --skill agentwhy-session-audit -g -a codex -y`
Cursor: `npx skills add davepoon/buildwithclaude --skill agentwhy-session-audit -g -a cursor -y`
Gemini CLI: `npx skills add davepoon/buildwithclaude --skill agentwhy-session-audit -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add davepoon/buildwithclaude`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# agentwhy session audit

[agentwhy](https://github.com/karolkozer/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

```bash
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:

The rest: https://github.com/davepoon/buildwithclaude/blob/HEAD/plugins/all-skills/skills/agentwhy-session-audit/SKILL.md
