{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "urn:mosaic:planning:issue-53:records:candidate-1", "title": "Planning candidate only: declarative record shapes", "description": "References, parent ownership, transition permissions and authenticated writers require semantic validation outside this schema. No runtime consumes this file.", "oneOf": [ { "$ref": "#/$defs/agent-definition" }, { "$ref": "#/$defs/project" }, { "$ref": "#/$defs/workspace" }, { "$ref": "#/$defs/registration" }, { "$ref": "#/$defs/mission" }, { "$ref": "#/$defs/task" }, { "$ref": "#/$defs/assignment" }, { "$ref": "#/$defs/decision" }, { "$ref": "#/$defs/session" }, { "$ref": "#/$defs/context-source" }, { "$ref": "#/$defs/adapter-capability" } ], "$defs": { "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$" }, "runtimeId": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" }, "revision": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }, "time": { "type": "string", "format": "date-time", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" }, "actor": { "type": "object", "additionalProperties": false, "required": [ "kind", "principalId", "executionId" ], "properties": { "kind": { "enum": [ "human", "service", "agent" ] }, "principalId": { "$ref": "#/$defs/id" }, "executionId": { "oneOf": [ { "$ref": "#/$defs/runtimeId" }, { "type": "null" } ] } }, "if": { "properties": { "kind": { "const": "agent" } } }, "then": { "properties": { "executionId": { "$ref": "#/$defs/runtimeId" } } }, "else": { "properties": { "executionId": { "type": "null" } } } }, "artifactRef": { "type": "object", "additionalProperties": false, "required": [ "runId", "artifactId", "digest" ], "properties": { "runId": { "$ref": "#/$defs/id" }, "artifactId": { "$ref": "#/$defs/id" }, "digest": { "$ref": "#/$defs/digest" } } }, "workspaceScope": { "type": "object", "additionalProperties": false, "required": [ "kind", "projectId", "workspaceId" ], "properties": { "kind": { "const": "workspace" }, "projectId": { "$ref": "#/$defs/id" }, "workspaceId": { "$ref": "#/$defs/id" } } }, "projectScope": { "type": "object", "additionalProperties": false, "required": [ "kind", "projectId" ], "properties": { "kind": { "const": "project" }, "projectId": { "$ref": "#/$defs/id" } } }, "systemScope": { "type": "object", "additionalProperties": false, "required": [ "kind" ], "properties": { "kind": { "const": "system" } } }, "scope": { "oneOf": [ { "$ref": "#/$defs/systemScope" }, { "$ref": "#/$defs/projectScope" }, { "$ref": "#/$defs/workspaceScope" } ] }, "recordRef": { "type": "object", "additionalProperties": false, "required": [ "kind", "id", "scope", "revision" ], "properties": { "kind": { "enum": [ "agent-definition", "project", "workspace", "registration", "mission", "task", "assignment", "decision", "session", "context-source", "adapter-capability" ] }, "id": { "$ref": "#/$defs/id" }, "scope": { "$ref": "#/$defs/scope" }, "revision": { "$ref": "#/$defs/revision" } } }, "registryRef": { "type": "object", "additionalProperties": false, "required": [ "registry", "id", "revision", "digest" ], "properties": { "registry": { "enum": [ "harness", "settings", "context-content", "scope-role", "agent-policy", "project-policy", "endpoint" ] }, "id": { "$ref": "#/$defs/id" }, "revision": { "$ref": "#/$defs/revision" }, "digest": { "$ref": "#/$defs/digest" } } }, "operation": { "enum": [ "work.read", "file.read", "file.change", "command.execute", "work.propose", "task.create", "assignment.change", "result.submit", "task.accept", "registration.manage", "conversation.read", "conversation.observe", "execution.launch", "execution.control", "execution.transfer", "workspace.retire", "workspace.reopen", "message.send", "audit.read", "project.create", "project.change", "workspace.create", "workspace.change", "mission.create", "mission.change", "mission.accept", "task.change", "decision.issue", "session.adopt" ] }, "relativePath": { "type": "string", "format": "mosaic-relative-path", "minLength": 1, "maxLength": 4096, "pattern": "^(?!/)(?!.*[\\\\\\u0000-\\u001f\\u007f])(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)[^/]+(?:/[^/]+)*$" }, "pathGrant": { "type": "object", "additionalProperties": false, "required": [ "root", "path" ], "properties": { "root": { "const": "workspace" }, "path": { "oneOf": [ { "$ref": "#/$defs/relativePath" }, { "type": "null" } ] } } }, "restrictions": { "type": "object", "additionalProperties": false, "required": [ "operations", "readPaths", "writePaths", "network", "endpointRefs" ], "properties": { "operations": { "type": "array", "items": { "$ref": "#/$defs/operation" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "readPaths": { "type": "array", "items": { "$ref": "#/$defs/pathGrant" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "writePaths": { "type": "array", "items": { "$ref": "#/$defs/pathGrant" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "network": { "enum": [ "none", "approved-endpoints" ] }, "endpointRefs": { "type": "array", "items": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "endpoint" } } } ] }, "minItems": 0, "maxItems": 1024, "uniqueItems": true } }, "allOf": [ { "if": { "properties": { "network": { "const": "none" } } }, "then": { "properties": { "endpointRefs": { "maxItems": 0 } } }, "else": { "properties": { "endpointRefs": { "minItems": 1 } } } } ] }, "criterion": { "type": "object", "additionalProperties": false, "required": [ "id", "text" ], "properties": { "id": { "$ref": "#/$defs/id" }, "text": { "type": "string", "minLength": 1, "maxLength": 4000 } } }, "contentRefs": { "type": "array", "items": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "context-content" } } } ] }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "envelope": { "type": "object", "additionalProperties": false, "required": [ "schemaVersion", "kind", "id", "scope", "revision", "createdAt", "createdBy", "supersedes", "authorizationRef", "payload" ], "properties": { "schemaVersion": { "const": 1 }, "kind": { "enum": [ "agent-definition", "project", "workspace", "registration", "mission", "task", "assignment", "decision", "session", "context-source", "adapter-capability" ] }, "id": { "$ref": "#/$defs/id" }, "scope": { "$ref": "#/$defs/scope" }, "revision": { "$ref": "#/$defs/revision" }, "createdAt": { "$ref": "#/$defs/time" }, "createdBy": { "$ref": "#/$defs/actor" }, "supersedes": { "oneOf": [ { "$ref": "#/$defs/recordRef" }, { "type": "null" } ] }, "authorizationRef": { "$ref": "#/$defs/runtimeId" }, "payload": { "type": "object" } }, "allOf": [ { "if": { "properties": { "revision": { "const": 1 } } }, "then": { "properties": { "supersedes": { "type": "null" } } }, "else": { "properties": { "supersedes": { "$ref": "#/$defs/recordRef" } } } } ] }, "agent-definitionPayload": { "type": "object", "additionalProperties": false, "required": [ "displayName", "agentType", "harnessRef", "settingsRef", "soulRef", "instructionRefs", "skillRefs", "policyRef", "status" ], "properties": { "displayName": { "type": "string", "minLength": 1, "maxLength": 128 }, "agentType": { "$ref": "#/$defs/id" }, "harnessRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "harness" } } } ] }, "settingsRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "settings" } } } ] }, "soulRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "context-content" } } } ] }, "instructionRefs": { "$ref": "#/$defs/contentRefs" }, "skillRefs": { "$ref": "#/$defs/contentRefs" }, "policyRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "agent-policy" } } } ] }, "status": { "enum": [ "enabled", "disabled" ] } } }, "agent-definition": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "agent-definition" }, "payload": { "$ref": "#/$defs/agent-definitionPayload" }, "scope": { "$ref": "#/$defs/systemScope" } } } ] }, "projectPayload": { "type": "object", "additionalProperties": false, "required": [ "displayName", "policyRef", "status" ], "properties": { "displayName": { "type": "string", "minLength": 1, "maxLength": 128 }, "policyRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "project-policy" } } } ] }, "status": { "enum": [ "active", "retired" ] } } }, "project": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "project" }, "payload": { "$ref": "#/$defs/projectPayload" }, "scope": { "$ref": "#/$defs/projectScope" } } } ] }, "workspacePayload": { "type": "object", "additionalProperties": false, "required": [ "displayName", "policyRef", "status", "fileRootId" ], "properties": { "displayName": { "type": "string", "minLength": 1, "maxLength": 128 }, "policyRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "project-policy" } } } ] }, "status": { "enum": [ "active", "retiring", "retired" ] }, "fileRootId": { "$ref": "#/$defs/id" } } }, "workspace": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "workspace" }, "payload": { "$ref": "#/$defs/workspacePayload" }, "scope": { "$ref": "#/$defs/workspaceScope" } } } ] }, "registrationPayload": { "type": "object", "additionalProperties": false, "required": [ "agentId", "scopeRoleRef", "restrictions", "projectRegistrationRef", "status", "delegationRef" ], "properties": { "agentId": { "$ref": "#/$defs/id" }, "scopeRoleRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "scope-role" } } } ] }, "restrictions": { "oneOf": [ { "$ref": "#/$defs/restrictions" }, { "type": "null" } ] }, "projectRegistrationRef": { "oneOf": [ { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "registration" } } } ] }, { "type": "null" } ] }, "status": { "enum": [ "active", "revoked" ] }, "delegationRef": { "oneOf": [ { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "decision" } } } ] }, { "type": "null" } ] } } }, "registration": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "registration" }, "payload": { "$ref": "#/$defs/registrationPayload" }, "scope": { "oneOf": [ { "$ref": "#/$defs/projectScope" }, { "$ref": "#/$defs/workspaceScope" } ] } } }, { "if": { "properties": { "scope": { "properties": { "kind": { "const": "project" } } } } }, "then": { "properties": { "payload": { "properties": { "projectRegistrationRef": { "type": "null" } } } } }, "else": { "properties": { "payload": { "properties": { "projectRegistrationRef": { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "registration" } } } ] } } } } } } ] }, "missionPayload": { "type": "object", "additionalProperties": false, "required": [ "objective", "criteria", "parentMissionRef", "restrictions", "status" ], "properties": { "objective": { "type": "string", "minLength": 1, "maxLength": 4000 }, "criteria": { "type": "array", "items": { "$ref": "#/$defs/criterion" }, "minItems": 1, "maxItems": 1024, "uniqueItems": true }, "parentMissionRef": { "oneOf": [ { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "mission" } } } ] }, { "type": "null" } ] }, "restrictions": { "oneOf": [ { "$ref": "#/$defs/restrictions" }, { "type": "null" } ] }, "status": { "enum": [ "proposed", "active", "blocked", "ready-for-review", "accepted", "canceled" ] } } }, "mission": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "mission" }, "payload": { "$ref": "#/$defs/missionPayload" }, "scope": { "oneOf": [ { "$ref": "#/$defs/projectScope" }, { "$ref": "#/$defs/workspaceScope" } ] } } }, { "if": { "properties": { "scope": { "properties": { "kind": { "const": "project" } } } } }, "then": { "properties": { "payload": { "properties": { "parentMissionRef": { "type": "null" } } } } } } ] }, "taskPayload": { "type": "object", "additionalProperties": false, "required": [ "purpose", "criteria", "missionRef", "intentRef", "dependencies", "restrictions", "status" ], "properties": { "purpose": { "type": "string", "minLength": 1, "maxLength": 4000 }, "criteria": { "type": "array", "items": { "$ref": "#/$defs/criterion" }, "minItems": 1, "maxItems": 1024, "uniqueItems": true }, "missionRef": { "oneOf": [ { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "mission" } } } ] }, { "type": "null" } ] }, "intentRef": { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "decision" } } } ] }, "dependencies": { "type": "array", "items": { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "task" } } } ] }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "restrictions": { "oneOf": [ { "$ref": "#/$defs/restrictions" }, { "type": "null" } ] }, "status": { "enum": [ "proposed", "ready", "active", "blocked", "ready-for-review", "accepted", "canceled" ] } } }, "task": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "task" }, "payload": { "$ref": "#/$defs/taskPayload" }, "scope": { "$ref": "#/$defs/workspaceScope" } } } ] }, "assignmentPayload": { "type": "object", "additionalProperties": false, "required": [ "taskRef", "agentId", "intentRef", "status", "endReason" ], "properties": { "taskRef": { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "task" } } } ] }, "agentId": { "$ref": "#/$defs/id" }, "intentRef": { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "decision" } } } ] }, "status": { "enum": [ "selected", "paused", "ended" ] }, "endReason": { "enum": [ null, "completed", "abandoned", "revoked", "reassigned", "canceled" ] } }, "allOf": [ { "if": { "properties": { "status": { "const": "ended" } } }, "then": { "properties": { "endReason": { "type": "string" } } }, "else": { "properties": { "endReason": { "type": "null" } } } } ] }, "assignment": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "assignment" }, "payload": { "$ref": "#/$defs/assignmentPayload" }, "scope": { "$ref": "#/$defs/workspaceScope" } } } ] }, "decisionPayload": { "type": "object", "additionalProperties": false, "required": [ "decisionKind", "subjectRefs", "outcome", "basisRef", "evidenceRefs", "delegatedOperations" ], "properties": { "decisionKind": { "enum": [ "plan-approval", "delegation", "assignment-change", "acceptance", "owner-checkpoint", "reconciliation" ] }, "subjectRefs": { "type": "array", "items": { "$ref": "#/$defs/recordRef" }, "minItems": 1, "maxItems": 1024, "uniqueItems": true }, "outcome": { "enum": [ "approved", "rejected" ] }, "basisRef": { "$ref": "#/$defs/artifactRef" }, "evidenceRefs": { "type": "array", "items": { "$ref": "#/$defs/artifactRef" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "delegatedOperations": { "type": "array", "items": { "$ref": "#/$defs/operation" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true } }, "allOf": [ { "if": { "properties": { "decisionKind": { "const": "delegation" }, "outcome": { "const": "approved" } } }, "then": { "properties": { "delegatedOperations": { "minItems": 1 } } }, "else": { "properties": { "delegatedOperations": { "maxItems": 0 } } } } ] }, "decision": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "decision" }, "payload": { "$ref": "#/$defs/decisionPayload" } } } ] }, "sessionPayload": { "type": "object", "additionalProperties": false, "required": [ "agentId", "creationMode", "predecessorRef", "harnessRef", "harnessSessionId", "sessionArtifactId" ], "properties": { "agentId": { "$ref": "#/$defs/id" }, "creationMode": { "enum": [ "initial", "fresh", "adopted" ] }, "predecessorRef": { "oneOf": [ { "allOf": [ { "$ref": "#/$defs/recordRef" }, { "properties": { "kind": { "const": "session" } } } ] }, { "type": "null" } ] }, "harnessRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "harness" } } } ] }, "harnessSessionId": { "$ref": "#/$defs/id" }, "sessionArtifactId": { "$ref": "#/$defs/id" } }, "allOf": [ { "if": { "properties": { "creationMode": { "const": "initial" } } }, "then": { "properties": { "predecessorRef": { "type": "null" } } } } ] }, "session": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "session" }, "payload": { "$ref": "#/$defs/sessionPayload" }, "scope": { "$ref": "#/$defs/workspaceScope" } } } ] }, "context-sourcePayload": { "type": "object", "additionalProperties": false, "required": [ "contentRef", "category", "sharedByDefault", "permittedScopes", "relevanceRefs" ], "properties": { "contentRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "context-content" } } } ] }, "category": { "enum": [ "general-preference", "personal", "project", "work" ] }, "sharedByDefault": { "type": "boolean" }, "permittedScopes": { "type": "array", "items": { "$ref": "#/$defs/scope" }, "minItems": 1, "maxItems": 1024, "uniqueItems": true }, "relevanceRefs": { "type": "array", "items": { "$ref": "#/$defs/recordRef" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true } }, "allOf": [ { "if": { "properties": { "sharedByDefault": { "const": true } } }, "then": { "properties": { "category": { "const": "general-preference" } } } } ] }, "context-source": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "context-source" }, "payload": { "$ref": "#/$defs/context-sourcePayload" } } } ] }, "adapter-capabilityPayload": { "type": "object", "additionalProperties": false, "required": [ "harnessRef", "operations", "observableClasses", "enforceableClasses", "evidenceRefs", "status" ], "properties": { "harnessRef": { "allOf": [ { "$ref": "#/$defs/registryRef" }, { "properties": { "registry": { "const": "harness" } } } ] }, "operations": { "type": "array", "items": { "$ref": "#/$defs/operation" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "observableClasses": { "type": "array", "items": { "$ref": "#/$defs/id" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "enforceableClasses": { "type": "array", "items": { "$ref": "#/$defs/id" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "evidenceRefs": { "type": "array", "items": { "$ref": "#/$defs/artifactRef" }, "minItems": 0, "maxItems": 1024, "uniqueItems": true }, "status": { "enum": [ "documented-only", "verified" ] } }, "allOf": [ { "if": { "properties": { "status": { "const": "verified" } } }, "then": { "properties": { "evidenceRefs": { "minItems": 1 } } } } ] }, "adapter-capability": { "allOf": [ { "$ref": "#/$defs/envelope" }, { "properties": { "kind": { "const": "adapter-capability" }, "payload": { "$ref": "#/$defs/adapter-capabilityPayload" }, "scope": { "$ref": "#/$defs/systemScope" } } } ] } } }