# Examples

> Complete OCP documents: one run per workflow shape, one with every v0.3 field, and a pass and a fail file for each numbered rule.

Every document on this page is a file in the specification's [`examples`](https://github.com/loopmath/loopmath/tree/main/spec/examples) folder, and every one passes `loopmath ocp validate` with no findings except where a rule file is meant to fail. The values are made up. The shapes are the ones in loopmath's workflow catalog, inlined, so each `configuration.id` is the [canonical id](https://orchestrationcontextprotocol.io/specification/0.3/configuration#configuration-id) of that shape and its settings.

## Workflow shapes

In each diagram the boxes are pieces (units of agent work, with their role), the rounded labels are artifacts they read and write, and a dotted edge is the repair a gate triggers when it rejects.

### solo

One agent implements. The smallest workflow, with a verdict from CI and a runtime score.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  diff(["diff"])
  implement["implement<br/><small>implementer</small>"]
  issue --> implement
  repo --> implement
  implement --> diff
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class implement piece
```

`configuration.id` `cfg_261aaa36000b`; source `usual`; budget 1 round.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `implement.a1`<br />round 1 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| **Run** | | | **344,000 tokens**<br />**$0.99** |

**Acceptance rule** `tests`: tests pass. **Signals:** `tests` verdict `pass` (verified); `runtime_s` score `960.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/solo.ocp.json) (1 attempt, OCP 0.3).

### best_of_n

Three agents implement the same task in parallel (`width` 3) and a referee keeps one result.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  candidates(["candidates"])
  diff(["diff"])
  implement["implement<br/><small>implementer x3</small>"]
  select["select<br/><small>referee</small>"]
  issue --> implement
  repo --> implement
  implement --> candidates
  candidates --> select
  issue --> select
  select --> diff
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class implement,select piece
```

`configuration.id` `cfg_3f65648c26b6`; source `alternative`; budget 1 round; gates `select`.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `implement.a1`<br />round 1 | codex, gpt-6-sol, high | done | 344,000 tokens<br />$0.39 |
| `implement.a2`<br />round 1 | codex, gpt-6-sol, high | done | 344,000 tokens<br />$0.42 |
| `implement.a3`<br />round 1 | codex, gpt-6-sol, high | done | 344,000 tokens<br />$0.45 |
| `select.a1`<br />round 1 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| **Run** | | | **1,376,000 tokens**<br />**$2.25** |

**Acceptance rule** `tests+referee`: tests pass and the referee accepts. **Signals:** `referee` verdict `accept` (reported); `tests` verdict `pass` (verified); `runtime_s` score `1860.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/best_of_n.ocp.json) (4 attempts, OCP 0.3).

### plan_implement

A planner writes a plan and an implementer follows it.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  plan_doc(["plan_doc"])
  diff(["diff"])
  plan["plan<br/><small>planner</small>"]
  implement["implement<br/><small>implementer</small>"]
  issue --> plan
  repo --> plan
  plan --> plan_doc
  issue --> implement
  repo --> implement
  plan_doc --> implement
  implement --> diff
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class plan,implement piece
```

`configuration.id` `cfg_9c77371c53df`; source `habit`; budget 1 round.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `plan.a1`<br />round 1 | claude-code, claude-opus-5-5, xhigh | done | 344,000 tokens<br />$0.99 |
| `implement.a1`<br />round 1 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.13 |
| **Run** | | | **516,000 tokens**<br />**$1.12** |

**Acceptance rule** `tests`: tests pass. **Signals:** `tests` verdict `pass` (verified); `runtime_s` score `1740.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/plan_implement.ocp.json) (2 attempts, OCP 0.3).

### implement_review

An implementer, then a reviewer whose rejection sends the change back once (`control.repair`).

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  diff(["diff"])
  verdict(["verdict"])
  implement["implement<br/><small>implementer</small>"]
  review["review<br/><small>reviewer</small>"]
  issue --> implement
  repo --> implement
  implement --> diff
  diff --> review
  issue --> review
  review --> verdict
  review -. repair .-> implement
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class implement,review piece
```

`configuration.id` `cfg_ab15440a2d9c`; source `usual`; budget 3 rounds; gates `review`.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `implement.a1`<br />round 1 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| `review.a1`<br />round 1 | codex, gpt-6-astra, xhigh | rejected | 344,000 tokens<br />$0.77 |
| `implement.a2`<br />round 2 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| `review.a2`<br />round 2 | codex, gpt-6-astra, xhigh | done | 344,000 tokens<br />$0.77 |
| **Run** | | | **1,376,000 tokens**<br />**$3.52** |

**Acceptance rule** `tests+review`: tests pass and the reviewer approves. **Signals:** `review` verdict `reject` (reported); `review` verdict `accept` (reported); `tests` verdict `pass` (verified); `runtime_s` score `3300.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/implement_review.ocp.json) (4 attempts, OCP 0.3).

### plan_implement_review

Plan, implement, then review, with a repair loop the run did not need.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  plan_doc(["plan_doc"])
  diff(["diff"])
  verdict(["verdict"])
  plan["plan<br/><small>planner</small>"]
  implement["implement<br/><small>implementer</small>"]
  review["review<br/><small>reviewer</small>"]
  issue --> plan
  repo --> plan
  plan --> plan_doc
  issue --> implement
  repo --> implement
  plan_doc --> implement
  implement --> diff
  diff --> review
  issue --> review
  plan_doc --> review
  review --> verdict
  review -. repair .-> implement
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class plan,implement,review piece
```

`configuration.id` `cfg_9f823d1b1d85`; source `exploration`; budget 3 rounds; gates `review`.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `plan.a1`<br />round 1 | claude-code, claude-opus-5-5, xhigh | done | 344,000 tokens<br />$0.99 |
| `implement.a1`<br />round 1 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| `review.a1`<br />round 1 | codex, gpt-6-astra, xhigh | done | 344,000 tokens<br />$0.77 |
| **Run** | | | **1,032,000 tokens**<br />**$2.75** |

**Acceptance rule** `tests+review`: tests pass and the reviewer approves. **Signals:** `review` verdict `accept` (reported); `tests` verdict `pass` (verified); `runtime_s` score `2520.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/plan_implement_review.ocp.json) (3 attempts, OCP 0.3).

### swarm

A planner, three workers in parallel, and a reviewer that sends the work back once.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  plan_doc(["plan_doc"])
  diff(["diff"])
  verdict(["verdict"])
  plan["plan<br/><small>planner</small>"]
  work["work<br/><small>worker x3</small>"]
  review["review<br/><small>reviewer</small>"]
  issue --> plan
  repo --> plan
  plan --> plan_doc
  issue --> work
  repo --> work
  plan_doc --> work
  work --> diff
  diff --> review
  issue --> review
  plan_doc --> review
  review --> verdict
  review -. repair .-> work
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class plan,work,review piece
```

`configuration.id` `cfg_3c53469b7f4a`; source `user_edit`; budget 3 rounds; gates `review`.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `plan.a1`<br />round 1 | claude-code, claude-opus-5-5, xhigh | done | 344,000 tokens<br />$0.99 |
| `work.a1`<br />round 1 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.13 |
| `work.a2`<br />round 1 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.14 |
| `work.a3`<br />round 1 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.16 |
| `review.a1`<br />round 1 | codex, gpt-6-astra, xhigh | rejected | 344,000 tokens<br />$0.77 |
| `work.a4`<br />round 2 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.13 |
| `work.a5`<br />round 2 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.14 |
| `work.a6`<br />round 2 | claude-code, claude-fable-5-1, medium | done | 172,000 tokens<br />$0.16 |
| `review.a2`<br />round 2 | codex, gpt-6-astra, xhigh | done | 344,000 tokens<br />$0.77 |
| **Run** | | | **2,064,000 tokens**<br />**$3.39** |

**Acceptance rule** `tests+review`: tests pass and the reviewer approves. **Signals:** `review` verdict `reject` (reported); `review` verdict `accept` (reported); `tests` verdict `pass` (verified); `runtime_s` score `4320.0` (verified).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/swarm.ocp.json) (9 attempts, OCP 0.3).

### full-fields

The implement and review shape with every field v0.3 adds filled in: task features, signals including a late event and an unmeasured score, a slate, a preference and a receipt.

```mermaid
flowchart LR
  issue(["issue"])
  repo(["repo"])
  diff(["diff"])
  verdict(["verdict"])
  implement["implement<br/><small>implementer</small>"]
  review["review<br/><small>reviewer</small>"]
  issue --> implement
  repo --> implement
  implement --> diff
  diff --> review
  issue --> review
  review --> verdict
  review -. repair .-> implement
  classDef piece fill:#0F766E,stroke:#0F766E,color:#ffffff
  class implement,review piece
```

`configuration.id` `cfg_ab15440a2d9c`; source `exploration`; budget 3 rounds; gates `review`.

| Attempt | Setting | Status | Cost |
|---|---|---|---|
| `implement.a1`<br />round 1 | claude-code, claude-opus-5-5, xhigh | done | 344,000 tokens<br />$0.99 |
| `review.a1`<br />round 1 | codex, gpt-6-astra, xhigh | rejected | 344,000 tokens<br />$0.77 |
| `implement.a2`<br />round 2 | claude-code, claude-opus-5-5, high | done | 344,000 tokens<br />$0.99 |
| `review.a2`<br />round 2 | codex, gpt-6-astra, xhigh | done | 344,000 tokens<br />$0.77 |
| **Run** | | | **1,376,000 tokens**<br />**$3.52** |

**Acceptance rule** `tests+review+runtime`: tests pass, the reviewer approves and the run finishes under 60 minutes. **Signals:** `review` verdict `reject` (reported); `review` verdict `accept` (reported); `tests` verdict `pass` (verified); `runtime_s` score `3300.0` (verified); `quality` score `null` (asserted); `issue` event `issue/431` (reported).

[Full document on GitHub](https://github.com/loopmath/loopmath/blob/main/spec/examples/v0.3/full-fields.ocp.json) (4 attempts, OCP 0.3).

## Rule pairs

Each numbered v0.3 rule has a pass file and a fail file in [`examples/golden/v0.3`](https://github.com/loopmath/loopmath/tree/main/spec/examples/golden/v0.3). Apart from its id and title, the fail file differs from the pass file only in what breaks the rule, and `expected.json` lists the codes each file must produce. A checker conforms to a rule when it reports exactly those codes. The tables show that difference; the message is what `loopmath ocp validate` prints.

### [E190](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e190)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.configuration.settings.implement.effort` | `"high"` | `"xhigh"` |

```text E190-fail.ocp.json
  error E190 $['run']['configuration']['id']: configuration id 'cfg_261aaa36000b' is not the canonical hash of its workflow and settings ('cfg_ebcc7a1d9137'); see loopmath.ocp.canonical
```

### [E191](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e191)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.configuration.id` | `"cfg_ab15440a2d9c"` | `"cfg_1c618686576b"` |
| `$.run.configuration.settings.review.context_policy` | `"fresh"` | `(absent)` |
| `$.run.configuration.settings.review.effort` | `"xhigh"` | `(absent)` |
| `$.run.configuration.settings.review.harness` | `"codex"` | `(absent)` |
| `$.run.configuration.settings.review.model.id` | `"gpt-6-astra"` | `(absent)` |
| `$.run.configuration.settings.review.model.raw` | `"gpt-6-astra"` | `(absent)` |
| `$.run.configuration.settings.review.options` | `{}` | `(absent)` |

```text E191-fail.ocp.json
  error E191 $['run']['configuration']['settings']: piece 'review' has no setting; every piece vertex has one
```

### [E192](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e192)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.configuration.id` | `"cfg_9c77371c53df"` | `"cfg_e4e353faecd0"` |
| `$.run.configuration.workflow.edges[7][0]` | `(absent)` | `"diff"` |
| `$.run.configuration.workflow.edges[7][1]` | `(absent)` | `"plan"` |

```text E192-fail.ocp.json
  error E192 $['run']['configuration']['workflow']['edges']: workflow edges contain a cycle through: diff, implement, plan, plan_doc; the repair loop belongs in control.repair
```

### [E193](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e193)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.configuration.id` | `"cfg_ab15440a2d9c"` | `"cfg_5d8a7e22679c"` |
| `$.run.configuration.workflow.control.repair.review` | `"implement"` | `"plan"` |

```text E193-fail.ocp.json
  error E193 $['run']['configuration']['workflow']['control']['repair']['review']: repair target 'plan' names no piece of the workflow
```

### [E194](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e194)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.preferences[0].members[0]` | `"run_golden_e194_pass"` | `"run_golden_e194_fail"` |
| `$.run.preferences[0].slate` | `"slt_ex_full"` | `"slt_other"` |
| `$.run.preferences[0].winner` | `"run_golden_e194_pass"` | `"run_golden_e194_fail"` |
| `$.run.slate.members[0]` | `"run_golden_e194_pass"` | `"run_golden_e194_fail"` |

```text E194-fail.ocp.json
  error E194 $['run']['preferences'][0]['slate']: preference names slate 'slt_other' but this run is in slate 'slt_ex_full'
```

### [E195](https://orchestrationcontextprotocol.io/specification/0.3/conformance#e195)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.signals[0].value` | `"reject"` | `"approved"` |

```text E195-fail.ocp.json
  error E195 $['run']['signals'][0]['value']: verdict 'review' has value 'approved'; a verdict is one of accept, error, fail, pass, reject
```

### [W182](https://orchestrationcontextprotocol.io/specification/0.3/conformance#w182)

| Path | Pass file | Fail file |
|---|---|---|
| `$.run.ext["dev.dagr.note"]` | `(absent)` | `"extension under the pre-rename namespace"` |
| `$.run.ext["dev.loopmath.note"]` | `"extension under the loopmath namespace"` | `(absent)` |

```text W182-fail.ocp.json
  warning W182 $['run']['ext']['dev.dagr.note']: extension key 'dev.dagr.note' uses the pre-rename namespace 'dev.dagr.'; it is still read through v0.4, write 'dev.loopmath.' instead
```

### [W196](https://orchestrationcontextprotocol.io/specification/0.3/conformance#w196)

| Path | Pass file | Fail file |
|---|---|---|
| `$.producer.name` | `"loopmath"` | `"example-orchestrator"` |
| `$.run.preferences[0].members[0]` | `"run_golden_w196_pass"` | `"run_golden_w196_fail"` |
| `$.run.preferences[0].winner` | `"run_golden_w196_pass"` | `"run_golden_w196_fail"` |
| `$.run.slate.members[0]` | `"run_golden_w196_pass"` | `"run_golden_w196_fail"` |

```text W196-fail.ocp.json
  warning W196 $['run']['receipt']: run.receipt is written only by loopmath, but producer.name is 'example-orchestrator'
```
