---
title: Run Screenplay specifications with Cratis CLI
editUrl: https://github.com/Cratis/cli/edit/main/Documentation/reference/specs.md
description: Run the specifications a Screenplay model declares with cratis specs, select one by address or semantic id, read the text or JSON report, and handle exit codes.
lastUpdated: 2026-12-05T00:00:00.000Z
---


`cratis specs` runs the specifications a Screenplay model declares and reports which ones hold. It answers a different question from [`cratis screenplay validate`](/cli/reference/screenplay/): validate asks whether the model binds, while `specs` executes each `Given`/`When`/`Then` example against the Screenplay reference evaluator and reports pass, fail or unsupported.

```bash
cratis specs [PATH] [--filter ADDRESS_OR_ID] [--format text|json]
```

```bash
cratis specs
cratis specs ./screenplays
cratis specs ./screenplays --filter Projects.Registration.Register.RegisteringAProject
cratis specs ./screenplays --format json
```

The command only reads. It writes no file, starts no container, contacts no service and never executes code attached to the model — a specification whose outcome depends on an attached C# body is reported as `unsupported` with the capability the evaluator lacks, not run.

The run itself is the Screenplay library's own reference evaluator, reached through the same embedded Screenplay MCP server [`cratis screenplay mcp`](/cli/reference/screenplay-mcp/) serves. The CLI opens the model, hands the evaluator that workspace and reports what comes back, so the addresses, the semantic ids, what `--filter` selects, the counts, the failure detail and the plan issues are the library's, not a second implementation of them in the CLI. A run therefore agrees with the Screenplay MCP and with the standalone tool by construction; the one judgement the CLI adds is the outcome for a model that declares no specifications, below.

## Arguments

| Argument | Description |
| --- | --- |
| `PATH` | A model folder, whose `.play` files are one application, or a single `.play` file, which selects that file and the imports it resolves — not unrelated siblings. Defaults to the current directory. |

## Options

| Option | Description |
| --- | --- |
| `--filter <ADDRESS_OR_ID>` | Run one specification instead of all of them. Takes its exact, case-sensitive dotted address or its exact semantic id. |
| `--format <FORMAT>` | `text` (the default, even when redirected) or `json`, case-sensitive. `--format json` writes the report as one compact line. |
| `-o/--output <FORMAT>` | The generic CLI report format: `plain` and `table` select text, `json` and `json-compact` select JSON. `-o json` indents the report; `-o json-compact` writes one line. If both this and `--format` are given, they must agree. |

Global options such as `-o/--output` are also accepted — see [Global Options](/cli/reference/global-options/).

## Which specifications run

Every specification the model declares is discovered, whichever kind it is — the slice specifications written inside a slice, and the specifications a state machine, workflow or graph declares. `discovered` counts all of them, and each is reported by its own address. A slice specification's address is `Module[.Feature…].Slice.Specification`.

`--filter` matches one specification exactly, by that address or by its semantic id. A module, feature or slice address is **not** a scope selector here: it matches no specification, so the run is refused with exit `2` rather than narrowed. Addresses are case-sensitive, so a lowercased address is refused too.

## The report

Both forms report the same run. JSON holds these fields, in this order:

| Field | Description |
| --- | --- |
| `sourceRevision` | The revision of the source the run read, in the form `source:…`. |
| `outcome` | `passed`, `failed`, `unsupported`, `unbound` or `none` — lowercase. |
| `discovered` | Specifications the model declares. |
| `selected` | Specifications the selection covers. |
| `executed` | Selected specifications the evaluator could run. An unsupported one is not counted here. |
| `passed`, `failed`, `unsupported` | How the selected specifications came out. An unsupported run is never counted as failed. |
| `diagnostics` | The model's executable diagnostics: `severity` (`Information`, `Warning` or `Error` — PascalCase), `code`, `message`, `location` with `line`, `column` and `path`, and `arguments`. |
| `planIssues` | What the evaluator could not plan, as the Screenplay library reports it. |
| `results` | One row per selected specification. |

Each row in `results` holds:

| Field | Description |
| --- | --- |
| `address` | The dotted specification address. |
| `semanticId` | The specification's semantic id, or `null` for a specification that has none. |
| `outcome` | `passed`, `failed` or `unsupported` — lowercase. |
| `executionOutcome` | `Accepted`, `Rejected` or `Unsupported` — PascalCase — or `null` where the evaluator reports no execution. |
| `failures` | What did not hold, one entry per difference, or why the evaluator stopped. |
| `capability` | The capability the evaluator lacks, when the run is unsupported; otherwise `null`. |
| `reason` | Why that capability is needed, when the run is unsupported; otherwise `null`. |

The text report writes the model's diagnostics as `path(line,column): Severity CODE: message`, then one `outcome: address` line per specification with each failure indented two spaces beneath it — and, for an unsupported run, a final `Capability: reason` line — and ends with the counts:

```text
application.play(11,11): Information PLAY0469: Event 'ProjectRegistered' copies command identifier 'code' into payload property 'code' although it already identifies the event source
passed: Projects.Registration.Lookup.ShowingARegisteredProject
passed: Projects.Registration.Register.RegisteringAProject
passed: Projects.Registration.Register.RejectingAShortCode
passed: 3 discovered, 3 selected, 3 executed; 3 passed, 0 failed, 0 unsupported
```

The report goes to standard output in both forms. A usage error, an unknown selection and a read refusal go to standard error, and nothing is written to standard output.

## Identities

A folder's persisted `.screenplay/identities.json` supplies the semantic ids, exactly as it does for [`cratis screenplay export` and `cratis screenplay diff`](/cli/reference/screenplay/), so the ids in the report are the ones [Screenplay MCP](/cli/reference/screenplay-mcp/) reports for the same model. A specification that [`cratis screenplay rename`](/cli/reference/screenplay/) has renamed keeps its identity, so the report names it at its new address with its original id.

Without a catalog, and for a single `.play` file with its imports, identities are derived in memory. Like export and diff, the command neither creates nor repairs a catalog, and it refuses a catalog that no longer maps the model rather than running with derived ids — restore the mapped paths, or move the documents through an MCP proposal.

That refusal is shared rather than chosen per command: Screenplay itself refuses to open such a folder, with the same `IdentityMappingConflict`, so there is no derived read a specification run could fall back to. The standalone tool reaches the same folder by its own route and runs it with derived ids; here, a stale catalog is a refusal for every command that reads a model.

## Exit codes

| Exit | Condition |
| --- | --- |
| `0` | Every selected specification passed, and at least one specification was discovered. |
| `1` | At least one selected specification failed. |
| `2` | A usage error, an unknown `--filter` selection, or a refused read. |
| `3` | The model does not bind (`unbound`), nothing failed but something is unsupported (`unsupported`), or the model declares no specifications (`none`). |

These codes mirror the standalone Screenplay tool rather than the CLI's [shared exit codes](/cli/reference/global-options/), so `3` here means "nothing conclusive ran", not a server error.

## The name, and the standalone tool

These are specifications, not tests: they are the `Given`/`When`/`Then` examples the model itself declares, and running them checks the model against what it says it does. The CLI names the command for that — `cratis specs`, a top-level command beside [`cratis run`](/cli/reference/run/), not a subcommand of `cratis screenplay`.

The standalone Screenplay tool runs the same evaluator over the same model, but at Screenplay 7.1.0 still names it `screenplay test`. Renaming it to `screenplay specs` belongs to the [Screenplay repository](https://github.com/Cratis/Screenplay) and is tracked there; this page uses the standalone command's current name until that lands, and the CLI's own name does not change when it does.

Two differences between the two commands are deliberate, and both were checked against Screenplay 7.1.0:

| | `cratis specs` | `screenplay test` |
| --- | --- | --- |
| A bound model declaring no specifications | `none`, exit `3` — a run that checked nothing proves nothing | `passed`, exit `0` |
| A folder whose identity catalog no longer maps it | Refused, exit `2`, as `cratis screenplay export` and `diff` refuse it | Runs with derived ids, exit `0`, though its own `screenplay export` refuses the same folder |

Otherwise the two agree: on passing, failing, unsupported and unbound models, and on a selection that matches nothing, both forms of the report were compared byte for byte against Screenplay 7.1.0 and the exit codes matched.

See the [Screenplay compiler reference](https://github.com/Cratis/Screenplay/tree/main/Documentation/screenplay) for the specification language, and the [standalone tool reference](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/tool.md) for `screenplay test`.
