# Agent Settings

> The Agent Settings are configuration files that control a coding agent's permissions, hooks, environment and defaults.

## How are AI coding agents configured?

The configuration files of an agent, usually at user, project and local levels, with the more specific level taking priority. Contain permission rules, hooks, environment variables and model defaults, and project settings are shared through the repository.

- Topic: Agent Customization
- Type: concept

## Example

Wrong:

```json
{
  "env": {
    "DATABASE_URL": "postgres://admin:secret@prod-db/app"
  }
}
```

Right:

```json
{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./secrets/**)"]
  },
  "env": {
    "NODE_ENV": "development"
  }
}
```

Shared project settings hold only safe defaults and deny rules; credentials go into local files that are ignored by git.

## Key points

- Shared project settings contain no secrets: those go to local, ignored files.
- Permission rules deny reading '.env' and other secret files.

## Interview questions

### Which agent settings level wins?

The more specific level usually wins: local project settings override shared project settings, which override user settings.

### Should I commit agent settings to git?

Commit shared project settings so the team gets the same permissions and hooks. Keep personal or secret settings in a local file listed in '.gitignore'.

### Where do I put API keys for an agent?

In environment variables or a local settings file that is not committed. Never put them in shared settings or instruction files.

## Related cards

- [Agent Permissions](https://wonderium.dev/ai/agent-permissions.md)
- [Agent Hooks](https://wonderium.dev/ai/agent-hooks.md)
- [.env](https://wonderium.dev/processes/env.md)
- [.gitignore](https://wonderium.dev/processes/gitignore.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/agent-settings
- Last updated: 2026-11-25
