Developer Tools

AI Coding Agent Generated Files: What Should Never Reach Git?

Coding agents create screenshots, logs, traces and temporary artifacts that can accidentally enter commits. Use this practical Git privacy checklist and a safe canary test before opening a PR.

AiFolder Editorial Team

AiFolder Editorial Team

8 min read

AI Coding Agent Generated Files: What Should Never Reach Git?

AI coding agents do more than edit source code. They run browsers, take screenshots, capture traces, write plans, save logs and generate temporary files. Those artifacts can contain more private context than the code change itself—and Git will happily track them if your workflow allows it.

Security note: the test below uses fake canary data in a synthetic project. Do not deliberately expose real credentials or private screenshots to test an agent.

The artifact inventory

Before adding an agent to a repository, list everything it may generate: screenshots, screen recordings, Playwright traces, browser profiles, HAR files, terminal transcripts, prompt/session logs, patch backups, downloaded fixtures, coverage reports and debug dumps.

Why screenshots deserve special treatment

A screenshot can include names, email addresses, account balances, internal URLs, tokens rendered in admin pages, customer records or another application visible behind a window. Unlike source code, image content is not obvious in a text diff.

A safe agent privacy test

  1. Create a synthetic UI containing a visible marker such as AIFOLDER_CANARY_DEMO.
  2. Ask the agent to fix a harmless UI issue and verify it visually.
  3. Run git status --short after the task.
  4. Inspect every new binary and log artifact.
  5. Check what the agent stages when asked to prepare—not push—a commit.
  6. Repeat after adding artifact rules.

Recommended repository policy

# Agent-generated local artifacts
.agent-artifacts/
playwright-report/
test-results/
*.har
*.trace.zip
*.screen.webm

# Keep intentional fixtures explicitly
!tests/fixtures/approved/

Patterns vary by stack. Do not blindly copy this block if your repository intentionally versions matching files.

Put the rule in agent instructions too

Gitignore is the hard backstop; agent instructions improve behavior. Tell the agent to store visual verification and traces in a dedicated ignored directory, never stage them automatically, and request approval before adding a new binary asset.

Pre-commit checks

A lightweight hook can reject unexpected large files and known artifact paths. Secret scanners complement this but do not replace artifact policy: a private screenshot may contain sensitive information that does not match a secret regex.

PR review checklist

  • Review git diff --stat and untracked files, not only text diffs.
  • Open every newly added image or recording.
  • Check HAR and trace archives for headers and request bodies.
  • Confirm browser profiles and session storage are excluded.
  • Delete local artifacts after the task when retention is unnecessary.

Agent benchmark extension

AiFolder will use the canary workflow to compare coding agents on artifact location, default staging behavior, warning behavior and cleanup. Results remain pending until the same fixture is run under controlled versions.

Related guides

Topics

AiFolder Editorial Team

Written by

AiFolder Editorial Team

AiFolder tests practical AI tools and developer workflows with reproducible methodology and clearly labeled first-hand results.

Continue reading

More articles

View all