# org.cairnsproto.draft.policy

> The rules that turn evidence into confidence and credit. A policy that extends another overrides only the fields it sets.

- Kind: record
- Record key: tid
- Authority: draft.cairnsproto.org
- Lexicon: 1
- Published by [cairnsproto.org](https://lexicon.garden/identity/did:plc:np7ezqujtsry4bkogisaabul), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.policy)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.policy/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:np7ezqujtsry4bkogisaabul/org.cairnsproto.draft.policy/analytics)

## Record (`org.cairnsproto.draft.policy`)

Type: record · key tid

### Properties

- `activationDelay` (integer): Epochs after a timekeeper first sees a version before additions to its executable surface take effect.
  - Constraints: minimum: 0, default: 24
- `blind` (boolean): Payloads are timelock-encrypted to the round that closes the epoch.
  - Constraints: default: false
- `calibration` (array): A per-setup weight curve from gold passes: each stone's model weight is multiplied by the weightPpm of the step with the most goldPasses its setup has reached. A setup below every step keeps full weight. Absent, gold scores only inform.
  - Constraints: maxLength: 32
  - `items` (ref)
    - Reference: `#calibrationStep`
- `canonicalizers` (array)
  - Constraints: maxLength: 256
  - `items` (ref)
    - Reference: `#canonicalizer`
- `confidence` (ref): Check that maps tallies to [low, high] per candidate. Absent means the built-in Beta-share interval.
  - Reference: `com.atproto.repo.strongRef`
- `createdAt` (string · datetime, required)
- `credit` (ref)
  - Reference: `#credit`
- `deny` (array): Weight 0 in this reading, including agents through sponsor links.
  - Constraints: maxLength: 10000
  - `items` (string · did)
- `dormancy` (integer): Epochs maintainer-only work may wait unanswered before the project is dormant.
  - Constraints: minimum: 1, default: 720
- `draw` (ref)
  - Reference: `#draw`
- `escalation` (array)
  - Constraints: maxLength: 64
  - `items` (string · did)
- `extends` (ref)
  - Reference: `com.atproto.repo.strongRef`
- `judges` (array)
  - Constraints: maxLength: 64
  - `items` (ref)
    - Reference: `#judge`
- `labelers` (array): Labelers the policy trusts, and which of each one's labels it honors with their standard effects.
  - Constraints: maxLength: 64
  - `items` (ref)
    - Reference: `#labeler`
- `mergeOrgs` (boolean): Members of one organization count as one sponsor: draws are keyed on the org, an org with a stone at a site can't be drawn for it, and agreeing reads from its members count once. Orgs that share a member count as one.
  - Constraints: default: false
- `models` (ref)
  - Reference: `#models`
- `nullSampling` (ref)
  - Reference: `#nullSampling`
- `priorities` (array)
  - Constraints: maxLength: 1024
  - `items` (ref)
    - Reference: `#priority`
- `requiredChecks` (array): A candidate that fails a required check has a low bound of 0.
  - Constraints: maxLength: 64
  - `items` (ref)
    - Reference: `com.atproto.repo.strongRef`
- `retraceBudget` (integer): Automatic retraces per site. A new distinct value schedules more.
  - Constraints: minimum: 0, default: 3
- `snapshotCadence` (integer): Epochs a maintainer may go without a snapshot while the values past the export bar differ from the latest snapshot's. Absent, snapshots are never due.
  - Constraints: minimum: 1
- `thresholds` (ref)
  - Reference: `#thresholds`
- `timekeepers` (array)
  - Constraints: maxLength: 16
  - `items` (string · did)

## #builtinCanonicalizer (`org.cairnsproto.draft.policy#builtinCanonicalizer`)

Type: object

Built-in steps applied in order to every string value in the payload. Object keys, $type, $link and $bytes are never changed.

### Properties

- `steps` (array, required)
  - Constraints: minLength: 1, maxLength: 8
  - `items` (string)
    - Constraints: maxLength: 64, knownValues: identity | text | integerStrings | lowercase

## #calibrationStep (`org.cairnsproto.draft.policy#calibrationStep`)

Type: object

### Properties

- `goldPasses` (integer, required)
  - Constraints: minimum: 0
- `weightPpm` (integer, required)
  - Constraints: minimum: 0, maximum: 1000000

## #canonicalizer (`org.cairnsproto.draft.policy#canonicalizer`)

Type: object

How payloads of one schema become candidate values. Stones whose canonical values are equal are the same candidate. Schemas without an entry use identity.

### Properties

- `schema` (ref, required)
  - Reference: `org.cairnsproto.draft.defs#hash`
- `using` (union, required)
  - One of: `#checkCanonicalizer`, `#builtinCanonicalizer`

## #checkCanonicalizer (`org.cairnsproto.draft.policy#checkCanonicalizer`)

Type: object

A WASM check that maps a payload to its canonical value.

### Properties

- `check` (ref, required)
  - Reference: `com.atproto.repo.strongRef`

## #courseSelector (`org.cairnsproto.draft.policy#courseSelector`)

Type: object

### Properties

- `course` (string, required): A course id from the project.
  - Constraints: maxLength: 128

## #credit (`org.cairnsproto.draft.policy#credit`)

Type: object

### Properties

- `attemptWeightPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 50000
- `dedup` (boolean): Open-scope dedup: a new site earns placement credit only if no earlier site matches it.
  - Constraints: default: false
- `flowBack` (ref)
  - Reference: `#flowBack`
- `pebbleWeightPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 500000
- `volunteeredWeightPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 500000

## #draw (`org.cairnsproto.draft.policy#draw`)

Type: object

### Properties

- `drawnToRaise` (integer): Agreeing drawn retraces needed before the low bound can rise without an anchor.
  - Constraints: minimum: 1, default: 1
- `epochRounds` (integer): drand quicknet rounds per epoch. 1200 rounds of 3 seconds is one hour.
  - Constraints: minimum: 1, default: 1200
- `startThresholdPpm` (integer): Starting draw threshold T; doubles each epoch without a drawn retrace.
  - Constraints: minimum: 0, maximum: 1000000, default: 31250
- `volunteeredWeightPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 500000
- `windowEpochs` (integer): How long a drawn sponsor has to deliver.
  - Constraints: minimum: 1, default: 24

## #flowBack (`org.cairnsproto.draft.policy#flowBack`)

Type: object

### Properties

- `capMultiple` (integer): Flow-back is capped at this multiple of a stone's own credit.
  - Constraints: minimum: 0, default: 5
- `sharePpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 250000

## #judge (`org.cairnsproto.draft.policy#judge`)

Type: object

### Properties

- `minJudges` (integer)
  - Constraints: minimum: 1, default: 1
- `prompt` (ref, required)
  - Reference: `org.cairnsproto.draft.defs#hash`
- `schema` (ref, required)
  - Reference: `org.cairnsproto.draft.defs#hash`

## #labeler (`org.cairnsproto.draft.policy#labeler`)

Type: object

### Properties

- `did` (string · did, required)
- `labels` (array, required): Label values honored from this labeler, such as bad-actor, exclude, recheck, unsafe or tag:<name>.
  - Constraints: minLength: 1, maxLength: 64
  - `items` (string)
    - Constraints: maxLength: 128

## #modelWeight (`org.cairnsproto.draft.policy#modelWeight`)

Type: object

### Properties

- `family` (string, required)
  - Constraints: maxLength: 256
- `thinking` (array)
  - Constraints: maxLength: 16
  - `items` (string)
    - Constraints: maxLength: 64
- `versions` (array)
  - Constraints: maxLength: 64
  - `items` (string)
    - Constraints: maxLength: 128
- `weightPpm` (integer, required)
  - Constraints: minimum: 0, maximum: 1000000

## #models (`org.cairnsproto.draft.policy#models`)

Type: object

### Properties

- `accept` (array)
  - Constraints: maxLength: 256
  - `items` (ref)
    - Reference: `#modelWeight`
- `defaultWeightPpm` (integer): Weight for stones from unlisted models.
  - Constraints: minimum: 0, maximum: 1000000, default: 0
- `sameSetupWeightPpm` (integer): Extra weight on each agreeing read beyond the first from one setup (model, modelVersion and config hash) at a site.
  - Constraints: minimum: 0, maximum: 1000000, default: 1000000

## #nullSampling (`org.cairnsproto.draft.policy#nullSampling`)

Type: object

Sampling for nulls without segments: initialPpm at first, then sampleNumerator/n after n passes, never below floorPpm.

### Properties

- `floorPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 100000
- `initialPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 1000000
- `poolClearSamples` (integer): Passing samples that clear a pool for final credit.
  - Constraints: minimum: 1, default: 60
- `sampleNumerator` (integer)
  - Constraints: minimum: 1, default: 3

## #priority (`org.cairnsproto.draft.policy#priority`)

Type: object

### Properties

- `need` (integer, required): Relative need. Weights routing and placement credit.
  - Constraints: minimum: 0
- `selector` (union, required)
  - One of: `#courseSelector`, `#siteSelector`

## #siteSelector (`org.cairnsproto.draft.policy#siteSelector`)

Type: object

### Properties

- `site` (ref, required): Site key.
  - Reference: `org.cairnsproto.draft.defs#hash`

## #thresholds (`org.cairnsproto.draft.policy#thresholds`)

Type: object

Bars on the low bound of the leading candidate's interval.

### Properties

- `exportPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 950000
- `finalizeCreditPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 900000
- `minFamilies` (integer): Model families a candidate's agreeing reads must come from before it clears the open-children or export bar. A read that declares no model is a family of its own sponsor.
  - Constraints: minimum: 1, default: 1
- `openChildrenPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 800000
- `stopRoutingPpm` (integer)
  - Constraints: minimum: 0, maximum: 1000000, default: 990000

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "builtinCanonicalizer": {
      "description": "Built-in steps applied in order to every string value in the payload. Object keys, $type, $link and $bytes are never changed.",
      "properties": {
        "steps": {
          "items": {
            "knownValues": [
              "identity",
              "text",
              "integerStrings",
              "lowercase"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "maxLength": 8,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "steps"
      ],
      "type": "object"
    },
    "calibrationStep": {
      "properties": {
        "goldPasses": {
          "minimum": 0,
          "type": "integer"
        },
        "weightPpm": {
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "goldPasses",
        "weightPpm"
      ],
      "type": "object"
    },
    "canonicalizer": {
      "description": "How payloads of one schema become candidate values. Stones whose canonical values are equal are the same candidate. Schemas without an entry use identity.",
      "properties": {
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "using": {
          "refs": [
            "#checkCanonicalizer",
            "#builtinCanonicalizer"
          ],
          "type": "union"
        }
      },
      "required": [
        "schema",
        "using"
      ],
      "type": "object"
    },
    "checkCanonicalizer": {
      "description": "A WASM check that maps a payload to its canonical value.",
      "properties": {
        "check": {
          "ref": "com.atproto.repo.strongRef",
          "type": "ref"
        }
      },
      "required": [
        "check"
      ],
      "type": "object"
    },
    "courseSelector": {
      "properties": {
        "course": {
          "description": "A course id from the project.",
          "maxLength": 128,
          "type": "string"
        }
      },
      "required": [
        "course"
      ],
      "type": "object"
    },
    "credit": {
      "properties": {
        "attemptWeightPpm": {
          "default": 50000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "dedup": {
          "default": false,
          "description": "Open-scope dedup: a new site earns placement credit only if no earlier site matches it.",
          "type": "boolean"
        },
        "flowBack": {
          "ref": "#flowBack",
          "type": "ref"
        },
        "pebbleWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "volunteeredWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "draw": {
      "properties": {
        "drawnToRaise": {
          "default": 1,
          "description": "Agreeing drawn retraces needed before the low bound can rise without an anchor.",
          "minimum": 1,
          "type": "integer"
        },
        "epochRounds": {
          "default": 1200,
          "description": "drand quicknet rounds per epoch. 1200 rounds of 3 seconds is one hour.",
          "minimum": 1,
          "type": "integer"
        },
        "startThresholdPpm": {
          "default": 31250,
          "description": "Starting draw threshold T; doubles each epoch without a drawn retrace.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "volunteeredWeightPpm": {
          "default": 500000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "windowEpochs": {
          "default": 24,
          "description": "How long a drawn sponsor has to deliver.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "flowBack": {
      "properties": {
        "capMultiple": {
          "default": 5,
          "description": "Flow-back is capped at this multiple of a stone's own credit.",
          "minimum": 0,
          "type": "integer"
        },
        "sharePpm": {
          "default": 250000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "judge": {
      "properties": {
        "minJudges": {
          "default": 1,
          "minimum": 1,
          "type": "integer"
        },
        "prompt": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        },
        "schema": {
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        }
      },
      "required": [
        "schema",
        "prompt"
      ],
      "type": "object"
    },
    "labeler": {
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        },
        "labels": {
          "description": "Label values honored from this labeler, such as bad-actor, exclude, recheck, unsafe or tag:<name>.",
          "items": {
            "maxLength": 128,
            "type": "string"
          },
          "maxLength": 64,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "did",
        "labels"
      ],
      "type": "object"
    },
    "main": {
      "description": "The rules that turn evidence into confidence and credit. A policy that extends another overrides only the fields it sets.",
      "key": "tid",
      "record": {
        "properties": {
          "activationDelay": {
            "default": 24,
            "description": "Epochs after a timekeeper first sees a version before additions to its executable surface take effect.",
            "minimum": 0,
            "type": "integer"
          },
          "blind": {
            "default": false,
            "description": "Payloads are timelock-encrypted to the round that closes the epoch.",
            "type": "boolean"
          },
          "calibration": {
            "description": "A per-setup weight curve from gold passes: each stone's model weight is multiplied by the weightPpm of the step with the most goldPasses its setup has reached. A setup below every step keeps full weight. Absent, gold scores only inform.",
            "items": {
              "ref": "#calibrationStep",
              "type": "ref"
            },
            "maxLength": 32,
            "type": "array"
          },
          "canonicalizers": {
            "items": {
              "ref": "#canonicalizer",
              "type": "ref"
            },
            "maxLength": 256,
            "type": "array"
          },
          "confidence": {
            "description": "Check that maps tallies to [low, high] per candidate. Absent means the built-in Beta-share interval.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "credit": {
            "ref": "#credit",
            "type": "ref"
          },
          "deny": {
            "description": "Weight 0 in this reading, including agents through sponsor links.",
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 10000,
            "type": "array"
          },
          "dormancy": {
            "default": 720,
            "description": "Epochs maintainer-only work may wait unanswered before the project is dormant.",
            "minimum": 1,
            "type": "integer"
          },
          "draw": {
            "ref": "#draw",
            "type": "ref"
          },
          "escalation": {
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 64,
            "type": "array"
          },
          "extends": {
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "judges": {
            "items": {
              "ref": "#judge",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "labelers": {
            "description": "Labelers the policy trusts, and which of each one's labels it honors with their standard effects.",
            "items": {
              "ref": "#labeler",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "mergeOrgs": {
            "default": false,
            "description": "Members of one organization count as one sponsor: draws are keyed on the org, an org with a stone at a site can't be drawn for it, and agreeing reads from its members count once. Orgs that share a member count as one.",
            "type": "boolean"
          },
          "models": {
            "ref": "#models",
            "type": "ref"
          },
          "nullSampling": {
            "ref": "#nullSampling",
            "type": "ref"
          },
          "priorities": {
            "items": {
              "ref": "#priority",
              "type": "ref"
            },
            "maxLength": 1024,
            "type": "array"
          },
          "requiredChecks": {
            "description": "A candidate that fails a required check has a low bound of 0.",
            "items": {
              "ref": "com.atproto.repo.strongRef",
              "type": "ref"
            },
            "maxLength": 64,
            "type": "array"
          },
          "retraceBudget": {
            "default": 3,
            "description": "Automatic retraces per site. A new distinct value schedules more.",
            "minimum": 0,
            "type": "integer"
          },
          "snapshotCadence": {
            "description": "Epochs a maintainer may go without a snapshot while the values past the export bar differ from the latest snapshot's. Absent, snapshots are never due.",
            "minimum": 1,
            "type": "integer"
          },
          "thresholds": {
            "ref": "#thresholds",
            "type": "ref"
          },
          "timekeepers": {
            "items": {
              "format": "did",
              "type": "string"
            },
            "maxLength": 16,
            "type": "array"
          }
        },
        "required": [
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "modelWeight": {
      "properties": {
        "family": {
          "maxLength": 256,
          "type": "string"
        },
        "thinking": {
          "items": {
            "maxLength": 64,
            "type": "string"
          },
          "maxLength": 16,
          "type": "array"
        },
        "versions": {
          "items": {
            "maxLength": 128,
            "type": "string"
          },
          "maxLength": 64,
          "type": "array"
        },
        "weightPpm": {
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "family",
        "weightPpm"
      ],
      "type": "object"
    },
    "models": {
      "properties": {
        "accept": {
          "items": {
            "ref": "#modelWeight",
            "type": "ref"
          },
          "maxLength": 256,
          "type": "array"
        },
        "defaultWeightPpm": {
          "default": 0,
          "description": "Weight for stones from unlisted models.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "sameSetupWeightPpm": {
          "default": 1000000,
          "description": "Extra weight on each agreeing read beyond the first from one setup (model, modelVersion and config hash) at a site.",
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "nullSampling": {
      "description": "Sampling for nulls without segments: initialPpm at first, then sampleNumerator/n after n passes, never below floorPpm.",
      "properties": {
        "floorPpm": {
          "default": 100000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "initialPpm": {
          "default": 1000000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "poolClearSamples": {
          "default": 60,
          "description": "Passing samples that clear a pool for final credit.",
          "minimum": 1,
          "type": "integer"
        },
        "sampleNumerator": {
          "default": 3,
          "minimum": 1,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "priority": {
      "properties": {
        "need": {
          "description": "Relative need. Weights routing and placement credit.",
          "minimum": 0,
          "type": "integer"
        },
        "selector": {
          "refs": [
            "#courseSelector",
            "#siteSelector"
          ],
          "type": "union"
        }
      },
      "required": [
        "selector",
        "need"
      ],
      "type": "object"
    },
    "siteSelector": {
      "properties": {
        "site": {
          "description": "Site key.",
          "ref": "org.cairnsproto.draft.defs#hash",
          "type": "ref"
        }
      },
      "required": [
        "site"
      ],
      "type": "object"
    },
    "thresholds": {
      "description": "Bars on the low bound of the leading candidate's interval.",
      "properties": {
        "exportPpm": {
          "default": 950000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "finalizeCreditPpm": {
          "default": 900000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "minFamilies": {
          "default": 1,
          "description": "Model families a candidate's agreeing reads must come from before it clears the open-children or export bar. A read that declares no model is a family of its own sponsor.",
          "minimum": 1,
          "type": "integer"
        },
        "openChildrenPpm": {
          "default": 800000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        },
        "stopRoutingPpm": {
          "default": 990000,
          "maximum": 1000000,
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "description": "Fractions are parts per million (0 to 1000000).",
  "id": "org.cairnsproto.draft.policy",
  "lexicon": 1
}
```
