# agent

An agent is a name and a compose list of layer modules.

```
{ layers, ... }:
{
  name = "writer";
  description = "What this agent is for.";
  compose = [
    layers.notes
    layers.git
  ];
}
```

The file lives at `agents/<name>/default.nix`. Do not list `base`. Eval prepends it.

## Fields

| Field | Type | Default | Meaning |
| --- | --- | --- | --- |
| name | string | `default` | Agent identity. |
| description | string | empty | What this agent is for. |
| avatar | string | empty | Public HTTPS URL. Empty falls back to `assets/avatars/avatar-<name>.png` or a generated SVG. |
| compose | list of module | `[]` | Layer modules in order. Later entries override on conflict. |
| dir | string | `.agent` | Output directory for materialized artifacts. |
| triggers | attrs of trigger | `{}` | Agent-level triggers. Applied after the layer compose. Later name wins. |
| disableNativeTools | bool | `false` | Deny built-in harness tools and keep collected layer tools. ORed with any layer that sets it. |

## Invariants

- If a layer named `base` exists, the resolved compose list is `base` plus `compose`. You do not list `base`.
- `disableNativeTools` is ORed with any layer that sets it.

## Failure modes

- A cycle in layer `compose` fails eval.
- A missing `layers.git` fails eval with `layer 'git' is not in this workspace`. Add it with `rig add git@latest` or `rig new layer git`.
- Two providers on one agent may not share a route path. See triggers.

## How to check

Needs a workspace whose flake calls `rig.lib.workspace`.

```
rig inspect writer
rig build writer
```

`rig inspect` prints a block that starts with `=== agent: <name> ===` and includes `compose (declared)`, `compose (resolved)`, skills, harnesses, and per-layer counts.

## Related

- Layer: https://rig.slopkit.dev/raw/layer.md
- Create an agent: https://rig.slopkit.dev/raw/create-agent.md
- Triggers: https://rig.slopkit.dev/raw/triggers.md
- `rig build`: https://rig.slopkit.dev/raw/cli.md
