All contracts

Workspace Intelligence / JSON Schema

Workspai Workspace Graph Stream

Transport-neutral, revision-safe events for hydrating and incrementally updating a Workspace Knowledge Graph consumer.

Schema version
workspace-graph-stream.v1
Contract path
contracts/workspace-intelligence/workspace-graph-stream.v1.json
Publication
json-schema
Defined fields
50
Artifact bindings
0

Why this contract exists

Architecture role

Relates workspace structure and change so downstream reasoning remains traceable.

Consumption boundary

  • Workspai CLI
  • Workspace Intelligence consumers
  • IDEs and agents

Related commands

Commands are linked only when the runtime contract identifies a direct production relationship. Supporting contracts may be consumed without having a single producer command.

This is a supporting, capability, cache, compatibility, or consumer contract. It has no single direct producer command in the canonical Workspace Intelligence execution registry.

Produced artifacts

These durable files are emitted by registered commands and validated against this contract.

No canonical file artifact is registered for this contract. It may describe capabilities, embedded data, runtime exchange, or supporting state instead of a standalone report.

Field reference

Every declared schema property or published capability path is listed here. Required means the contract declares or publishes that field at the shown boundary.

Field pathTypeRequiredMeaningConstraints
$defs.controlPayload.messagestringNoDefines the message value at this contract boundary.
$defs.controlPayload.reasonstringNoDefines the reason value at this contract boundary.
$defs.deltaPayload.diagnosticsarrayYesDefines the diagnostics value at this contract boundary.
$defs.deltaPayload.entitiesAddedarrayYesDefines the entitiesadded value at this contract boundary.
$defs.deltaPayload.entitiesRemovedarrayYesDefines the entitiesremoved value at this contract boundary.
$defs.deltaPayload.entitiesUpdatedarrayYesDefines the entitiesupdated value at this contract boundary.
$defs.deltaPayload.proofsAddedarrayYesDefines the proofsadded value at this contract boundary.
$defs.deltaPayload.proofsRemovedarrayYesDefines the proofsremoved value at this contract boundary.
$defs.deltaPayload.proofsUpdatedarrayYesDefines the proofsupdated value at this contract boundary.
$defs.deltaPayload.providersUpdatedarrayYesDefines the providersupdated value at this contract boundary.
$defs.deltaPayload.qualityanyNoDefines the quality value at this contract boundary.
$defs.deltaPayload.relationsAddedarrayYesDefines the relationsadded value at this contract boundary.
$defs.deltaPayload.relationsRemovedarrayYesDefines the relationsremoved value at this contract boundary.
$defs.deltaPayload.relationsUpdatedarrayYesDefines the relationsupdated value at this contract boundary.
$defs.errorPayload.codestringYesDefines the code value at this contract boundary.minLength: 1
$defs.errorPayload.messagestringYesDefines the message value at this contract boundary.minLength: 1
$defs.errorPayload.providerIdstringNoDefines the providerid value at this contract boundary.
$defs.errorPayload.recoverablebooleanYesDefines the recoverable value at this contract boundary.
$defs.proofInvalidatedPayload.entityIdsarrayNoDefines the entityids value at this contract boundary.
$defs.proofInvalidatedPayload.proofIdsarrayYesDefines the proofids value at this contract boundary.minItems: 1
$defs.proofInvalidatedPayload.reasonstringYesDefines the reason value at this contract boundary.minLength: 1
$defs.proofInvalidatedPayload.relationIdsarrayNoDefines the relationids value at this contract boundary.
$defs.providerProgressPayload.completedintegerNoDefines the completed value at this contract boundary.minimum: 0
$defs.providerProgressPayload.messagestringNoDefines the message value at this contract boundary.
$defs.providerProgressPayload.providerIdreferenceYesDefines the providerid value at this contract boundary.ref: #/$defs/id
$defs.providerProgressPayload.statusenumYesDefines the status value at this contract boundary.enum: queued, running, passed, partial, skipped, failed
$defs.providerProgressPayload.totalintegerNoDefines the total value at this contract boundary.minimum: 0
$defs.qualityPayload.diagnosticsarrayNoDefines the diagnostics value at this contract boundary.
$defs.qualityPayload.qualityreferenceYesDefines the quality value at this contract boundary.ref: workspace-knowledge-graph.v1.json#/properties/quality
$defs.resyncPayload.expectedRevisionintegerNoDefines the expectedrevision value at this contract boundary.minimum: 0
$defs.resyncPayload.messagestringNoDefines the message value at this contract boundary.
$defs.resyncPayload.reasonenumYesDefines the reason value at this contract boundary.enum: revision-gap, identity-mismatch, generation-regression, schema-unsupported, hash-discontinuity, validation-failed, queue-overflow
$defs.resyncPayload.receivedBaseRevisionintegerNoDefines the receivedbaserevision value at this contract boundary.minimum: 0
$defs.snapshotPayload.graphreferenceYesDefines the graph value at this contract boundary.ref: workspace-knowledge-graph.v1.json
$defs.snapshotPayload.reasonenumNoDefines the reason value at this contract boundary.enum: initial, refresh, recovery, schema-transition
baseGraphHashreferenceNoDefines the basegraphhash value at this contract boundary.ref: #/$defs/hash
baseModelHashreferenceNoDefines the basemodelhash value at this contract boundary.ref: #/$defs/hash
baseRevisionintegerNoDefines the baserevision value at this contract boundary.minimum: 0
causationIdstringYesDefines the causationid value at this contract boundary.minLength: 1
correlationIdstringYesDefines the correlationid value at this contract boundary.minLength: 1
generatedAtstringYesDefines the generatedat value at this contract boundary.format: date-time
generationintegerYesDefines the generation value at this contract boundary.minimum: 0
graphHashreferenceYesDefines the graphhash value at this contract boundary.ref: #/$defs/hash
modelHashreferenceYesDefines the modelhash value at this contract boundary.ref: #/$defs/hash
payloadobjectYesDefines the payload value at this contract boundary.
revisionintegerYesDefines the revision value at this contract boundary.minimum: 0
schemaVersionstringYesDefines the schemaversion value at this contract boundary.const: "workspace-graph-stream.v1"
sessionIdstringYesDefines the sessionid value at this contract boundary.minLength: 1
typeenumYesDefines the type value at this contract boundary.enum: graph.snapshot, graph.delta, graph.provider-progress, graph.quality-changed, graph.proof-invalidated, graph.resync-required, graph.paused, graph.complete, graph.heartbeat, graph.error
workspaceIdstringYesDefines the workspaceid value at this contract boundary.minLength: 1

Canonical machine-readable definition

The raw synchronized contract remains authoritative. The educational sections above are projections of this definition.

Show raw JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getrapidkit.com/schemas/workspace-graph-stream.v1.json",
  "title": "Workspai Workspace Graph Stream",
  "description": "Transport-neutral, revision-safe events for hydrating and incrementally updating a Workspace Knowledge Graph consumer.",
  "type": "object",
  "required": [
    "schemaVersion",
    "type",
    "workspaceId",
    "sessionId",
    "generation",
    "revision",
    "modelHash",
    "graphHash",
    "generatedAt",
    "causationId",
    "correlationId",
    "payload"
  ],
  "properties": {
    "schemaVersion": {
      "const": "workspace-graph-stream.v1"
    },
    "type": {
      "enum": [
        "graph.snapshot",
        "graph.delta",
        "graph.provider-progress",
        "graph.quality-changed",
        "graph.proof-invalidated",
        "graph.resync-required",
        "graph.paused",
        "graph.complete",
        "graph.heartbeat",
        "graph.error"
      ]
    },
    "workspaceId": {
      "type": "string",
      "minLength": 1
    },
    "sessionId": {
      "type": "string",
      "minLength": 1
    },
    "generation": {
      "type": "integer",
      "minimum": 0
    },
    "baseRevision": {
      "type": "integer",
      "minimum": 0
    },
    "baseModelHash": {
      "$ref": "#/$defs/hash"
    },
    "baseGraphHash": {
      "$ref": "#/$defs/hash"
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "modelHash": {
      "$ref": "#/$defs/hash"
    },
    "graphHash": {
      "$ref": "#/$defs/hash"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "causationId": {
      "type": "string",
      "minLength": 1
    },
    "correlationId": {
      "type": "string",
      "minLength": 1
    },
    "payload": {
      "type": "object"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.snapshot"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/snapshotPayload"
          },
          "baseRevision": false,
          "baseModelHash": false,
          "baseGraphHash": false
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.delta"
          }
        }
      },
      "then": {
        "required": [
          "baseRevision",
          "baseModelHash",
          "baseGraphHash"
        ],
        "properties": {
          "payload": {
            "$ref": "#/$defs/deltaPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.provider-progress"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/providerProgressPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.quality-changed"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/qualityPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.proof-invalidated"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/proofInvalidatedPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.resync-required"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/resyncPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "enum": [
              "graph.paused",
              "graph.complete",
              "graph.heartbeat"
            ]
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/controlPayload"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "graph.error"
          }
        }
      },
      "then": {
        "properties": {
          "payload": {
            "$ref": "#/$defs/errorPayload"
          }
        }
      }
    }
  ],
  "$defs": {
    "hash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "id": {
      "type": "string",
      "minLength": 1
    },
    "snapshotPayload": {
      "type": "object",
      "required": [
        "graph"
      ],
      "properties": {
        "graph": {
          "$ref": "workspace-knowledge-graph.v1.json"
        },
        "reason": {
          "enum": [
            "initial",
            "refresh",
            "recovery",
            "schema-transition"
          ]
        }
      },
      "additionalProperties": false
    },
    "deltaPayload": {
      "type": "object",
      "required": [
        "entitiesAdded",
        "entitiesUpdated",
        "entitiesRemoved",
        "relationsAdded",
        "relationsUpdated",
        "relationsRemoved",
        "proofsAdded",
        "proofsUpdated",
        "proofsRemoved",
        "providersUpdated",
        "diagnostics"
      ],
      "properties": {
        "entitiesAdded": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items"
          }
        },
        "entitiesUpdated": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/entities/items"
          }
        },
        "entitiesRemoved": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "uniqueItems": true
        },
        "relationsAdded": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/relations/items"
          }
        },
        "relationsUpdated": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/relations/items"
          }
        },
        "relationsRemoved": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "uniqueItems": true
        },
        "proofsAdded": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/proofs/items"
          }
        },
        "proofsUpdated": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/proofs/items"
          }
        },
        "proofsRemoved": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "uniqueItems": true
        },
        "providersUpdated": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/providers/items"
          }
        },
        "quality": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "workspace-knowledge-graph.v1.json#/properties/quality"
            }
          ]
        },
        "diagnostics": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/diagnostics/items"
          }
        }
      },
      "additionalProperties": false
    },
    "providerProgressPayload": {
      "type": "object",
      "required": [
        "providerId",
        "status"
      ],
      "properties": {
        "providerId": {
          "$ref": "#/$defs/id"
        },
        "status": {
          "enum": [
            "queued",
            "running",
            "passed",
            "partial",
            "skipped",
            "failed"
          ]
        },
        "completed": {
          "type": "integer",
          "minimum": 0
        },
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "qualityPayload": {
      "type": "object",
      "required": [
        "quality"
      ],
      "properties": {
        "quality": {
          "$ref": "workspace-knowledge-graph.v1.json#/properties/quality"
        },
        "diagnostics": {
          "type": "array",
          "items": {
            "$ref": "workspace-knowledge-graph.v1.json#/properties/diagnostics/items"
          }
        }
      },
      "additionalProperties": false
    },
    "proofInvalidatedPayload": {
      "type": "object",
      "required": [
        "proofIds",
        "reason"
      ],
      "properties": {
        "proofIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "entityIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "uniqueItems": true
        },
        "relationIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/id"
          },
          "uniqueItems": true
        }
      },
      "additionalProperties": false
    },
    "resyncPayload": {
      "type": "object",
      "required": [
        "reason"
      ],
      "properties": {
        "reason": {
          "enum": [
            "revision-gap",
            "identity-mismatch",
            "generation-regression",
            "schema-unsupported",
            "hash-discontinuity",
            "validation-failed",
            "queue-overflow"
          ]
        },
        "expectedRevision": {
          "type": "integer",
          "minimum": 0
        },
        "receivedBaseRevision": {
          "type": "integer",
          "minimum": 0
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "controlPayload": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "errorPayload": {
      "type": "object",
      "required": [
        "code",
        "message",
        "recoverable"
      ],
      "properties": {
        "code": {
          "type": "string",
          "minLength": 1
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "recoverable": {
          "type": "boolean"
        },
        "providerId": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}