{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "agengo request v1",
"type": "object",
"required": ["role"],
"properties": {
"schema_version": {"const": 1},
"role": {"enum": ["plan", "build", "review"]},
"message_id": {"type": "string", "minLength": 1},
"attempt_id": {"type": "string", "minLength": 1},
"run_id": {"$ref": "#/$defs/id"},
"plan_revision": {"type": "integer", "minimum": 1},
"worktree": {"type": "string", "minLength": 1},
"head": {"$ref": "#/$defs/sha"},
"base": {"$ref": "#/$defs/sha"},
"integration_sha": {"$ref": "#/$defs/sha"},
"goal": {"type": "string", "minLength": 1},
"existing_plan": {"type": "string", "minLength": 1},
"builder_handoff": {"enum": ["worktree", "commit"]},
"review_scope": {"const": "integrated"},
"human_request_id": {"type": "integer", "minimum": 1},
"context": {"type": ["string", "object", "null"]},
"task": {
"type": "object",
"required": ["id", "goal", "owns", "verify"],
"properties": {
"id": {"type": "string", "pattern": "^([A-Za-z0-9][A-Za-z0-9_-]{0,63}|__quality__)$"},
"goal": {"type": "string", "minLength": 1},
"owns": {"type": "array", "items": {"type": "string"}},
"verify": {"type": "array", "items": {"type": "array", "minItems": 1, "items": {"type": "string"}}}
}
},
"relationships": {
"type": "object",
"required": ["depends_on", "required_by", "related_to", "conflicts_with"],
"properties": {
"depends_on": {"type": "array", "items": {
"type": "object",
"required": ["task_id", "state", "verified_ancestor_sha"],
"properties": {
"task_id": {"$ref": "#/$defs/id"},
"state": {"const": "integrated"},
"verified_ancestor_sha": {"$ref": "#/$defs/sha"}
}
}},
"required_by": {"type": "array", "items": {"$ref": "#/$defs/edge"}},
"related_to": {"type": "array", "items": {"$ref": "#/$defs/edge"}},
"conflicts_with": {"type": "array", "items": {"$ref": "#/$defs/edge"}}
}
}
},
"allOf": [
{
"if": {"properties": {"role": {"const": "plan"}}},
"then": {
"oneOf": [{"required": ["goal"]}, {"required": ["existing_plan"]}],
"properties": {"context": {"type": ["string", "null"]}}
},
"else": {
"required": ["schema_version", "message_id", "attempt_id", "run_id", "plan_revision", "task", "worktree", "head", "base", "integration_sha", "context"],
"properties": {"context": {
"type": "object",
"required": ["acceptance", "decisions", "open_findings"],
"properties": {
"acceptance": {"type": "array", "items": {"type": "object", "required": ["id", "text"]}},
"decisions": {"type": "array", "items": {"type": "object", "required": ["id", "text", "scope"]}},
"open_findings": {"type": "array", "items": {"type": "object", "required": ["id", "acceptance_id", "reviewed_sha", "source_attempt_id", "evidence", "required_outcome"]}}
}
}}
}
}
],
"$defs": {
"id": {"type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"},
"sha": {"type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"},
"edge": {"type": "object", "required": ["task_id"], "properties": {"task_id": {"$ref": "#/$defs/id"}}}
}
}