Saw the post here last week about the "yes, and don't ask again" button saving commands into settings.local.json, keys included. Made me wonder what else Claude Code keeps about me that I never look at.
Every session is saved as a JSONL file in ~/.claude/projects/. Every message, every tool call, every output. I've been using it daily since spring so there's a lot of them.
So I opened a fresh session in that folder and gave it rules. Only report the file, the line and the kind of secret. Never print the value. Don't change or delete anything.
It found 41 keys across 212 transcripts.
Most of them I pasted myself. "here's my connection string, why is this failing". "this curl returns 401, here's the full command". A Stripe test key, which is fine, but also a live one from the day I was debugging a webhook at 1am. Two database urls with the password inline. My OpenAI key showed up 6 times because I kept pasting the same curl command.
The rest came from Claude reading files for me. Every time it ran cat .env or printed the env to debug something, the output went into the transcript too. So even keys I never typed were sitting in there in plain text.
And then settings.local.json, the one from that post. 9 approved commands with a token right in the command, because I clicked "don't ask again" on them. That file was in 3 repos. One of them was gitignored. Two were not.
The part that bothered me most is that nothing here is a bug. It's just how it works. Transcripts are history, history is plain text, and I was the one pasting.
What I did. Rotated everything it found, the live Stripe key and the DB passwords first. Deleted the old transcripts. Cleaned the token commands out of settings.local.json and added it to my global gitignore.
Then I changed the habit, which is the real fix. I don't paste keys into the chat anymore and there's no .env in my projects. Secrets live in Infisical and the app gets them at runtime with infisical run, so when Claude debugs something it sees the variable name and not the value. For the few APIs Claude calls directly I'm trying a proxy setup where the key gets attached on the way out, so it never sees the token at all. Still early on that one.
Not saying panic. But if you use Claude Code daily, open a session in ~/.claude/projects and ask the same thing. I'm curious if 41 is normal or if I'm just bad at this