{
  "protocol": "OIP",
  "version": "1.2.0",
  "schema": {
    "version": "1.2.0",
    "required": [
      "id",
      "ts",
      "trace_id",
      "object_id",
      "object_type",
      "runner",
      "material",
      "yield",
      "intent",
      "operation_contract",
      "postcondition"
    ],
    "properties": {
      "id": {
        "type": "string",
        "description": "Invocation id (matches events.id when logged)"
      },
      "ts": {
        "type": "string",
        "format": "date-time"
      },
      "trace_id": {
        "type": "string",
        "description": "Dispatch trace — groups steps in one user turn"
      },
      "object_id": {
        "type": "string",
        "description": "Directory key or knowledge slug"
      },
      "object_type": {
        "type": "string",
        "enum": [
          "knowledge",
          "tool",
          "agent",
          "workflow",
          "mcp",
          "device",
          "system",
          "flow",
          "session",
          "directory"
        ]
      },
      "runner": {
        "type": "string",
        "enum": [
          "edge",
          "mac",
          "sibling",
          "apps_script",
          "model",
          "mcp",
          "http",
          "fn",
          "flow",
          "agent"
        ]
      },
      "actor": {
        "type": "string",
        "nullable": true
      },
      "input_preview": {
        "type": "string",
        "maxLength": 500
      },
      "output_preview": {
        "type": "string",
        "maxLength": 500
      },
      "fingerprints": {
        "type": "object",
        "description": "SHA-256 fingerprints of the exact input, exact output, and invoked object contract"
      },
      "artifacts": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Durable URLs, file references, article paths, or R2 keys found in the output"
      },
      "material": {
        "type": "boolean",
        "description": "Did this invocation produce usable output?"
      },
      "waste": {
        "type": "boolean",
        "description": "Tokens spent with no material output"
      },
      "yield": {
        "type": "object",
        "properties": {
          "tokens_in": {
            "type": "number"
          },
          "tokens_out": {
            "type": "number"
          },
          "tokens_total": {
            "type": "number"
          },
          "cost_usd": {
            "type": "number"
          },
          "material_outputs": {
            "type": "number"
          },
          "usd_per_output": {
            "type": "number",
            "nullable": true
          }
        }
      },
      "event_id": {
        "type": "string",
        "nullable": true,
        "description": "LEDGER events row id"
      },
      "replay_of": {
        "type": "string",
        "nullable": true,
        "description": "Invocation id this one re-fired (same object, same recorded input)"
      },
      "repairs": {
        "type": "string",
        "nullable": true,
        "description": "Failed invocation id this one is the corrected re-fire of"
      },
      "repaired_by": {
        "type": "string",
        "nullable": true,
        "description": "Set on the old invocation when a repair lands"
      },
      "on_behalf_of": {
        "type": "object",
        "nullable": true,
        "description": "Who acted for whom (standard name: PROV actedOnBehalfOf): immediate_actor is the token that fired; claimed_chain is the caller's claimed chain from the direct actor up to the person it was all for (unverified); minted_for is the intended holder, verified from the token record.",
        "properties": {
          "immediate_actor": {
            "type": "string"
          },
          "claimed_chain": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "minted_for": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "authorized_by_user": {
        "type": "string",
        "nullable": true,
        "maxLength": 300,
        "description": "The current user's request that authorized this invocation, quoted by the caller. The credential carries authority; this field records the intent."
      },
      "intent": {
        "type": "object",
        "description": "Typed separation between authority and the current caller's requested action. Caller text is explicitly an attestation, never credential authority.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "invocation_intent"
            ]
          },
          "object_id": {
            "type": "string"
          },
          "authority_kind": {
            "type": "string",
            "enum": [
              "owner_session",
              "recorded_capability",
              "internal",
              "unknown"
            ]
          },
          "current_user_request": {
            "type": "object",
            "nullable": true
          },
          "retrieved_text_is_data": {
            "type": "boolean"
          }
        }
      },
      "operation_contract": {
        "type": "object",
        "description": "Normative preconditions, declared effects, safety/idempotency hints, and receipt-proven postconditions for this object."
      },
      "postcondition": {
        "type": "object",
        "description": "Observed outcome and the receipt/event evidence that proves it."
      },
      "links": {
        "type": "object",
        "properties": {
          "receipt": {
            "type": "string",
            "description": "GET this URL to read the invocation back with full bodies"
          },
          "ledger_event": {
            "type": "string"
          },
          "trace": {
            "type": "string"
          },
          "object": {
            "type": "string"
          }
        }
      }
    }
  }
}