Workspace Intelligence / JSON Schema
Workspai Model and Agent Usage Event
A privacy-bounded usage observation. Prompt and response bodies are deliberately excluded; consumers may provide hashes instead.
- Schema version
model-usage-event.v1- Contract path
contracts/workspace-intelligence/model-usage-event.v1.json- Publication
- json-schema
- Defined fields
- 35
- Artifact bindings
- 0
Why this contract exists
Architecture role
Defines canonical workspace state or a versioned projection of that state.
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 path | Type | Required | Meaning | Constraints |
|---|---|---|---|---|
| eventId | string | Yes | Defines the eventid value at this contract boundary. | minLength: 1 |
| kind | enum | Yes | Defines the kind value at this contract boundary. | enum: model-call, tool-call, outcome, milestone |
| milestone | object | No | Defines the milestone value at this contract boundary. | additionalProperties: false |
| milestone.detail | string | No | Defines the detail value at this contract boundary. | minLength: 1 |
| milestone.name | string | Yes | Defines the name value at this contract boundary. | minLength: 1 |
| modelCall | object | No | Defines the modelcall value at this contract boundary. | additionalProperties: false |
| modelCall.cachedInputTokens | integer | null | Yes | Defines the cachedinputtokens value at this contract boundary. | minimum: 0 |
| modelCall.cost | object | No | Defines the cost value at this contract boundary. | additionalProperties: false |
| modelCall.cost.amount | number | Yes | Defines the amount value at this contract boundary. | minimum: 0 |
| modelCall.cost.currency | string | Yes | Defines the currency value at this contract boundary. | pattern: ^[A-Z]{3}$ |
| modelCall.cost.source | enum | Yes | Defines the source value at this contract boundary. | enum: provider-reported, catalog-estimated |
| modelCall.inputTokens | integer | null | Yes | Defines the inputtokens value at this contract boundary. | minimum: 0 |
| modelCall.latencyMs | number | null | Yes | Defines the latencyms value at this contract boundary. | minimum: 0 |
| modelCall.model | string | Yes | Defines the model value at this contract boundary. | minLength: 1 |
| modelCall.outputTokens | integer | null | Yes | Defines the outputtokens value at this contract boundary. | minimum: 0 |
| modelCall.promptHash | string | No | Defines the prompthash value at this contract boundary. | pattern: ^[a-f0-9]{64}$ |
| modelCall.provider | string | Yes | Defines the provider value at this contract boundary. | minLength: 1 |
| modelCall.reasoningTokens | integer | null | Yes | Defines the reasoningtokens value at this contract boundary. | minimum: 0 |
| modelCall.responseHash | string | No | Defines the responsehash value at this contract boundary. | pattern: ^[a-f0-9]{64}$ |
| modelCall.source | enum | Yes | Defines the source value at this contract boundary. | enum: provider-reported, tokenizer-counted, estimated, unavailable |
| modelCall.tokenizer | string | No | Defines the tokenizer value at this contract boundary. | minLength: 1 |
| outcome | object | No | Defines the outcome value at this contract boundary. | additionalProperties: false |
| outcome.blockersResolved | integer | Yes | Defines the blockersresolved value at this contract boundary. | minimum: 0 |
| outcome.status | enum | Yes | Defines the status value at this contract boundary. | enum: passed, failed, blocked, unknown |
| outcome.summary | string | No | Defines the summary value at this contract boundary. | minLength: 1 |
| outcome.verified | boolean | Yes | Defines the verified value at this contract boundary. | — |
| recordedAt | string | Yes | Defines the recordedat value at this contract boundary. | format: date-time |
| schemaVersion | string | Yes | Defines the schemaversion value at this contract boundary. | const: "model-usage-event.v1" |
| stage | string | No | Defines the stage value at this contract boundary. | minLength: 1 |
| toolCall | object | No | Defines the toolcall value at this contract boundary. | additionalProperties: false |
| toolCall.artifact | string | No | Defines the artifact value at this contract boundary. | minLength: 1 |
| toolCall.changedSource | boolean | Yes | Defines the changedsource value at this contract boundary. | — |
| toolCall.durationMs | number | null | Yes | Defines the durationms value at this contract boundary. | minimum: 0 |
| toolCall.result | enum | Yes | Defines the result value at this contract boundary. | enum: passed, failed, blocked, skipped |
| toolCall.tool | string | Yes | Defines the tool 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/model-usage-event.v1.json",
"title": "Workspai Model and Agent Usage Event",
"description": "A privacy-bounded usage observation. Prompt and response bodies are deliberately excluded; consumers may provide hashes instead.",
"type": "object",
"required": [
"schemaVersion",
"eventId",
"recordedAt",
"kind"
],
"properties": {
"schemaVersion": {
"const": "model-usage-event.v1"
},
"eventId": {
"type": "string",
"minLength": 1
},
"recordedAt": {
"type": "string",
"format": "date-time"
},
"kind": {
"enum": [
"model-call",
"tool-call",
"outcome",
"milestone"
]
},
"stage": {
"type": "string",
"minLength": 1
},
"modelCall": {
"type": "object",
"required": [
"provider",
"model",
"source",
"inputTokens",
"outputTokens",
"cachedInputTokens",
"reasoningTokens",
"latencyMs"
],
"properties": {
"provider": {
"type": "string",
"minLength": 1
},
"model": {
"type": "string",
"minLength": 1
},
"source": {
"enum": [
"provider-reported",
"tokenizer-counted",
"estimated",
"unavailable"
]
},
"tokenizer": {
"type": "string",
"minLength": 1
},
"inputTokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"outputTokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"cachedInputTokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"reasoningTokens": {
"type": [
"integer",
"null"
],
"minimum": 0
},
"latencyMs": {
"type": [
"number",
"null"
],
"minimum": 0
},
"promptHash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"responseHash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"cost": {
"type": "object",
"required": [
"amount",
"currency",
"source"
],
"properties": {
"amount": {
"type": "number",
"minimum": 0
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"source": {
"enum": [
"provider-reported",
"catalog-estimated"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"toolCall": {
"type": "object",
"required": [
"tool",
"result",
"changedSource",
"durationMs"
],
"properties": {
"tool": {
"type": "string",
"minLength": 1
},
"result": {
"enum": [
"passed",
"failed",
"blocked",
"skipped"
]
},
"changedSource": {
"type": "boolean"
},
"durationMs": {
"type": [
"number",
"null"
],
"minimum": 0
},
"artifact": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
},
"outcome": {
"type": "object",
"required": [
"status",
"verified",
"blockersResolved"
],
"properties": {
"status": {
"enum": [
"passed",
"failed",
"blocked",
"unknown"
]
},
"verified": {
"type": "boolean"
},
"blockersResolved": {
"type": "integer",
"minimum": 0
},
"summary": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
},
"milestone": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"detail": {
"type": "string",
"minLength": 1
}
},
"additionalProperties": false
}
},
"allOf": [
{
"if": {
"properties": {
"kind": {
"const": "model-call"
}
}
},
"then": {
"properties": {
"modelCall": {}
},
"required": [
"modelCall"
]
}
},
{
"if": {
"properties": {
"kind": {
"const": "tool-call"
}
}
},
"then": {
"properties": {
"toolCall": {}
},
"required": [
"toolCall"
]
}
},
{
"if": {
"properties": {
"kind": {
"const": "outcome"
}
}
},
"then": {
"properties": {
"outcome": {}
},
"required": [
"outcome"
]
}
},
{
"if": {
"properties": {
"kind": {
"const": "milestone"
}
}
},
"then": {
"properties": {
"milestone": {}
},
"required": [
"milestone"
]
}
}
],
"additionalProperties": false
}