{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://readbeforerun.ai/schema/observation.schema.json",
  "title": "Agentic Security Field Guide lab observation (schema 0.5)",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "run_id": {
      "type": "string"
    },
    "entry": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{2,60}$"
    },
    "draft": {
      "type": "string",
      "enum": [
        "review",
        "demo"
      ]
    },
    "label": {
      "type": "string",
      "enum": [
        "observation",
        "measured"
      ]
    },
    "method_version": {
      "type": "string"
    },
    "reach_method": {
      "type": "string",
      "pattern": "^reach-v\\d+\\.\\d+$"
    },
    "published": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "run_by": {
      "type": "string",
      "minLength": 2
    },
    "disclaimer": {
      "type": "string"
    },
    "tool": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "commit": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "version": {
          "type": "string"
        },
        "install_source": {
          "type": "string",
          "enum": [
            "marketplace",
            "upstream",
            "package"
          ]
        },
        "declared_file": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "commit",
        "install_source",
        "declared_file"
      ],
      "additionalProperties": false
    },
    "runtime": {
      "type": "object",
      "properties": {
        "client": {
          "type": "string",
          "enum": [
            "claude-code",
            "codex",
            "gemini-cli",
            "cursor",
            "copilot",
            "openclaw",
            "mcp-generic",
            "standalone"
          ]
        },
        "client_version": {
          "type": "string"
        },
        "permission_mode": {
          "type": "string"
        },
        "allow_list": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sandbox": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": [
              "boolean",
              "string"
            ]
          }
        },
        "user": {
          "type": "string"
        }
      },
      "required": [
        "client",
        "client_version",
        "permission_mode",
        "sandbox",
        "user"
      ],
      "additionalProperties": false
    },
    "model": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "dated": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "route": {
              "type": "string",
              "enum": [
                "litellm-gateway",
                "direct"
              ]
            },
            "virtual_key": {
              "default": "tool",
              "type": "string",
              "enum": [
                "tool",
                "assistant"
              ]
            },
            "inference_region": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "dated",
            "route",
            "inference_region"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "target": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "image": {
          "type": "string",
          "pattern": "@sha256:[0-9a-f]{64}$"
        },
        "version": {
          "type": "string"
        },
        "ground_truth": {
          "type": "string"
        },
        "contamination": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "version",
        "ground_truth",
        "contamination"
      ],
      "additionalProperties": false
    },
    "access_mode": {
      "type": "string",
      "enum": [
        "white-box",
        "grey-box",
        "black-box"
      ]
    },
    "task_given": {
      "type": "string"
    },
    "timebox_minutes": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "overnight": {
      "type": "boolean"
    },
    "phases": {
      "type": "object",
      "properties": {
        "install": {
          "type": "object",
          "properties": {
            "start": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "end": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "egress_hosts": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "start",
            "end",
            "egress_hosts"
          ],
          "additionalProperties": false
        },
        "run": {
          "type": "object",
          "properties": {
            "start": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "end": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "egress_hosts": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "start",
            "end",
            "egress_hosts"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "install",
        "run"
      ],
      "additionalProperties": false
    },
    "duration_seconds": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "budget_cap_usd": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "cost": {
      "type": "object",
      "properties": {
        "cost_source": {
          "type": "string",
          "enum": [
            "measured",
            "tool-reported"
          ]
        },
        "total_cost": {
          "type": "number"
        },
        "input_tokens": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "output_tokens": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "duration_seconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "cost_per_hour": {
          "type": "number"
        },
        "file": {
          "type": "string"
        },
        "client_estimate_usd": {
          "type": "number"
        }
      },
      "required": [
        "cost_source",
        "total_cost",
        "input_tokens",
        "output_tokens",
        "duration_seconds",
        "cost_per_hour",
        "file"
      ],
      "additionalProperties": false
    },
    "result": {
      "type": "object",
      "properties": {
        "score": {
          "type": "string"
        },
        "findings_reported": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "sample_validated": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 10
        },
        "true_positives": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "false_positives": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "scope_violations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "file": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "score",
        "findings_reported",
        "sample_validated",
        "true_positives",
        "false_positives",
        "scope_violations"
      ],
      "additionalProperties": false
    },
    "reach_observed": {
      "type": "object",
      "properties": {
        "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "axes": {
          "type": "object",
          "properties": {
            "fs": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            },
            "net": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            },
            "exec": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            },
            "cred": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            },
            "persist": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            },
            "hitl": {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string",
                  "minLength": 8
                }
              },
              "required": [
                "value",
                "evidence"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "fs",
            "net",
            "exec",
            "cred",
            "persist",
            "hitl"
          ],
          "additionalProperties": false
        },
        "unknown": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "fs",
              "net",
              "exec",
              "cred",
              "persist",
              "hitl"
            ]
          }
        }
      },
      "required": [
        "level",
        "axes"
      ],
      "additionalProperties": false
    },
    "surplus": {
      "type": "object",
      "properties": {
        "axes": {
          "type": "object",
          "properties": {
            "fs": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            },
            "net": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            },
            "exec": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            },
            "cred": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            },
            "persist": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            },
            "hitl": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 3
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "fs",
            "net",
            "exec",
            "cred",
            "persist",
            "hitl"
          ],
          "additionalProperties": false
        },
        "count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 6
        },
        "beyond_static": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "fs",
              "net",
              "exec",
              "cred",
              "persist",
              "hitl"
            ]
          }
        },
        "headline": {
          "type": "string",
          "maxLength": 200
        }
      },
      "required": [
        "axes",
        "count",
        "headline"
      ],
      "additionalProperties": false
    },
    "fit": {
      "type": "string",
      "enum": [
        "fits",
        "partial",
        "excessive"
      ]
    },
    "verdict": {
      "type": "object",
      "properties": {
        "use_again": {
          "type": "string",
          "enum": [
            "yes",
            "with-limits",
            "no"
          ]
        },
        "one_sentence": {
          "type": "string",
          "maxLength": 200
        },
        "limits": {
          "type": "string"
        }
      },
      "required": [
        "use_again",
        "one_sentence",
        "limits"
      ],
      "additionalProperties": false
    },
    "min_config_tested": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      }
    },
    "incidents": {
      "type": "object",
      "properties": {
        "realtime_alerts": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "blocked": {
          "type": "string"
        },
        "aborted": {
          "type": "boolean"
        }
      },
      "required": [
        "realtime_alerts",
        "aborted"
      ],
      "additionalProperties": false
    },
    "artifacts": {
      "type": "object",
      "properties": {
        "manifest": {
          "type": "string"
        },
        "declared": {
          "type": "string"
        },
        "cost": {
          "type": "string"
        },
        "egress": {
          "type": "string"
        },
        "blocked": {
          "type": "string"
        },
        "fs_diff": {
          "type": "string"
        },
        "host_events": {
          "type": "string"
        },
        "hitl_events": {
          "type": "string"
        },
        "findings": {
          "type": "string"
        },
        "score": {
          "type": "string"
        },
        "cast": {
          "type": "object",
          "properties": {
            "file": {
              "type": "string"
            },
            "size_bytes": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 5242880
            },
            "markers": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^\\d{2}:\\d{2} \\S.*$"
              }
            }
          },
          "required": [
            "file",
            "size_bytes",
            "markers"
          ],
          "additionalProperties": false
        },
        "transcript": {
          "type": "string"
        },
        "extra": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "secret_scan": {
          "type": "object",
          "properties": {
            "redact": {
              "type": "string"
            },
            "gitleaks": {
              "type": "string"
            },
            "trufflehog": {
              "type": "string"
            },
            "date": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          "required": [
            "redact",
            "gitleaks",
            "date"
          ],
          "additionalProperties": false
        },
        "private": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "manifest",
        "declared",
        "egress",
        "blocked",
        "fs_diff",
        "host_events",
        "hitl_events",
        "findings",
        "score",
        "secret_scan"
      ],
      "additionalProperties": false
    },
    "interests": {
      "type": "string",
      "minLength": 50
    },
    "right_of_reply": {
      "type": "string",
      "enum": [
        "dispute-process",
        "sent",
        "answered",
        "no-response-14d"
      ]
    },
    "replications": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "by": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "status": {
            "type": "string",
            "enum": [
              "community",
              "checked"
            ]
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "by",
          "date",
          "status"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schema_version",
    "run_id",
    "entry",
    "label",
    "method_version",
    "reach_method",
    "published",
    "run_by",
    "disclaimer",
    "tool",
    "runtime",
    "model",
    "target",
    "access_mode",
    "task_given",
    "timebox_minutes",
    "overnight",
    "phases",
    "duration_seconds",
    "result",
    "reach_observed",
    "surplus",
    "fit",
    "verdict",
    "min_config_tested",
    "incidents",
    "artifacts",
    "interests",
    "right_of_reply"
  ],
  "additionalProperties": false
}
