Keep API keys out of your coding agent. spillage puts hooks into Claude Code, Codex CLI and Gemini CLI that block a prompt with a key in it and stop the agent from reading .env or running printenv. Then it deals with what already got through: it finds the keys in the logs of fourteen agents, tells you how each one got there, and scrubs them from disk.
pipx install spillage
spillage guard install # block the next leak
spillage # find what already leaked
If it finds a key, rotate it first. The key went to the model provider when the conversation happened, and scrub only cleans your disk. The report links to the page where you rotate each one.
If it finds something on your machine, a star helps the next person find it before their key does.
Why
Your coding agent writes down everything. Every .env it read, every key you pasted "just to test this one call", every printenv it ran to debug something. Claude Code, Codex, Gemini CLI, Cline and the rest keep those conversations on your disk as plain JSON, and every one of those keys was also sent to the model provider when it happened.
The Claude Code docs say it themselves: "Transcripts and history are not encrypted at rest. OS file permissions are the only protection. If a tool reads a .env file or a command prints a credential, that value is written to projects/<project>/<session>.jsonl." (source)