{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mnemom-ai/json-schema/mnemom-ai-reputation-score-schema.json",
  "title": "ReputationScore",
  "description": "Agent reputation row computed by the reputation worker's 6-hour cron. Grade alphabet: `AAA AA+ AA A+ A B+ B C+ C D NR` (NR = not-rated, insufficient data). Score is an integer 0–1000.",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mnemom-ai-openapi.json#/components/schemas/ReputationScore",
  "type": "object",
  "required": [
    "agent_id",
    "score",
    "grade",
    "is_eligible",
    "checkpoint_count",
    "confidence",
    "components",
    "visibility"
  ],
  "properties": {
    "agent_id": {
      "type": "string"
    },
    "score": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 1000
    },
    "grade": {
      "type": [
        "string",
        "null"
      ],
      "description": "AAA–D or NR."
    },
    "tier": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_eligible": {
      "type": "boolean"
    },
    "checkpoint_count": {
      "type": "integer"
    },
    "checkpoint_accounting": {
      "type": [
        "object",
        "null"
      ],
      "description": "Structured breakdown of how checkpoints were counted toward the score. `analyzed` is the scoring population; `excluded` buckets are mutually exclusive and `analyzed + synthetic + insufficient_thinking + quarantined + analysis_failed + integrity_off = total` (`analysis_failed` is absent, i.e. 0, on scores computed before MNE-9696; `integrity_off` is absent, i.e. 0, on scores computed before MNE-9763, and on those scores integrity-off turns are counted in `insufficient_thinking`). Null for legacy rows computed before this field existed.",
      "required": [
        "total",
        "analyzed",
        "excluded"
      ],
      "properties": {
        "total": {
          "type": "integer",
          "description": "All checkpoints recorded for the agent."
        },
        "analyzed": {
          "type": "integer",
          "description": "Checkpoints that counted toward the score (drives the X/50 eligibility gauge)."
        },
        "excluded": {
          "type": "object",
          "required": [
            "synthetic",
            "insufficient_thinking",
            "quarantined"
          ],
          "properties": {
            "synthetic": {
              "type": "integer",
              "description": "Synthetic (`ic-synthetic-*`) checkpoints."
            },
            "insufficient_thinking": {
              "type": "integer",
              "description": "Zero-analysis checkpoints (no extraction confidence, thinking tokens, or analysis duration) that were attempted: not integrity-off turns, which are counted in `integrity_off`."
            },
            "quarantined": {
              "type": "integer",
              "description": "Checkpoints referenced by a non-expired enforce advisory; excluded from scoring entirely."
            },
            "analysis_failed": {
              "type": "integer",
              "description": "Checkpoints whose integrity analysis was attempted but failed (verdict `unverified`: parse error, timeout, analyser unavailable) and that are not already counted in `insufficient_thinking`. Shown as not checked; never evidence, never toward the 50-checkpoint gate."
            },
            "integrity_off": {
              "type": "integer",
              "description": "Checkpoints written while integrity analysis was off for the agent (verdict `unanalyzed`). No analysis was attempted, so they are neither a failure nor insufficient thinking. Never evidence, never toward the 50-checkpoint gate. Absent (treat as 0) on scores computed before MNE-9763."
            }
          }
        },
        "re_evaluated": {
          "type": "object",
          "description": "How many of the agent's checkpoints carry each kind of re-evaluation annotation (counted over `total`, not the analyzed subset). Observability only — these are not an exclusion bucket and do not enter the score arithmetic. Absent on scores computed before this breakdown existed.",
          "required": [
            "corrected_clear",
            "corrected_non_clear",
            "resolved_no_correction"
          ],
          "properties": {
            "corrected_clear": {
              "type": "integer",
              "description": "Checkpoints explicitly corrected to `clear` (`re_evaluation_metadata.corrected_verdict = 'clear'`)."
            },
            "corrected_non_clear": {
              "type": "integer",
              "description": "Checkpoints corrected to a NON-clear verdict — a cross-turn escalation or a reviewer reclassification to `review_needed`/`boundary_violation`. These count against the score per the correction, not as exonerations; a non-zero value is why this agent's score differs from the pre-MNE-2156 calculation."
            },
            "resolved_no_correction": {
              "type": "integer",
              "description": "Checkpoints re-evaluated with NO recorded correction — the trust-recovery convention, scored as `clear`."
            }
          }
        }
      }
    },
    "confidence": {
      "type": "string",
      "enum": [
        "insufficient",
        "low",
        "medium",
        "high"
      ]
    },
    "components": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "key",
          "score",
          "weight",
          "weighted_score"
        ],
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "integrity_ratio",
              "compliance",
              "drift_stability",
              "trace_completeness",
              "coherence_compatibility"
            ]
          },
          "label": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "weight": {
            "type": "number"
          },
          "weighted_score": {
            "type": "number"
          },
          "factors": {
            "type": "array"
          }
        }
      }
    },
    "computed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "next_compute_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Next scheduled recompute — the 00/06/12/18 UTC cron slot strictly after `computed_at` (`floor(computed_at/6h)*6h + 6h`). Null when `computed_at` is null."
    },
    "trend_30d": {
      "type": [
        "number",
        "null"
      ]
    },
    "visibility": {
      "type": "string",
      "enum": [
        "public",
        "private"
      ],
      "description": "Reputation-publication axis — whether this agent's Trust Rating is published. Every registered agent's reputation is `public` by accountability standard (the default; that is the whole point of a portable, verifiable rating); `private` is a rare owner opt-out that 403s the read to non-owners. This is DISTINCT from `Agent.public` (the identity-record visibility axis) — they share the word \"public\" but govern different things."
    },
    "claimed": {
      "type": "boolean"
    },
    "agent_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "a2a_trust_extension": {
      "type": "object",
      "description": "A2A trust extension for interop. Only present on `GET /reputation/{agent_id}` (not on batch/compare rows).",
      "properties": {
        "extension_uri": {
          "type": "string"
        },
        "provider": {
          "type": "string"
        },
        "score": {
          "type": "number"
        },
        "grade": {
          "type": "string"
        },
        "confidence": {
          "type": "string"
        },
        "verified_url": {
          "type": "string",
          "format": "uri"
        },
        "badge_url": {
          "type": "string",
          "format": "uri"
        },
        "methodology_url": {
          "type": "string",
          "format": "uri"
        },
        "last_updated": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}