{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://amber-protocol.dev/schemas/workflow-assessment.schema.json",
	"title": "Workflow Effectiveness Assessment Report",
	"description": "Read-only assessment of agent workflow effectiveness, separate from Governance Readiness. See ADR-0008.",
	"type": "object",
	"required": ["schemaVersion", "target", "scope", "coverage", "dimensions", "findings"],
	"properties": {
		"schemaVersion": { "type": "string", "const": "1.0.0" },
		"target": { "type": "string", "minLength": 1 },
		"generatedAt": { "type": "string", "format": "date-time" },
		"scope": {
			"type": "object",
			"required": ["repository", "sessions"],
			"properties": {
				"repository": { "type": "boolean" },
				"sessions": { "enum": ["covered", "partial", "unavailable", "not-applicable"] },
				"providers": {
					"type": "array",
					"items": { "type": "string" }
				}
			}
		},
		"coverage": {
			"type": "object",
			"required": ["repository", "session", "delivery", "agentAssets"],
			"properties": {
				"repository": { "$ref": "#/definitions/CoverageState" },
				"session": { "$ref": "#/definitions/CoverageState" },
				"delivery": { "$ref": "#/definitions/CoverageState" },
				"agentAssets": { "$ref": "#/definitions/CoverageState" }
			}
		},
		"dimensions": {
			"type": "object",
			"required": [
				"contextAdequacy",
				"lifecycleDiscipline",
				"verificationCoverage",
				"deliveryIntegrity",
				"improvementLoop"
			],
			"properties": {
				"contextAdequacy": { "$ref": "#/definitions/Dimension" },
				"lifecycleDiscipline": { "$ref": "#/definitions/Dimension" },
				"verificationCoverage": { "$ref": "#/definitions/Dimension" },
				"deliveryIntegrity": { "$ref": "#/definitions/Dimension" },
				"improvementLoop": { "$ref": "#/definitions/Dimension" }
			}
		},
		"findings": {
			"type": "array",
			"items": { "$ref": "#/definitions/Finding" }
		},
		"sessionObservations": {
			"type": "array",
			"description": "P2: normalized session observations (amber-native and/or Claude host transcripts). Absent when --no-sessions.",
			"items": { "$ref": "#/definitions/SessionObservation" }
		},
		"amber_protocol_version": { "type": "string" },
		"artifact_sequence": { "type": "integer" },
		"created_at": { "type": "string", "format": "date-time" },
		"artifact_type": { "type": "string" }
	},
	"definitions": {
		"CoverageState": {
			"enum": ["covered", "partial", "unavailable", "not-applicable", "unsupported"]
		},
		"Dimension": {
			"type": "object",
			"required": ["coverage", "confidence"],
			"properties": {
				"score": {
					"type": ["integer", "null"],
					"minimum": 0,
					"maximum": 100
				},
				"confidence": { "enum": ["low", "medium", "high"] },
				"coverage": { "$ref": "#/definitions/CoverageState" },
				"evidenceRefs": {
					"type": "array",
					"items": { "type": "string" }
				},
				"checks": {
					"type": "array",
					"items": { "$ref": "#/definitions/CheckResult" }
				},
				"note": { "type": "string" }
			}
		},
		"CheckResult": {
			"type": "object",
			"required": ["id", "status"],
			"properties": {
				"id": { "type": "string" },
				"status": { "enum": ["pass", "partial", "fail", "not-applicable"] },
				"evidenceRefs": {
					"type": "array",
					"items": { "type": "string" }
				},
				"confidenceImpact": { "enum": ["low", "medium", "high"] },
				"note": { "type": "string" }
			}
		},
		"Finding": {
			"type": "object",
			"required": [
				"id",
				"dimension",
				"severity",
				"confidence",
				"summary",
				"evidenceRefs",
				"owner",
				"verifier",
				"actionKind"
			],
			"properties": {
				"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
				"dimension": {
					"enum": [
						"contextAdequacy",
						"lifecycleDiscipline",
						"verificationCoverage",
						"deliveryIntegrity",
						"improvementLoop"
					]
				},
				"severity": { "enum": ["info", "warning", "error"] },
				"confidence": { "enum": ["low", "medium", "high"] },
				"summary": { "type": "string", "minLength": 1 },
				"evidenceRefs": {
					"type": "array",
					"minItems": 1,
					"items": { "type": "string" }
				},
				"owner": { "type": "string" },
				"verifier": { "type": "string", "minLength": 1 },
				"actionKind": { "enum": ["maintenance-proposal", "plan-input", "none"] }
			}
		},
		"SessionObservation": {
			"type": "object",
			"required": ["sessionId", "status"],
			"properties": {
				"sessionId": { "type": "string" },
				"provider": { "type": "string", "description": "amber-native | claude | …" },
				"goal": { "type": ["string", "null"] },
				"routeId": { "type": ["string", "null"] },
				"status": { "type": "string" },
				"feature": { "type": ["string", "null"] },
				"stageTransitions": { "type": "integer", "minimum": 0 },
				"validationFailures": { "type": "integer", "minimum": 0 },
				"failures": { "type": "integer", "minimum": 0 },
				"retries": { "type": "integer", "minimum": 0 },
				"approvals": { "type": "integer", "minimum": 0 },
				"denials": { "type": "integer", "minimum": 0 },
				"durationMs": { "type": ["integer", "null"], "minimum": 0 }
			},
			"additionalProperties": true
		}
	}
}
