Guide · November 30, 2026

Your AI coding agent's chat logs may be leaking your keys: what to gitignore, find and rotate

On Nov 25, 2026, Backslash Security published a scan of 2,504 public GitHub repos that held chat logs and other files from nine AI coding tools. They found 708 secrets in 255 of them (about 10%), and assessed roughly 200 as likely still working. Most were not pasted by a person: about 7 in 10 got into the log through the agent's own work. (Backslash research)

Why it happens: a chat log records everything. When the agent reads your .env, the whole file goes into the log. When it runs a command, the output goes in too. Nothing is filtered, and the log is plain text.

How the secrets got into the logs

Only 199 of the 708 had a recognizable vendor format. The other 509 (generic tokens, app secrets, passwords, database credentials) don't trigger automatic revocation when they go public.

Three ways a log ends up on GitHub

  1. The tool writes the log inside your project. SpecStory saves chats in .specstory/, so they get committed with the code. Aider writes .aider.chat.history.md in the project but adds it to .gitignore by default.
  2. You back up your home folder. Claude Code, Codex, Gemini CLI and Continue keep logs in ~/.claude, ~/.codex, ~/.gemini, ~/.continue. A public dotfiles repo takes every session from every project with it. Backslash found this path leaks the most per repo.
  3. You export a chat and commit it. Exports from Cline, Roo Code and Copilot CLI are often named cline_task_*.md, roo_task_*.md, copilot-session-*.md.

1. Check your repos, including history

Run this in each repo. It lists agent log files in any commit, not just the current tree:

git log --all --name-only --format= | sort -u | grep -E \
 '(^|/)\.(specstory|claude|codex|gemini|continue)/|\.aider\.chat\.history\.md|(cline_task_|roo_task_|copilot-session-)[^/]*\.md'

Some hits are fine. Teams often commit .claude/settings.json or .claude/commands/ on purpose. Look closely at session logs (.specstory/history/, *.jsonl session files, exported chats) and at .claude/settings.local.json (see our settings.local.json guide).

Then scan the whole history for secrets with gitleaks: gitleaks git --redact -v. Also check your dotfiles repo, if you have one.

2. If you find a secret: rotate first

Deleting the log doesn't help on its own. It stays in your git history and in every fork and clone made before you deleted it. Rotate the key at the provider first, check its usage logs, then clean up (git rm -r --cached, and git filter-repo --path <file> --invert-paths if you want it out of history). Our exposed .env guide has a rotation order that keeps your app running.

3. Stop it happening again

Add the log paths to each repo's own .gitignore, not just your global one, so they're ignored for everyone who clones it:

# AI agent chat logs and exports
.specstory/history/
.aider*
cline_task_*.md
roo_task_*.md
copilot-session-*.md
.claude/settings.local.json

If you don't share agent settings with your team, ignore the whole folders instead (.claude/, .codex/, .gemini/, .continue/), as Backslash suggests.

Our paid repo report now flags committed agent chat logs (critical when one holds a credential) and deleted logs that still hold credentials in git history. For your live app, run the free live-site check to see whether it leaks keys in its JavaScript or serves a .env or .git folder.

The VibePreflight team