Is itCheck something

How do I keep secrets safe when using AI coding agents?

Reviewed answer

An agent can read and run whatever you can. Keep keys out of reach and check commands first.

  1. Start the agent inside one project folder, never your home folder.
  2. Keep live keys out of files the agent can read. Use test keys in .env files and store real ones in your system's password or secret store.
  3. Read each command before approving it, especially ones that install packages, use the network, or delete files.
  4. Treat web pages, issues, and repos the agent reads as untrusted. They can contain hidden instructions.
  5. If a key ever appeared in a chat, log, or commit, revoke it and make a new one.

Get help if

If an agent ran a command you didn't expect or sent data somewhere unfamiliar, stop it, revoke any keys it could see, and check your cloud bills.

More in the ai agent kit.

All answers Ask something else