---
title: "Configuration"
description: "Every factory.yaml key with its default, client.yaml, and the environment variables gw reads."
sidebar:
  icon: settings
---

## factory.yaml

`gw init` writes a `factory.yaml` at the factory root with every default filled in:

```yaml
schema: greenware.factory/v1
runner: headless
clay: live
maxClarifyRounds: 2
maxQuestionsPerRound: 5
maxStageAttempts: 2
maxBuildLoops: 3
maxCreditsPerPlay: 500
models:
  strong: opus
  mid: sonnet
agents:
  mcpAllow:
    - mcp__firecrawl
  effort:
    strong: medium
    mid: medium
  mcpStages:
    - research
herdr:
  stageTimeoutMs: 2700000
  maestro: true
```

The schema lives in `src/core/schemas.ts` (`FactoryConfig`). A key you leave out takes its default. An invalid file stops every command with `factory.yaml in <root> is invalid: …`. Stage agents can't read or edit `factory.yaml`.

### Top level

| Key | Default | What it does |
| --- | --- | --- |
| `schema` | `greenware.factory/v1` | Required, exactly this value |
| `runner` | `headless` | How stages run: `headless` (`claude -p`), `herdr` (live panes) or `scripted` (fixtures). See [runners](/concepts#runners). `GW_RUNNER` overrides it |
| `clay` | `live` | `live` uses the real Clay CLI; `twin` uses the [twin](/concepts#twin). `GW_CLAY` overrides it |
| `maxClarifyRounds` | `2` | Rounds of questions Clarify may ask before it must plan with what it has |
| `maxQuestionsPerRound` | `5` | Questions per Clarify round |
| `maxStageAttempts` | `2` | Attempts per stage; an invalid artifact gets one retry with the validation errors, then the play goes to `manual` |
| `maxBuildLoops` | `3` | Build → Verify/Audit → Build loops before the play stops for a person |
| `maxCreditsPerPlay` | `500` | Hard ceiling on Clay data credits a play may spend in test runs before Gate B. clayx refuses spend commands past it (`budget_exhausted`) |

`gw init [folder] --runner <r> --clay <c>` sets `runner` and `clay` when it creates the file.

### models

Which Claude model each tier of stage runs on. Values are anything Claude Code's `--model` accepts (`opus`, `sonnet`, `haiku`, or a full model id).

| Key | Default | Used by |
| --- | --- | --- |
| `models.strong` | `opus` | Decompose, Clarify, Spec + Contract, Plan, and client research (`gw client research`) |
| `models.mid` | `sonnet` | Research, Build, Verify, Audit, Document, the function shortlist (`gw client functions`) and the maestro |

`gw client research --model <m>` and `gw client functions --model <m>` override the model for one run.

:::note[In review, not merged: per-stage models (PR #17)]
A change in review lets `models` take the same keys as `agents.effort`: `strong`, `mid`, any agent stage (`decompose`, `clarify`, `research`, `spec`, `plan`, `build`, `verify`, `audit`, `document`), and `onboarding`, `shortlist` and `maestro` for the agents outside the pipeline. An agent's own key beats its tier's, an unknown key such as `verfy` fails loading with the valid keys listed, and `gw models` prints each agent's model and effort and which key set it. Until it merges, `models` takes only `strong` and `mid`, and `agents.effort` takes tiers and stage ids.
:::

### agents

| Key | Default | What it does |
| --- | --- | --- |
| `agents.mcpAllow` | `[mcp__firecrawl]` | MCP tools agents may call, as Claude Code permission rules (`mcp__<server>` allows a whole server). Agents load your MCP servers, but only these run. Leave out connectors that send or write (mail, LinkedIn, CRM) |
| `agents.mcpStages` | `[research]` | Stages that get the `mcpAllow` tools. A stage that can build, spend or publish in Clay never gets them, even if listed, and a stage that has them can't read record contents from Clay. See the [security model](/reference/security#web-tools-and-record-contents) |
| `agents.effort` | `{strong: medium, mid: medium}` | Claude Code `--effort` per tier (`strong`, `mid`) or per stage id (`build`, `verify`, …). A stage key wins over its tier. Values: `low`, `medium`, `high`, `xhigh`, `max`. Lower effort thinks less per turn: faster and cheaper. Client research uses `research` (else `strong`), the function shortlist uses `mid`, and the maestro runs at Claude Code's default |

```yaml
agents:
  effort:
    strong: high     # Decompose, Clarify, Spec, Plan
    mid: medium
    verify: high     # this stage only
```

### herdr

Used when `runner: herdr`. See [Herdr](/guides/herdr).

| Key | Default | What it does |
| --- | --- | --- |
| `herdr.session` | unset | A named Herdr session. Unset means the default session (or `HERDR_SESSION`) |
| `herdr.stageTimeoutMs` | `2700000` (45 min) | How long a stage agent may run before the runner gives up |
| `herdr.maestro` | `true` | A [maestro](/concepts#the-maestro) pane in every play tab |

## client.yaml

Each client has `clients/<id>/client.yaml`, written by `gw client add` and `gw client login`:

```yaml
schema: greenware.client/v1
id: acme
name: Acme
domain: acme.com
clayWorkspaceId: ws_7f3
clayWorkspaceName: Acme
clayConfigHome: .clay
```

| Key | What it is |
| --- | --- |
| `id` | Lowercase letters, digits and dashes; part of paths and Herdr names |
| `name` | Display name |
| `domain` | The primary web domain; onboarding research starts from it |
| `clayWorkspaceId` | The pinned Clay workspace. Every non-read Clay call asserts it. One client, one login, one workspace |
| `clayWorkspaceName` | The workspace's name in Clay as of the last pin; shown in status and checked against the client's name |
| `clayWorkspaceConfirmed` | Set when a person confirmed a workspace whose name doesn't look like the client's |
| `clayConfigHome` | `CLAY_CONFIG_HOME` for this client's isolated Clay login (default `.clay`, relative to the client folder) |

## Environment variables

| Variable | What it does |
| --- | --- |
| `GW_HOME` | The factory root to use, instead of searching up from the current folder or the remembered factory |
| `GW_RUNNER` | Override `runner` for this command: `headless`, `herdr` or `scripted` |
| `GW_CLAY` | Override `clay` for this command: `live` or `twin` |
| `GW_SCENARIO` | The twin and scripted scenario (default `lookalikes`; also `no-audiences`) |
| `GW_CLIENT` | The client `gw clay` uses when run by a person outside a play (default: the first client) |
| `GREENWARE_STATE_DIR` | Per-user state: the remembered factory, the demo factory and the Clay CLI install (default `~/.greenware`) |
| `GW_CLAUDE_BIN` | The Claude Code binary (default `claude`) |
| `GW_CLAY_BIN` | The Clay CLI binary (default `clay`) |
| `HERDR_SESSION` | The Herdr session when `herdr.session` is unset |
| `CLAUDE_CONFIG_DIR` | Where Claude Code keeps its config; folder trust reads and writes `.claude.json` there |

`GW_PLAY` and `GW_STAGE` are set by the engine for each stage agent, so `gw clay` knows which play and stage permissions apply. Don't set them yourself. A `gw clay` call without them runs as a person (`human`): reads, saving `[GREENWARE]` audiences and adding `[GREENWARE]` fields.

The installer's own settings (`GREENWARE_HOME`, `GREENWARE_SKIP_CLAUDE`, …) are on the [install page](/install#installer-settings).

Try a factory on the twin without editing `factory.yaml`:

```bash
GW_RUNNER=scripted GW_CLAY=twin gw status
```

For a throwaway sandbox that never touches your real factory or `~/.greenware`:

```bash
export GREENWARE_STATE_DIR="$(mktemp -d)"
gw init "$(mktemp -d)/factory" --runner scripted --clay twin
```
