{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/agent-run-summary.v1.json",
  "title": "Agoragentic Agent Run Summary",
  "description": "Receipt-linked run summary for Agent OS Memory Mesh extraction. This schema is a learning input and does not promote memory, publish listings, activate x402, settle funds, or capture raw private payloads.",
  "type": "object",
  "additionalProperties": true,
  "required": ["schema", "run_id", "outcome", "receipts", "learning_inputs", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.agent-run-summary.v1" },
    "summary_id": { "type": "string" },
    "run_id": { "type": "string" },
    "deployment_id": { "type": ["string", "null"] },
    "workspace_id": { "type": ["string", "null"] },
    "owner_id": { "type": ["string", "null"] },
    "goal": { "type": "string" },
    "outcome": {
      "type": "string",
      "enum": ["success", "failure", "blocked", "partial", "review_required", "cancelled", "unknown"]
    },
    "receipts": {
      "type": "array",
      "items": { "type": "string" }
    },
    "tools_used": { "type": "array" },
    "policy_decisions": { "type": "array" },
    "approvals": { "type": "array" },
    "trap_scan_summary": { "type": ["object", "null"] },
    "failures": { "type": "array" },
    "cost": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "estimated_usdc": { "type": ["string", "null"] },
        "actual_usdc": { "type": ["string", "null"] },
        "currency": { "type": "string" }
      }
    },
    "latency": {
      "type": "object",
      "additionalProperties": true
    },
    "artifacts": { "type": "array" },
    "public_safe": { "type": "boolean" },
    "private_context_used": { "type": "boolean" },
    "private_context_excluded": { "type": "boolean" },
    "next_actions": { "type": "array" },
    "learning_inputs": {
      "type": "object",
      "required": ["can_extract_memory_candidates", "can_extract_skill_candidates", "receipt_backed"],
      "properties": {
        "can_extract_memory_candidates": { "type": "boolean" },
        "can_extract_skill_candidates": { "type": "boolean" },
        "failure_memory_allowed": { "type": "boolean" },
        "receipt_backed": { "type": "boolean" }
      },
      "additionalProperties": true
    },
    "public_boundary": {
      "type": "object",
      "required": [
        "run_summary_only",
        "raw_prompt_captured",
        "raw_tool_output_captured",
        "raw_private_ecf_payload_captured",
        "memory_promoted",
        "router_trust_mutated",
        "marketplace_publication_triggered",
        "x402_route_created",
        "settlement_triggered",
        "wallet_spend_triggered"
      ],
      "properties": {
        "run_summary_only": { "const": true },
        "raw_prompt_captured": { "const": false },
        "raw_tool_output_captured": { "const": false },
        "raw_private_ecf_payload_captured": { "const": false },
        "memory_promoted": { "const": false },
        "router_trust_mutated": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_route_created": { "const": false },
        "settlement_triggered": { "const": false },
        "wallet_spend_triggered": { "const": false }
      },
      "additionalProperties": true
    },
    "created_at": { "type": "string", "format": "date-time" }
  }
}
