{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Agentic bounded EGM documentation worker return",
  "description": "Modified by Agentic, 2026-10-28 from Google EGM (Apache-2.0): strict bounded outcomes/evidence, no placeholder success.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "status": {
      "enum": [
        "completed",
        "incomplete"
      ]
    },
    "subtree_index": {
      "type": "array",
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "summary": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "interface": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16384
            }
          },
          "invariants": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16384
            }
          },
          "side_effects": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16384
            }
          },
          "evidence": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16384
            }
          }
        },
        "required": [
          "path",
          "summary",
          "interface",
          "invariants",
          "side_effects",
          "evidence"
        ]
      }
    },
    "gaps": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "maxItems": 1000
    }
  },
  "required": [
    "status",
    "subtree_index",
    "gaps"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "status": {
            "const": "completed"
          }
        }
      },
      "then": {
        "properties": {
          "gaps": {
            "maxItems": 0
          },
          "subtree_index": {
            "minItems": 1
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "status": {
            "const": "incomplete"
          }
        }
      },
      "then": {
        "properties": {
          "gaps": {
            "minItems": 1
          }
        }
      }
    }
  ]
}
