{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://iop.local/schemas/hot-path-agent-smoke-manifest.schema.json",
  "title": "Hot Path Agent Smoke Manifest",
  "description": "Closed evidence contract for the credential-free Claude/Pi Hot Path smoke harness. Every object is additionalProperties:false and forbidden secret/raw-value field names are explicitly rejected, so the manifest can carry only non-secret source/runtime identity, runner facts, the fixed ten-case matrix, ordered visible-event/observation evidence, workspace before/after state, and zero-match redaction evidence.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "run_id",
    "source",
    "runtime",
    "runner",
    "cases",
    "redaction"
  ],
  "properties": {
    "schema_version": {
      "const": "1"
    },
    "run_id": {
      "$ref": "#/$defs/digest"
    },
    "source": {
      "$ref": "#/$defs/source"
    },
    "runtime": {
      "$ref": "#/$defs/runtime"
    },
    "runner": {
      "$ref": "#/$defs/runner"
    },
    "cases": {
      "type": "array",
      "minItems": 10,
      "maxItems": 10,
      "prefixItems": [
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "claude:direct" },
            "agent": { "const": "claude" },
            "scenario": { "const": "direct" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "none" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "claude:light-pass" },
            "agent": { "const": "claude" },
            "scenario": { "const": "light-pass" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "removed" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "review" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "cleanup" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "claude:repair" },
            "agent": { "const": "claude" },
            "scenario": { "const": "repair" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "removed" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "review" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "cleanup" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "claude:write-unavailable" },
            "agent": { "const": "claude" },
            "scenario": { "const": "write-unavailable" },
            "outcome": { "const": "error" },
            "terminal": { "const": "provider_error" },
            "cleanup": { "const": "none" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "failed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "claude:timeout-cancel" },
            "agent": { "const": "claude" },
            "scenario": { "const": "timeout-cancel" },
            "outcome": { "const": "cancelled" },
            "terminal": { "const": "cancelled" },
            "cleanup": { "const": "orphan" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": true }, "target": { "const": "child_only" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "pi:direct" },
            "agent": { "const": "pi" },
            "scenario": { "const": "direct" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "none" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "pi:light-pass" },
            "agent": { "const": "pi" },
            "scenario": { "const": "light-pass" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "removed" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "review" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "cleanup" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "pi:repair" },
            "agent": { "const": "pi" },
            "scenario": { "const": "repair" },
            "outcome": { "const": "completed" },
            "terminal": { "const": "success" },
            "cleanup": { "const": "removed" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "review" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "cleanup" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "pi:write-unavailable" },
            "agent": { "const": "pi" },
            "scenario": { "const": "write-unavailable" },
            "outcome": { "const": "error" },
            "terminal": { "const": "provider_error" },
            "cleanup": { "const": "none" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "failed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": false }, "target": { "const": "none" } } }
          }
        },
        {
          "$ref": "#/$defs/case",
          "properties": {
            "id": { "const": "pi:timeout-cancel" },
            "agent": { "const": "pi" },
            "scenario": { "const": "timeout-cancel" },
            "outcome": { "const": "cancelled" },
            "terminal": { "const": "cancelled" },
            "cleanup": { "const": "orphan" },
            "observation": {
              "type": "array",
              "prefixItems": [
                { "properties": { "stage": { "const": "selector" }, "outcome": { "const": "observed" } } },
                { "properties": { "stage": { "const": "local" }, "outcome": { "const": "observed" } } }
              ],
              "items": false
            },
            "cancellation": { "properties": { "triggered": { "const": true }, "target": { "const": "child_only" } } }
          }
        }
      ],
      "items": false
    },
    "redaction": {
      "$ref": "#/$defs/redaction"
    }
  },
  "patternProperties": {
    "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie|session_token)$": false
  },
  "$defs": {
    "digest": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "revision": {
      "type": "string",
      "pattern": "^[0-9a-f]{7,64}$"
    },
    "hash40": {
      "type": "string",
      "pattern": "^[0-9a-f]{40,64}$"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "head",
        "source_tree",
        "script_sha256",
        "schema_sha256"
      ],
      "properties": {
        "head": {
          "$ref": "#/$defs/revision"
        },
        "source_tree": {
          "$ref": "#/$defs/hash40"
        },
        "script_sha256": {
          "$ref": "#/$defs/digest"
        },
        "schema_sha256": {
          "$ref": "#/$defs/digest"
        }
      },
      "patternProperties": {
        "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie)$": false
      }
    },
    "runtime": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "runtime_sha256",
        "fixture_sha256",
        "observation_sha256",
        "workspace_root_hash"
      ],
      "properties": {
        "runtime_sha256": {
          "$ref": "#/$defs/digest"
        },
        "fixture_sha256": {
          "$ref": "#/$defs/digest"
        },
        "observation_sha256": {
          "$ref": "#/$defs/digest"
        },
        "workspace_root_hash": {
          "$ref": "#/$defs/digest"
        }
      },
      "patternProperties": {
        "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie)$": false
      }
    },
    "runner": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "claude_binary_sha256",
        "pi_binary_sha256",
        "claude_secret_present",
        "pi_secret_present",
        "claude_flags",
        "pi_flags"
      ],
      "properties": {
        "claude_binary_sha256": {
          "$ref": "#/$defs/digest"
        },
        "pi_binary_sha256": {
          "$ref": "#/$defs/digest"
        },
        "claude_secret_present": {
          "type": "boolean"
        },
        "pi_secret_present": {
          "type": "boolean"
        },
        "claude_flags": {
          "type": "array",
          "minItems": 6,
          "maxItems": 6,
          "prefixItems": [
            {
              "const": "--print"
            },
            {
              "const": "--output-format"
            },
            {
              "const": "stream-json"
            },
            {
              "const": "--include-partial-messages"
            },
            {
              "const": "--no-session-persistence"
            },
            {
              "const": "--bare"
            }
          ],
          "items": false
        },
        "pi_flags": {
          "type": "array",
          "minItems": 6,
          "maxItems": 6,
          "prefixItems": [
            {
              "const": "--provider"
            },
            {
              "const": "--model"
            },
            {
              "const": "--mode"
            },
            {
              "const": "json"
            },
            {
              "const": "--print"
            },
            {
              "const": "--no-session"
            }
          ],
          "items": false
        }
      },
      "patternProperties": {
        "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie)$": false
      }
    },
    "case": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "agent",
        "scenario",
        "argv_hash",
        "process_exit",
        "outcome",
        "terminal",
        "cleanup",
        "visible_events",
        "observation",
        "workspace_before",
        "workspace_after",
        "cancellation",
        "duration_ms"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(claude|pi):(direct|light-pass|repair|write-unavailable|timeout-cancel)$"
        },
        "agent": {
          "enum": [
            "claude",
            "pi"
          ]
        },
        "scenario": {
          "enum": [
            "direct",
            "light-pass",
            "repair",
            "write-unavailable",
            "timeout-cancel"
          ]
        },
        "argv_hash": {
          "$ref": "#/$defs/digest"
        },
        "process_exit": {
          "type": "integer",
          "minimum": 0,
          "maximum": 255
        },
        "outcome": {
          "enum": [
            "completed",
            "error",
            "cancelled"
          ]
        },
        "terminal": {
          "enum": [
            "success",
            "provider_error",
            "cancelled"
          ]
        },
        "cleanup": {
          "enum": [
            "removed",
            "orphan",
            "none"
          ]
        },
        "visible_events": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/visible_event"
          }
        },
        "observation": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/observation"
          }
        },
        "workspace_before": {
          "$ref": "#/$defs/workspace_state"
        },
        "workspace_after": {
          "$ref": "#/$defs/workspace_state"
        },
        "cancellation": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "triggered",
            "target",
            "sentinel_survived"
          ],
          "properties": {
            "triggered": {
              "type": "boolean"
            },
            "target": {
              "enum": [
                "child_only",
                "none"
              ]
            },
            "sentinel_survived": {
              "type": "boolean"
            }
          }
        },
        "duration_ms": {
          "type": "integer",
          "minimum": 0
        }
      },
      "patternProperties": {
        "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie)$": false
      }
    },
    "visible_event": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "index",
        "kind",
        "detail"
      ],
      "properties": {
        "index": {
          "type": "integer",
          "minimum": 0
        },
        "kind": {
          "enum": [
            "system_init",
            "assistant_text",
            "tool_use",
            "tool_result",
            "partial",
            "terminal_success",
            "terminal_error",
            "terminal_cancelled"
          ]
        },
        "detail": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        }
      }
    },
    "observation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "request_id",
        "stage",
        "outcome"
      ],
      "properties": {
        "request_id": {
          "type": "string",
          "pattern": "^rid-[0-9a-f]{8,32}$"
        },
        "stage": {
          "enum": [
            "selector",
            "local",
            "review",
            "cleanup"
          ]
        },
        "outcome": {
          "enum": [
            "observed",
            "failed"
          ]
        }
      }
    },
    "workspace_state": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "artifacts_present",
        "writable",
        "tree_sha256"
      ],
      "properties": {
        "artifacts_present": {
          "type": "boolean"
        },
        "writable": {
          "type": "boolean"
        },
        "tree_sha256": {
          "$ref": "#/$defs/digest"
        }
      }
    },
    "redaction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "patterns",
        "sentinels_seeded",
        "matches"
      ],
      "properties": {
        "patterns": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "sentinels_seeded": {
          "type": "integer",
          "minimum": 0
        },
        "matches": {
          "const": 0
        }
      },
      "patternProperties": {
        "^(prompt|output|token|key|auth|credential|secret|password|api_key|apikey|endpoint|bearer|cookie)$": false
      }
    }
  }
}
