{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Loop State",
"description": "JSON Schema for local loop state TOML after parsing",
"type": "object",
"required": ["loop", "dependencies", "items"],
"properties": {
"loop": {
"type": "object",
"required": ["id", "state", "work", "resolved"],
"properties": {
"id": {
"type": "string",
"pattern": "^LOOP-(?:(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29|[0-9]{4}-(?:(?:01|03|05|07|08|10|12)-(?:0[1-9]|[12][0-9]|3[01])|(?:04|06|09|11)-(?:0[1-9]|[12][0-9]|30)|02-(?:0[1-9]|1[0-9]|2[0-8])))-(?:00[1-9]|0[1-9][0-9]|[1-9][0-9]{2})$"
},
"state": {
"type": "string",
"enum": ["pending", "active", "paused", "completed", "failed"]
},
"work": {
"type": "array",
"items": {
"$ref": "#/definitions/workItemId"
},
"uniqueItems": true
},
"resolved": {
"type": "array",
"items": {
"$ref": "#/definitions/workItemId"
},
"uniqueItems": true
},
"current_round": {
"type": "integer",
"minimum": 0
},
"next_action": {
"type": "string",
"enum": [
"start",
"write_summary",
"continue",
"resolve_blocker",
"complete"
]
}
},
"additionalProperties": false
},
"dependencies": {
"type": "object",
"propertyNames": {
"$ref": "#/definitions/workItemId"
},
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/workItemId"
},
"uniqueItems": true
}
},
"items": {
"type": "object",
"propertyNames": {
"$ref": "#/definitions/workItemId"
},
"additionalProperties": {
"type": "object",
"required": ["status", "round_count"],
"properties": {
"status": {
"type": "string",
"enum": [
"pending",
"active",
"done",
"failed",
"blocked",
"cancelled"
]
},
"round_count": {
"type": "integer",
"minimum": 0
},
"last_round": {
"type": "integer",
"minimum": 0
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false,
"definitions": {
"workItemId": {
"type": "string",
"pattern": "^WI-\\d{4}-\\d{2}-\\d{2}-(?:[a-f0-9]{4}(?:-\\d{3})?|\\d{3})$"
}
}
}