---
title: "Concepts"
description: "The words Greenware uses, and what each one is on disk. Factory, client, play, stages, gates, contract, clayx, twin, runners and the maestro."
sidebar:
  icon: lightbulb
---

Greenware is file-based. Everything below is a folder or a file you can read, diff and commit.

## Factory

The folder that holds your clients and plays, made by `gw init` (or `gw start`). It has a [`factory.yaml`](/reference/configuration), a `clients/` folder, a `plays/` folder, and a private `.greenware/` folder for the engine's signing secret and caches.

```txt
~/factory/
  factory.yaml
  clients/acme/          one folder per client
  plays/acme/<play>/     one folder per play
  .greenware/            engine-only: signing secret, stage settings, maestro briefs
```

`gw` finds the factory from `GW_HOME`, else the nearest folder above you with a `factory.yaml`, else the one `gw init` remembered. So once you have one, `gw status` works from any folder. Keep it in its [own private git repo](/guides/factory-in-git).

## Client

One company you build for. **One client, one Clay login, one workspace.** The client's folder holds:

| File | What |
| --- | --- |
| `client.yaml` | id, name, domain, the pinned `clayWorkspaceId` and its name, and where its isolated Clay login lives (`.clay/`) |
| `CLAUDE.md` | company, ICP, personas, systems, suppression rules, existing workflows agents must not touch. Yours: written once at onboarding, then only proposed changes (`CLAUDE.proposed.md`) |
| `research/brief.md` | positioning, ICP critique, buying signals, competitors, 3–5 recommended plays, kickoff questions |
| `functions.md` | which of the workspace's Clay functions to reuse for which job, and which to avoid |
| `standards.json` | always-on rules every plan must map (`customer.definition`, `reach.company.exclude`, …), versioned, with golden records |
| `decisions.md` | decisions in force (`outreach.sequencer = instantly`); history in `decisions.jsonl` |
| `workspace.json` | saved audiences, record counts, field ids and types (or `audiencesAvailable: false`) |
| `resources.json` | everything Greenware created in the workspace, with the play and stage |
| `gold/` | holdouts: labeled records only the Verify stage reads |
| `suppression/` | factory-held suppression lists, for [workspaces without Audiences](/guides/no-audiences) |
| `ledger.jsonl` | every Clay call, with its class and result |

See [Onboarding a client](/guides/onboarding).

## Play

One idea on its way to a live workflow, addressed as `<client>/<play>` (for example `acme/lookalikes-01`). A play is a folder under `plays/<client>/<play>/` holding:

- `state.json`: the stage, status, attempts, build loops and spend. Engine-owned and signed.
- `events.jsonl`: every event (stage starts and ends, tool calls, Clay calls, answers, gate decisions). `gw logs` reads it.
- the artifacts each stage writes: `breakdown.md`, `questions.json`, `research.md`, `spec.md`, `contract.json`, `plan.md`, `workflow.mmd`, `prereqs.json`, `build.json`, `verification.md`, `audit.md`, `deliverables/` and more.
- `approvals/`: signed gate decisions. `feedback/`: your comments and rulings, which later stages obey.

### Status

| Status | Meaning |
| --- | --- |
| `ready` | The engine may run the current stage |
| `running` | A runner is executing the current stage |
| `waiting_human` | The stage needs you: answers at Clarify, or a suppression list at Plan |
| `gate` | Waiting on your approval at Gate A or Gate B |
| `manual` | The engine gave up after retries; a person must step in |
| `blocked` | An external prerequisite is missing (auth, wrong workspace, a stage pane that never started) |
| `stopped` | Taken off the active board with `gw stop`; `gw retry` resumes it |
| `done` | The pipeline finished |

## Stages

Twelve steps in a fixed order. Ten run an agent or the engine; two are your gates.

| Stage | Writes | Model tier | Clay access |
| --- | --- | --- | --- |
| Decompose | `breakdown.md`, `breakdown.json` | strong | read |
| Clarify | `questions.json` | strong | read |
| Research | `research.md`, `requirements.json` | mid | read, segment |
| Spec + Contract | `spec.md`, `contract.json` | strong | read, segment |
| Plan | `plan.md`, `workflow.mmd`, `prereqs.json` | strong | read, segment |
| **Gate A** | your approval | | read, segment, schema (the engine applies `prereqs.json`) |
| Build | `build.json`, `build.md` | mid | read, segment, build |
| Verify | `verification.json`, `verification.md` | mid | read, segment, build, spend |
| Audit | `audit.json`, `audit.md` | mid | read |
| **Gate B** | your approval | | none |
| Publish | `published.json`, `ops.md` | engine step, no agent | read, gated (publish) |
| Document | `deliverables/README.md` | mid | read |

Each stage's output is checked by deterministic code (`src/core/validate.ts`), never by an LLM. An invalid artifact makes the attempt `flawed`: the stage runs once more with the validation errors, and if that fails too the play goes to `manual`. There is no fallback that hides a failed stage.

**Clarify** asks at most 5 questions a round (`maxQuestionsPerRound`) over at most 2 rounds (`maxClarifyRounds`). It answers what it can from your client context and marks those `answered by agent`; you see them, and the ones only you can answer, each with a recommended default.

**Build → Verify → Audit** loops: a failed check sends the play back to Build with a fix list, up to `maxBuildLoops` (3). After Audit passes, Build applies the plan's `golive.md` edits (for example switching a test-mode constant to production), Verify reads them back, and the play goes to Gate B.

## Gates

Two points where only a person decides.

- **Gate A** approves the spec, the pass/fail contract, the plan (graph, cost, function reuse) and the prerequisites. On approval, the engine (never an agent) creates the fields and audiences `prereqs.json` asks for and records their ids in a signed `setup.json`.
- **Gate B** approves publishing one exact snapshot of the built workflow: the one Verify tested and Audit reviewed.

An approval is bound to a hash of what you reviewed: `spec.md`, `contract.json` (its definitions, not verdicts), `plan.md`, `workflow.mmd`, `prereqs.json` and `golive.md` for Gate A; `verification.md`, `audit.md` and `snapshot.json` for Gate B. **Change any of them afterwards and the approval is void.** Approvals are signed with the factory's secret, so a file an agent wrote is refused.

When the planner needs a ruling (it writes `needs-ruling.md`, or a requirement is blocked), Gate A requires your rulings as `--comment`. See [Running plays](/guides/running-plays#gate-a).

## Contract

`contract.json` is the play's pass/fail test, written at Spec and frozen at Gate A. It has at least three assertions. One from the lookalikes play:

```json
{
  "id": "A2",
  "statement": "Temporal backtest: >= 60% of last-45-day closed-won rank in top 20% when seeded from 46-135 days ago",
  "kind": "holdout",
  "evidence": "verification over gold/closed_won.csv",
  "tool": "gw clay workflows test-data run",
  "threshold": "recall@20% >= 0.60",
  "status": "pending"
}
```

- `kind`: `deterministic` (checkable from the graph or a run), `holdout` (scored against labeled `gold/` records) or `judgment`.
- `status`: `pending`, then `claimed` by Build, then `passed`, `failed` or `unverified` from Verify's verdicts. Only the engine writes verdicts.

Anything Verify couldn't verify is shown to you at Gate B.

## Standards, decisions and holdouts

- **Standards** are always-on client rules: who counts as a customer, who never to reach, the default persona and ICP. Every plan must map each one in its `## Standards` section, and the contract needs an assertion tagged `std:<key>` that runs each standard's golden records. `gw client standard`, `gw client standards`.
- **Decisions** are settled choices (`outreach.sequencer = instantly`). The latest per key wins and every stage reads `decisions.md`. `gw client decide`.
- **Holdouts** ("gold") are labeled records in `clients/<id>/gold/*.jsonl`, exported from a saved audience or a CRM CSV. Only Verify can read them, so the builder can't fit to the test. `gw client gold`.

## clayx

Every Clay call goes through `clayx` (`src/clay/`), the only path to the official `clay` CLI. Agents call it as `gw clay …`; a raw `clay` command is denied. It:

- classifies each command against Clay's real command tree into a class: **read**, **segment** (saved `[GREENWARE]` audiences: free, change no records), **schema** (a `[GREENWARE]` field), **build** (draft edits only), **spend** (test runs, costs credits), **gated** (publish, delete, sequences, webhooks…) or **never** (login, logout, api-keys, credits top-up, workspace switching). Unknown commands fail closed as gated.
- allows each stage only its classes (the table above). The planner can't build; the builder can't publish.
- asserts the client's pinned workspace on every non-read call.
- enforces the play's credit budget (`maxCreditsPerPlay`).
- writes every call to the client's ledger and the play's events.

See the [security model](/reference/security).

## Twin

A stateful digital twin of the Clay Workflows CLI, with a catalog of real-shaped action schemas. It reproduces the traps real builds hit: edge lists replaced wholesale on update, `graph validate` exiting 0 when invalid, unmapped required inputs, missing default routes. With `clay: twin` (or `GW_CLAY=twin`) the whole pipeline runs with no Clay account and no credits. Twin clients need no Clay login; `gw client add <id> --workspace-id ws_demo` is enough.

## Runners

How a stage's agent runs. Runners produce artifact files; they never decide transitions.

| Runner | What runs | Use it for |
| --- | --- | --- |
| `headless` (default) | `claude -p` per stage, under your own Claude Code login, with stage-scoped tool permissions | Real plays from a terminal or a server |
| `herdr` | an interactive Claude Code pane per stage, in the play's Herdr tab | Watching and steering stages live. See [Herdr](/guides/herdr) |
| `scripted` | recorded fixtures, no model calls | Tests, demos and twin walk-throughs |

Set it with `runner:` in `factory.yaml`, `gw init --runner`, or `GW_RUNNER`.

## The maestro

Under Herdr, each play tab has a maestro: a Claude Code session on the left that you talk to about the play. It tells you where the play stands, asks you its questions one at a time and records your answers, summarises each gate, and explains failures. It runs `gw approve`, `gw reject`, `gw reopen`, `gw stop` or `gw retry` only when you tell it to, and Claude Code asks you to confirm each. Turn it off with `herdr.maestro: false`.
