You're not going to stop using AI coding tools — they're too productive. The realistic posture is hygiene, not abstinence.
The pre-flight checklist (once per repo)
- Add ignore-files for every agent you use. One per tool:
.cursorignore,.claudeignore,.aiderignore, etc. List secrets and DB files. - Verify by asking the agent to list the repo's files. The blocked files should not appear. Test this; don't assume.
- Move all real secrets to keychain or runtime env. Replace
.envvalues with<FROM_KEYCHAIN>placeholders. - Add a pre-commit hook that scans for secrets.
gitleaks,trufflehog, or even a simple regex set. The hook fires before the commit lands. - Tell the agent your conventions. A short rules file that says "never embed secrets in code; always use the get_secret() helper" reduces (not eliminates) the suggestion-pattern leak.
The per-session habits
| Habit | Why |
|---|---|
| Don't paste real stack traces with credentials | Redact connection strings before pasting |
| Don't paste production logs verbatim | Logs leak request IDs, internal IPs, sometimes tokens in URLs |
| Treat the chat transcript as public | Don't share screenshots without scanning for secrets first |
| Disable memory features for repos with sensitive context | Cross-session bleed is hardest to audit |
| Periodically purge agent chat history | Reduces the attack surface if the provider is breached |
The worst things you can tell the agent
- "Read my .env and verify these keys look right." — You just put every secret in the request.
- "Why isn't this connection working?" + paste of full connection string — Now the password is in the transcript.
- "Set up a deploy script that uses my AWS credentials." — Suggestion will hardcode them.
- "Generate a config file with all my real values filled in." — You asked for the leak.
The best habit
Speak in placeholders. "Why isn't $DB_URL connecting? Here's the format: postgres://USER:PASS@HOST:PORT/DB." The agent reasons about the shape, not the secret. Your transcript stays clean.