Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

update_forecast

Compute and append an evidence-based Bayesian revision atomically.

Contract

The probability is computed, not supplied. Each likelihood conditions on earlier evidence. Reused origins, impossible evidence, stale predecessors and future evidence are rejected; all inputs are stored in the calculation audit.

Fields

FieldTypeRequired
keyKeyYes
op"update_forecast"Yes
revisionBayesianRevisionYes

Setup

Start a fresh --memory process and send these requests, one per line, before the example. The same sequence also works with a new SQLite database.

{"version":1,"id":"setup-1","command":{"op":"create_question","question":{"id":"doc-launch","version":1,"proposition":"Release before timestamp 100","opens_at":0,"deadline":100,"resolve_after":110,"yes_rule":"Archive confirms release strictly before 100","no_rule":"Complete archive confirms no qualifying release","void_rule":"Archive permanently unavailable","resolution_sources":["official archive"]}}}
{"version":1,"id":"setup-2","command":{"op":"append_forecast","key":{"question_id":"doc-launch","version":1},"forecast":{"id":"f1","as_of":1,"evidence_cutoff":1,"probability":0.3,"previous_id":null,"change":"initial","method":"empirical outside view","rationale":"12 of 40 comparable attempts","assumptions":["cases are comparable"],"next_review_trigger":"readiness test","evidence":[]}}}

Request

Send this object on one line. It is expanded below for readability.

{
  "version": 1,
  "id": "example",
  "command": {
    "op": "update_forecast",
    "key": {
      "question_id": "doc-launch",
      "version": 1
    },
    "revision": {
      "id": "f2",
      "previous_id": "f1",
      "as_of": 20,
      "evidence_cutoff": 20,
      "rationale": "diagnostic readiness evidence",
      "assumptions": [
        "illustrative likelihoods"
      ],
      "next_review_trigger": "dependency completion",
      "likelihoods": [
        {
          "evidence": {
            "id": "readiness",
            "origin_id": "test-1",
            "locator": "supplied:test-1",
            "claim": "Readiness test passed",
            "published_at": 10,
            "observed_at": 9
          },
          "given_h": 0.8,
          "given_not_h": 0.2
        }
      ]
    }
  }
}

Response

This response is generated by executing the example against the current binary. Commit timestamps, when present, are shown as <runtime UTC seconds>; the actual protocol returns integer UTC seconds.

{
  "version": 1,
  "id": "example",
  "result": {
    "event": {
      "calculation": {
        "likelihoods": [
          {
            "evidence": {
              "claim": "Readiness test passed",
              "id": "readiness",
              "locator": "supplied:test-1",
              "observed_at": 9,
              "origin_id": "test-1",
              "published_at": 10
            },
            "given_h": 0.8,
            "given_not_h": 0.2
          }
        ],
        "prior": 0.3
      },
      "forecast": {
        "as_of": 20,
        "assumptions": [
          "illustrative likelihoods"
        ],
        "change": "evidence",
        "evidence": [
          {
            "claim": "Readiness test passed",
            "id": "readiness",
            "locator": "supplied:test-1",
            "observed_at": 9,
            "origin_id": "test-1",
            "published_at": 10
          }
        ],
        "evidence_cutoff": 20,
        "id": "f2",
        "method": "conditional Bayesian likelihood update",
        "next_review_trigger": "dependency completion",
        "previous_id": "f1",
        "probability": 0.631578947368421,
        "rationale": "diagnostic readiness evidence"
      },
      "kind": "forecast"
    },
    "key": {
      "question_id": "doc-launch",
      "version": 1
    },
    "recorded_at": "<runtime UTC seconds>",
    "sequence": 3
  }
}

Verification

The documentation gate executes the setup and request, then checks the following result fields against independently specified expectations:

JSON pointer within resultExpected
/sequence3
/event/forecast/probability0.631578947368421
/event/calculation/prior0.3

Float comparisons use a 1e-12 tolerance. Request schema validation and cross-record validation still apply. See errors and recovery for failure handling.