All contracts

Workspace Intelligence / JSON Schema

Workspai Evidence-backed Workspace Knowledge Graph

Portable, provider-neutral workspace entities, relations and proof paths with the canonical project dependency topology embedded as a projection.

Schema version
workspace-knowledge-graph.v1
Contract path
contracts/workspace-intelligence/workspace-knowledge-graph.v1.json
Publication
embedded-type, json-schema
Defined fields
73
Artifact bindings
1

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.

Produced artifacts

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

Artifact pathSchemaProducer
.workspai/reports/workspace-knowledge-graph.jsonworkspace-knowledge-graph.v1
workspai workspace model --json --write

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
diagnosticsarrayYesDefines the diagnostics value at this contract boundary.
diagnostics[].codestringYesDefines the code value at this contract boundary.minLength: 1
diagnostics[].entityIdsarrayNoDefines the entityids value at this contract boundary.
diagnostics[].messagestringYesDefines the message value at this contract boundary.minLength: 1
diagnostics[].recommendationstringNoDefines the recommendation value at this contract boundary.
diagnostics[].relationIdsarrayNoDefines the relationids value at this contract boundary.
diagnostics[].severityenumYesDefines the severity value at this contract boundary.enum: info, warning, error
entitiesarrayYesDefines the entities value at this contract boundary.
entities[].attributesobjectYesDefines the attributes value at this contract boundary.
entities[].idstringYesDefines the id value at this contract boundary.minLength: 1
entities[].identityobjectYesDefines the identity value at this contract boundary.additionalProperties: false
entities[].identity.aliasesarrayYesDefines the aliases value at this contract boundary.
entities[].identity.fingerprintstringYesDefines the fingerprint value at this contract boundary.pattern: ^[a-f0-9]{64}$
entities[].identity.keystringYesDefines the key value at this contract boundary.minLength: 1
entities[].identity.scopeenumYesDefines the scope value at this contract boundary.enum: workspace, project
entities[].kindenumYesDefines the kind value at this contract boundary.enum: workspace, project, service, api, endpoint, schema, package, module, file, symbol, database, queue, container, deployment, pipeline, environment, document, decision, test-suite, owner
entities[].labelstringYesDefines the label value at this contract boundary.minLength: 1
entities[].projectIdstringNoDefines the projectid value at this contract boundary.minLength: 1
entities[].proofIdsarrayYesDefines the proofids value at this contract boundary.
generatedAtstringYesDefines the generatedat value at this contract boundary.format: date-time
projectTopologyreferenceYesDefines the projecttopology value at this contract boundary.ref: workspace-dependency-graph.v1.json
proofsarrayYesDefines the proofs value at this contract boundary.
proofs[].artifactstringYesDefines the artifact value at this contract boundary.minLength: 1
proofs[].columnintegerNoDefines the column value at this contract boundary.minimum: 1
proofs[].confidenceenumYesDefines the confidence value at this contract boundary.enum: high, medium, low
proofs[].contentHashstringNoDefines the contenthash value at this contract boundary.pattern: ^[a-f0-9]{64}$
proofs[].derivationenumYesDefines the derivation value at this contract boundary.enum: extracted, inferred, authored
proofs[].detailstringNoDefines the detail value at this contract boundary.
proofs[].freshnessenumYesDefines the freshness value at this contract boundary.enum: fresh, stale, unknown
proofs[].idstringYesDefines the id value at this contract boundary.minLength: 1
proofs[].lineintegerNoDefines the line value at this contract boundary.minimum: 1
proofs[].observedAtstringYesDefines the observedat value at this contract boundary.format: date-time
proofs[].pointerstringNoDefines the pointer value at this contract boundary.
proofs[].providerstringYesDefines the provider value at this contract boundary.minLength: 1
proofs[].trustenumYesDefines the trust value at this contract boundary.enum: authoritative, corroborated, observed, ambiguous
providersarrayYesDefines the providers value at this contract boundary.
providers[].diagnosticsarrayYesDefines the diagnostics value at this contract boundary.
providers[].discoveredEntitiesintegerYesDefines the discoveredentities value at this contract boundary.minimum: 0
providers[].discoveredRelationsintegerYesDefines the discoveredrelations value at this contract boundary.minimum: 0
providers[].idstringYesDefines the id value at this contract boundary.minLength: 1
providers[].permissionenumYesDefines the permission value at this contract boundary.enum: filesystem-read, git-read, runtime-probe, network
providers[].proofCountintegerYesDefines the proofcount value at this contract boundary.minimum: 0
providers[].statusenumYesDefines the status value at this contract boundary.enum: passed, partial, skipped, failed
providers[].versionstringYesDefines the version value at this contract boundary.minLength: 1
qualityobjectYesDefines the quality value at this contract boundary.additionalProperties: false
quality.conflictCountintegerYesDefines the conflictcount value at this contract boundary.minimum: 0
quality.entityCountintegerYesDefines the entitycount value at this contract boundary.minimum: 0
quality.entityProofCoverageRationumberYesDefines the entityproofcoverageratio value at this contract boundary.minimum: 0 · maximum: 1
quality.portablebooleanYesDefines the portable value at this contract boundary.const: true
quality.proofCountintegerYesDefines the proofcount value at this contract boundary.minimum: 0
quality.providerSuccessRationumberYesDefines the providersuccessratio value at this contract boundary.minimum: 0 · maximum: 1
quality.relationCountintegerYesDefines the relationcount value at this contract boundary.minimum: 0
quality.relationProofCoverageRationumberYesDefines the relationproofcoverageratio value at this contract boundary.minimum: 0 · maximum: 1
quality.secretValuesEmittedbooleanYesDefines the secretvaluesemitted value at this contract boundary.const: false
quality.unknownCountintegerYesDefines the unknowncount value at this contract boundary.minimum: 0
relationsarrayYesDefines the relations value at this contract boundary.
relations[].confidenceenumYesDefines the confidence value at this contract boundary.enum: high, medium, low
relations[].derivationenumYesDefines the derivation value at this contract boundary.enum: extracted, inferred, authored
relations[].fromstringYesDefines the from value at this contract boundary.minLength: 1
relations[].idstringYesDefines the id value at this contract boundary.minLength: 1
relations[].kindenumYesDefines the kind value at this contract boundary.enum: contains, defines, imports, depends-on, exposes, implements, calls, reads-from, writes-to, publishes, consumes, deploys, runs-on, routes-to, documents, decided-by, tests, owns, generated-by, configured-by, references
relations[].proofIdsarrayYesDefines the proofids value at this contract boundary.minItems: 1
relations[].tostringYesDefines the to value at this contract boundary.minLength: 1
relations[].trustenumYesDefines the trust value at this contract boundary.enum: authoritative, corroborated, observed, ambiguous
schemaVersionstringYesDefines the schemaversion value at this contract boundary.const: "workspace-knowledge-graph.v1"
sourceobjectYesDefines the source value at this contract boundary.additionalProperties: false
source.artifactstringYesDefines the artifact value at this contract boundary.minLength: 1
source.hashstringYesDefines the hash value at this contract boundary.pattern: ^[a-f0-9]{64}$
source.hashAlgorithmstringYesDefines the hashalgorithm value at this contract boundary.const: "sha256"
source.kindenumYesDefines the kind value at this contract boundary.enum: workspace-model, workspace-contract, workspace-sources
workspaceobjectYesDefines the workspace value at this contract boundary.additionalProperties: false
workspace.namestringYesDefines the name value at this contract boundary.minLength: 1
workspace.profilestringNoDefines the profile value at this contract boundary.

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-knowledge-graph.v1.json",
  "title": "Workspai Evidence-backed Workspace Knowledge Graph",
  "description": "Portable, provider-neutral workspace entities, relations and proof paths with the canonical project dependency topology embedded as a projection.",
  "type": "object",
  "required": [
    "schemaVersion",
    "generatedAt",
    "source",
    "workspace",
    "projectTopology",
    "entities",
    "relations",
    "proofs",
    "providers",
    "quality",
    "diagnostics"
  ],
  "properties": {
    "schemaVersion": {
      "const": "workspace-knowledge-graph.v1"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "source": {
      "type": "object",
      "required": [
        "kind",
        "artifact",
        "hashAlgorithm",
        "hash"
      ],
      "properties": {
        "kind": {
          "enum": [
            "workspace-model",
            "workspace-contract",
            "workspace-sources"
          ]
        },
        "artifact": {
          "type": "string",
          "minLength": 1
        },
        "hashAlgorithm": {
          "const": "sha256"
        },
        "hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    },
    "workspace": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "profile": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "projectTopology": {
      "$ref": "workspace-dependency-graph.v1.json"
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "label",
          "identity",
          "attributes",
          "proofIds"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "enum": [
              "workspace",
              "project",
              "service",
              "api",
              "endpoint",
              "schema",
              "package",
              "module",
              "file",
              "symbol",
              "database",
              "queue",
              "container",
              "deployment",
              "pipeline",
              "environment",
              "document",
              "decision",
              "test-suite",
              "owner"
            ]
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "projectId": {
            "type": "string",
            "minLength": 1
          },
          "identity": {
            "type": "object",
            "required": [
              "key",
              "scope",
              "aliases",
              "fingerprint"
            ],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1
              },
              "scope": {
                "enum": [
                  "workspace",
                  "project"
                ]
              },
              "aliases": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fingerprint": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "additionalProperties": false
          },
          "attributes": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null",
                "array"
              ],
              "items": {
                "type": [
                  "string",
                  "number",
                  "boolean",
                  "null"
                ]
              }
            }
          },
          "proofIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true
          }
        },
        "additionalProperties": false
      }
    },
    "relations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "from",
          "to",
          "kind",
          "derivation",
          "trust",
          "confidence",
          "proofIds"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "from": {
            "type": "string",
            "minLength": 1
          },
          "to": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "enum": [
              "contains",
              "defines",
              "imports",
              "depends-on",
              "exposes",
              "implements",
              "calls",
              "reads-from",
              "writes-to",
              "publishes",
              "consumes",
              "deploys",
              "runs-on",
              "routes-to",
              "documents",
              "decided-by",
              "tests",
              "owns",
              "generated-by",
              "configured-by",
              "references"
            ]
          },
          "derivation": {
            "enum": [
              "extracted",
              "inferred",
              "authored"
            ]
          },
          "trust": {
            "enum": [
              "authoritative",
              "corroborated",
              "observed",
              "ambiguous"
            ]
          },
          "confidence": {
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "proofIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "minItems": 1,
            "uniqueItems": true
          }
        },
        "additionalProperties": false
      }
    },
    "proofs": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "provider",
          "artifact",
          "observedAt",
          "derivation",
          "trust",
          "confidence",
          "freshness"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "provider": {
            "type": "string",
            "minLength": 1
          },
          "artifact": {
            "type": "string",
            "minLength": 1,
            "not": {
              "pattern": "^(?:/|[A-Za-z]:[\\\\/])"
            }
          },
          "pointer": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "minimum": 1
          },
          "column": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "derivation": {
            "enum": [
              "extracted",
              "inferred",
              "authored"
            ]
          },
          "trust": {
            "enum": [
              "authoritative",
              "corroborated",
              "observed",
              "ambiguous"
            ]
          },
          "confidence": {
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "freshness": {
            "enum": [
              "fresh",
              "stale",
              "unknown"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "providers": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "version",
          "status",
          "permission",
          "discoveredEntities",
          "discoveredRelations",
          "proofCount",
          "diagnostics"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "passed",
              "partial",
              "skipped",
              "failed"
            ]
          },
          "permission": {
            "enum": [
              "filesystem-read",
              "git-read",
              "runtime-probe",
              "network"
            ]
          },
          "discoveredEntities": {
            "type": "integer",
            "minimum": 0
          },
          "discoveredRelations": {
            "type": "integer",
            "minimum": 0
          },
          "proofCount": {
            "type": "integer",
            "minimum": 0
          },
          "diagnostics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      }
    },
    "quality": {
      "type": "object",
      "required": [
        "entityCount",
        "relationCount",
        "proofCount",
        "entityProofCoverageRatio",
        "relationProofCoverageRatio",
        "providerSuccessRatio",
        "conflictCount",
        "unknownCount",
        "portable",
        "secretValuesEmitted"
      ],
      "properties": {
        "entityCount": {
          "type": "integer",
          "minimum": 0
        },
        "relationCount": {
          "type": "integer",
          "minimum": 0
        },
        "proofCount": {
          "type": "integer",
          "minimum": 0
        },
        "entityProofCoverageRatio": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "relationProofCoverageRatio": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "providerSuccessRatio": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "conflictCount": {
          "type": "integer",
          "minimum": 0
        },
        "unknownCount": {
          "type": "integer",
          "minimum": 0
        },
        "portable": {
          "const": true
        },
        "secretValuesEmitted": {
          "const": false
        }
      },
      "additionalProperties": false
    },
    "diagnostics": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "severity",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1
          },
          "severity": {
            "enum": [
              "info",
              "warning",
              "error"
            ]
          },
          "message": {
            "type": "string",
            "minLength": 1
          },
          "entityIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "relationIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recommendation": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}