All contracts

Platform contracts / JSON Schema

Workspai Project Lifecycle Context

A bounded, manifest-derived projection of project runtime units and their supported lifecycle commands, or a typed refusal that preserves completeness.

Schema version
https://workspai.dev/contracts/project-lifecycle-context.v1.json
Contract path
contracts/project-lifecycle-context.v1.json
Publication
json-schema
Defined fields
33
Artifact bindings
0

Why this contract exists

Architecture role

Projects workspace intelligence into stable grounding surfaces for agents and integrations.

Consumption boundary

  • • Workspai CLI
  • • AI agents
  • • IDEs and MCP clients

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.requiredBudget.accountingstringYesDefines the accounting value at this contract boundary.const: "utf8-json-with-newline"
$defs.requiredBudget.maxBytesintegerYesDefines the maxbytes value at this contract boundary.minimum: 1024 · maximum: 65536
$defs.requiredBudget.requiredBytesintegerYesDefines the requiredbytes value at this contract boundary.minimum: 1
$defs.selection.modeenumYesDefines the mode value at this contract boundary.enum: all-units, closest-unit
$defs.selection.pathstring | nullYesDefines the path value at this contract boundary.—
$defs.stage.argvSequencearrayNoDefines the argvsequence value at this contract boundary.—
$defs.stage.argvSequence[].argsarrayYesDefines the args value at this contract boundary.—
$defs.stage.argvSequence[].executablestringYesDefines the executable value at this contract boundary.minLength: 1
$defs.stage.commandstringYesDefines the command value at this contract boundary.minLength: 1
$defs.stage.confidenceenumYesDefines the confidence value at this contract boundary.enum: high, medium
$defs.stage.cwdstringNoWorking directory relative to the canonical selected project root; source reads do not select this directory for terminal commands.minLength: 1
$defs.stage.focusstringNoDefines the focus value at this contract boundary.minLength: 1
$defs.stage.ownerManifeststringNoDefines the ownermanifest value at this contract boundary.minLength: 1
$defs.stage.preflightenumYesDefines the preflight value at this contract boundary.enum: executable-and-inputs, executable
$defs.stage.setupobjectNoDefines the setup value at this contract boundary.additionalProperties: false
$defs.stage.setup.argsarrayYesDefines the args value at this contract boundary.—
$defs.stage.setup.executablestringYesDefines the executable value at this contract boundary.minLength: 1
$defs.stage.stageenumYesDefines the stage value at this contract boundary.enum: init, test, build, start
$defs.unit.ecosystemstringYesDefines the ecosystem value at this contract boundary.minLength: 1
$defs.unit.idstringYesDefines the id value at this contract boundary.minLength: 1
$defs.unit.manifeststringYesDefines the manifest value at this contract boundary.minLength: 1
$defs.unit.provenancestringYesDefines the provenance value at this contract boundary.const: "manifest-derived"
$defs.unit.roleenumYesDefines the role value at this contract boundary.enum: production, tooling, test, example
$defs.unit.rootstringYesDefines the root value at this contract boundary.minLength: 1
$defs.unit.runtimestringYesDefines the runtime value at this contract boundary.minLength: 1
$defs.unit.stagesarrayYesDefines the stages value at this contract boundary.—
$defs.unit.workspaceOwnerobjectNoDefines the workspaceowner value at this contract boundary.additionalProperties: false
$defs.unit.workspaceOwner.manifeststringYesDefines the manifest value at this contract boundary.minLength: 1
$defs.unit.workspaceOwner.packageManagerenumYesDefines the packagemanager value at this contract boundary.enum: npm, pnpm, yarn, bun
$defs.unit.workspaceOwner.rootstringYesDefines the root value at this contract boundary.minLength: 1
$defs.usedBudget.accountingstringYesDefines the accounting value at this contract boundary.const: "utf8-json-with-newline"
$defs.usedBudget.maxBytesintegerYesDefines the maxbytes value at this contract boundary.minimum: 1024 · maximum: 65536
$defs.usedBudget.usedBytesintegerYesDefines the usedbytes value at this contract boundary.minimum: 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://workspai.dev/contracts/project-lifecycle-context.v1.json",
  "title": "Workspai Project Lifecycle Context",
  "description": "A bounded, manifest-derived projection of project runtime units and their supported lifecycle commands, or a typed refusal that preserves completeness.",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "status",
        "project",
        "selection",
        "units",
        "omittedUnits",
        "budget"
      ],
      "properties": {
        "schemaVersion": {
          "const": "workspai.project-lifecycle-context.v1"
        },
        "status": {
          "enum": [
            "ready",
            "no-lifecycle-units"
          ]
        },
        "project": {
          "const": "."
        },
        "selection": {
          "$ref": "#/$defs/selection"
        },
        "units": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/unit"
          }
        },
        "omittedUnits": {
          "const": 0
        },
        "budget": {
          "$ref": "#/$defs/usedBudget"
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "status",
        "project",
        "selection",
        "message",
        "nextActions"
      ],
      "properties": {
        "schemaVersion": {
          "const": "workspai.project-lifecycle-context.v1"
        },
        "status": {
          "enum": [
            "insufficient-budget",
            "path-not-mapped"
          ]
        },
        "project": {
          "const": "."
        },
        "selection": {
          "$ref": "#/$defs/selection"
        },
        "budget": {
          "$ref": "#/$defs/requiredBudget"
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "nextActions": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "insufficient-budget"
              }
            }
          },
          "then": {
            "required": [
              "budget"
            ]
          },
          "else": {
            "not": {
              "required": [
                "budget"
              ]
            }
          }
        }
      ]
    }
  ],
  "$defs": {
    "selection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "mode"
      ],
      "properties": {
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "mode": {
          "enum": [
            "all-units",
            "closest-unit"
          ]
        }
      }
    },
    "usedBudget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "maxBytes",
        "usedBytes",
        "accounting"
      ],
      "properties": {
        "maxBytes": {
          "type": "integer",
          "minimum": 1024,
          "maximum": 65536
        },
        "usedBytes": {
          "type": "integer",
          "minimum": 1
        },
        "accounting": {
          "const": "utf8-json-with-newline"
        }
      }
    },
    "requiredBudget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "maxBytes",
        "requiredBytes",
        "accounting"
      ],
      "properties": {
        "maxBytes": {
          "type": "integer",
          "minimum": 1024,
          "maximum": 65536
        },
        "requiredBytes": {
          "type": "integer",
          "minimum": 1
        },
        "accounting": {
          "const": "utf8-json-with-newline"
        }
      }
    },
    "stage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "stage",
        "command",
        "confidence",
        "preflight"
      ],
      "properties": {
        "stage": {
          "enum": [
            "init",
            "test",
            "build",
            "start"
          ]
        },
        "command": {
          "type": "string",
          "minLength": 1
        },
        "cwd": {
          "type": "string",
          "minLength": 1,
          "description": "Working directory relative to the canonical selected project root; source reads do not select this directory for terminal commands."
        },
        "confidence": {
          "enum": [
            "high",
            "medium"
          ]
        },
        "preflight": {
          "enum": [
            "executable-and-inputs",
            "executable"
          ]
        },
        "focus": {
          "type": "string",
          "minLength": 1
        },
        "ownerManifest": {
          "type": "string",
          "minLength": 1
        },
        "setup": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "executable",
            "args"
          ],
          "properties": {
            "executable": {
              "type": "string",
              "minLength": 1
            },
            "args": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "argvSequence": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "executable",
              "args"
            ],
            "properties": {
              "executable": {
                "type": "string",
                "minLength": 1
              },
              "args": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "unit": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "runtime",
        "ecosystem",
        "role",
        "root",
        "manifest",
        "provenance",
        "stages"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "runtime": {
          "type": "string",
          "minLength": 1
        },
        "ecosystem": {
          "type": "string",
          "minLength": 1
        },
        "role": {
          "enum": [
            "production",
            "tooling",
            "test",
            "example"
          ]
        },
        "root": {
          "type": "string",
          "minLength": 1
        },
        "manifest": {
          "type": "string",
          "minLength": 1
        },
        "provenance": {
          "const": "manifest-derived"
        },
        "workspaceOwner": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "root",
            "manifest",
            "packageManager"
          ],
          "properties": {
            "root": {
              "type": "string",
              "minLength": 1
            },
            "manifest": {
              "type": "string",
              "minLength": 1
            },
            "packageManager": {
              "enum": [
                "npm",
                "pnpm",
                "yarn",
                "bun"
              ]
            }
          }
        },
        "stages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/stage"
          }
        }
      }
    }
  }
}