---
title: "codes.model-plan@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/codes.model-plan"
updated: null
---

# codes.model-plan@1 · OpenVibe.Services

HTML: [codes.model-plan@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/codes.model-plan)

# CodesModelPlan `codes.model-plan@1`

Generated at 2026-11-13 06:25:48 UTC from [`openvibe-contracts v0.419.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.419.0) and [`openvibe-sdk v0.161.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.161.0).

- Version: 1.0.0
- Owner: codes
- Visibility: public
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/codes/model-plan.v1.json`](/docs/contracts/codes.model-plan.json)

codes.model-plan@1: a versioned execution plan for a Codes task. Roles are attempted in list order. The ladder names AI registry ids in fallback order; auto asks AI to route. A pair requires reviewer approval, a council has two or three planner samples and a judge, and escalation advances on a failed check, refusal, or low confidence.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `mode` | enum | yes |  | - `one of "single", "pair", "council", "escalate"` |
| `roles` | array of object | yes |  | - `minItems 1`<br>- `maxItems 8`<br>- `items: no other fields` |
| `roles[].role` | enum | yes |  | - `one of "planner", "builder", "reviewer", "verifier"` |
| `roles[].model` | string | yes |  | - `pattern ^(auto\|[A-Za-z0-9][A-Za-z0-9._:/@+-]*)$`<br>- `minLength 1`<br>- `maxLength 200` |
| `roles[].effort` | enum | yes |  | - `one of "none", "low", "medium", "high", "xhigh", "max"` |
| `roles[].samples` | integer |  |  | - `minimum 1`<br>- `maximum 5` |
| `roles[].budget` | object |  |  | - `no other fields` |
| `roles[].budget.tokens` | integer |  |  | - `minimum 1`<br>- `maximum 100000000` |
| `roles[].budget.minutes` | number |  |  | - `maximum 1440` |
| `roles[].budget.dollars` | number |  |  | - `maximum 10000` |
| `ladder` | array of string |  |  | - `minItems 1`<br>- `maxItems 8`<br>- `unique items`<br>- `items: pattern ^(auto\|[A-Za-z0-9][A-Za-z0-9._:/@+-]*)$`<br>- `items: minLength 1`<br>- `items: maxLength 200` |
| `checks` | object | yes |  | - `no other fields` |
| `checks.tests` | boolean |  |  |  |
| `checks.lint` | boolean |  |  |  |
| `checks.reviewer` | boolean |  |  |  |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: council

~~~~
{
  "mode": "council",
  "roles": [
    {
      "role": "planner",
      "model": "auto",
      "effort": "high",
      "samples": 3
    },
    {
      "role": "builder",
      "model": "auto",
      "effort": "high"
    },
    {
      "role": "reviewer",
      "model": "auto",
      "effort": "high"
    },
    {
      "role": "verifier",
      "model": "auto",
      "effort": "medium"
    }
  ],
  "checks": {
    "tests": true,
    "reviewer": true
  }
}
~~~~

Valid: escalate

~~~~
{
  "mode": "escalate",
  "roles": [
    {
      "role": "builder",
      "model": "auto",
      "effort": "low"
    },
    {
      "role": "verifier",
      "model": "auto",
      "effort": "medium"
    }
  ],
  "ladder": [
    "openvibe/economy",
    "openvibe/auto"
  ],
  "checks": {
    "tests": true
  }
}
~~~~

Valid: pair

~~~~
{
  "mode": "pair",
  "roles": [
    {
      "role": "builder",
      "model": "auto",
      "effort": "high",
      "budget": {
        "tokens": 100000,
        "minutes": 30,
        "dollars": 2
      }
    },
    {
      "role": "reviewer",
      "model": "openvibe/auto",
      "effort": "medium"
    }
  ],
  "checks": {
    "tests": true,
    "lint": true,
    "reviewer": true
  }
}
~~~~

Rejected: bad-effort

~~~~
{
  "mode": "single",
  "roles": [
    {
      "role": "builder",
      "model": "auto",
      "effort": "ultra"
    }
  ],
  "checks": {
    "tests": true
  }
}
~~~~

Rejected: council-one-sample

~~~~
{
  "mode": "council",
  "roles": [
    {
      "role": "planner",
      "model": "auto",
      "effort": "high",
      "samples": 1
    },
    {
      "role": "builder",
      "model": "auto",
      "effort": "high"
    }
  ],
  "checks": {
    "tests": true
  }
}
~~~~

Rejected: escalate-no-ladder

~~~~
{
  "mode": "escalate",
  "roles": [
    {
      "role": "builder",
      "model": "auto",
      "effort": "low"
    }
  ],
  "checks": {
    "tests": true
  }
}
~~~~

Rejected: pair-no-reviewer

~~~~
{
  "mode": "pair",
  "roles": [
    {
      "role": "builder",
      "model": "auto",
      "effort": "high"
    }
  ],
  "checks": {
    "tests": true
  }
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('codes.model-plan@1', value);   // { valid, errors: [{ path, message }] }
~~~~
