---
title: One factory, many clients
description: An agency setup. One factory folder, one isolated Clay login and pinned workspace per client, per-client standards and decisions, and shared playbooks. When to split into several factories instead.
---

**Verification:** verified on the twin for client setup, pinning, listing and per-client boards. Live Clay sign-in was not run (details at the bottom).

An agency's risk isn't a bad workflow. It's a good workflow built in the wrong client's workspace. Greenware is built so that can't happen quietly: one client, one Clay login, one pinned workspace, asserted on every Clay call.

## The shape

```text
~/factory/
  factory.yaml                 # one set of knobs for every client (models, budgets, Herdr)
  clients/
    kestrel/                   # Kestrel HR
      client.yaml              # id, name, domain, pinned workspace
      .clay/                   # Kestrel's own Clay login (gitignored)
      CLAUDE.md                # company, ICP, personas, systems: yours to edit
      standards.json / .md     # always-on rules, versioned
      decisions.jsonl / .md    # decisions in force, latest per key wins
      functions.md             # which of Kestrel's Clay functions to reuse
      workspace.json           # audiences, record counts, field ids
      resources.json           # everything Greenware created in Kestrel's workspace
      gold/  suppression/      # holdouts and do-not-reach lists (gitignored)
    orbitly/
      …
  plays/
    kestrel/inbound-01/        # one folder per play: state, events, artifacts, approvals
    orbitly/lookalikes-01/
```

What's shared: the tool itself (stage prompts, the 16 blueprints, the practitioner knowledge, the Clay twin), and `factory.yaml`. What's per client: everything under `clients/<id>/`, and every play. Precedent is per client too: what a play verified or heard from a client at Gate A becomes precedent for that client's next plays, not another client's.

## Onboarding a client

```bash
gw client add kestrel --name "Kestrel HR" --domain kestrel-hr.example
gw client login kestrel           # opens Clay sign-in in this client's own login, then pins its workspace
gw client research kestrel        # reads the workspace (read-only) and researches the company
gw client status kestrel          # what's left
gw client standards kestrel --accept   # after you've read the proposed standards
```

Each client's Clay login lives in `clients/<id>/.clay/` by default (the CLI's `CLAY_CONFIG_HOME`). You don't need `--clay-config-home` unless you keep logins elsewhere. The default folder is gitignored, and a path outside the factory is outside its git repo anyway.

**Pinning is checked.** If a client's login is signed in to several workspaces, `gw client login` lists them and you choose one (`--workspace <id>` when there's no terminal to ask). If the pinned workspace's name doesn't look like the client's (a personal workspace, say), it asks before pinning: "Every play for kestrel would read and build there." Pass `--yes` only after checking. The confirmation is kept in `client.yaml`, so it's asked once.

**Unpinned clients can't start plays.** A play would stop at Build, so `gw idea` refuses up front:

```text
$ gw idea kestrel "route inbound demo requests to the right AE" --id inbound-01 --no-run
gw: Client kestrel has no Clay workspace pinned, so a play would stop at Build. Sign in to its Clay login
    and run gw client pin kestrel (or set it with gw client add kestrel --workspace-id <id>). Checklist: gw client status kestrel
```

## Working across clients

```bash
gw client list                    # every client and its pinned workspace
gw status                         # every play, every client
gw status kestrel                 # one client's board
gw board                          # full-screen, all plays
```

Inside a play's stages, `gw clay …` already knows the client (stages run with the play's client). From your own terminal, set `GW_CLIENT` to choose one. Without it, `gw clay` uses the first client in the list:

```bash
GW_CLIENT=orbitly gw clay audiences list
```

In Herdr every client is its own workspace, `gw:<client>`, with a live board on its first tab, so switching clients is switching workspaces.

## Per-client rules that matter most for agencies

Record these as decisions so no play has to ask:

```bash
gw client decide kestrel alerts.slack.connection "<connection id>, Kestrel's own Slack tenant (checked)"
gw client decide kestrel outreach.sequencer "none: AE rep tasks only"
gw client decide kestrel budget.credits "2,000 credits per month across factory plays"
```

Check the Slack tenant before you record it: a connection in the client's workspace can sit on the agency's Slack, not the client's (field lesson 16). `gw clay app-accounts list --filter type=slack` shows what's connected.

Write `CLAUDE.md`'s "Existing work in this workspace" section for every client: the workflows agents must not touch, and the naming conventions. Greenware only edits what it created (`resources.json`), always named `[GREENWARE] …`, but the planner still needs to know what's already there.

## One factory or several?

`factory.yaml` is per factory, so every client in one factory shares one credit ceiling per play (`maxCreditsPerPlay`), one set of models and effort, one clarify budget and one Herdr session. Split into several factories when clients need different values for those, or when different people should see different clients (a factory is one git repo).

```bash
gw init ~/factories/enterprise    # careful profile: examples/factory/careful.yaml
gw init ~/factories/smb           # cheap profile: examples/factory/cheap.yaml
GW_HOME=~/factories/smb gw status # GW_HOME picks the factory for one command
```

Without `GW_HOME`, `gw` uses the nearest folder above you with a `factory.yaml`, then the factory `gw init` remembered last. `cd` into a factory and its commands use it.

A starting `factory.yaml` for an agency is in [`examples/factory/agency.yaml`](https://github.com/orchidautomation/greenware/blob/main/examples/factory/agency.yaml).

## Git for an agency factory

Keep the factory in its own private repo. `gw init` writes a `.gitignore` that keeps out Clay logins, holdouts, suppression lists, ledgers, the engine's signing secret and per-stage context copies. Commit the rest: client context, standards, decisions and every play's artifacts and approvals are your audit trail when a client asks "what did we approve, and why?". See `docs/git.md`.

## Failure modes

| What you see | What it means | What to do |
|---|---|---|
| `Not pinned: … may not be <client>'s workspace` | The login's workspace name doesn't match the client | Sign the client in to its own workspace; `--yes` only if it really is theirs |
| `… is signed in to 3 workspaces … Choose one` | A shared Clay login | `gw client login <id> --workspace <id>`, or better, a login per client |
| A play for one client reads another client's data | It can't. Every Clay call asserts the pinned workspace | If you see a workspace error mid-play, someone changed the login. Re-pin with `gw client pin <id>` |
| Two clients need different budgets | `maxCreditsPerPlay` is per factory | Two factories |
| `gw clay` answers for the wrong client | No `GW_CLIENT` set, so it used the first client | `GW_CLIENT=<id> gw clay …` |

## Verification

**Verified on the twin** (isolated factory): `gw client add` for three clients (one with `--clay-config-home`, which stores the path as given), `gw client login orbitly` (on the twin it pins without a sign-in, as the source says), `gw client list` showing pinned and unpinned clients, `gw idea` refused for the unpinned client with the message above, and `gw status <client>` showing one client's board. The folder layout is from `src/core/factory.ts` and the README's "What lives where" table.

**Not run:** a real Clay sign-in, the several-workspaces prompt and the name-mismatch prompt (the twin has one workspace), `gw client research`, `gw clay app-accounts list`, Herdr workspaces.
