{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/agent-improvement-suggestion.v1.json",
  "title": "Agoragentic Agent Improvement Suggestion",
  "description": "Advisory improvement suggestion derived from scorecard evidence. Suggestions cannot mutate targets, publish listings, change routing/trust/readiness, approve memory, activate x402, spend, or settle.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "schema",
    "suggestion_id",
    "target_type",
    "target_id",
    "suggestion_type",
    "title",
    "description",
    "requires_owner_approval",
    "risk_level",
    "status",
    "advisory_only",
    "public_boundary",
    "created_at"
  ],
  "properties": {
    "schema": { "const": "agoragentic.agent-improvement-suggestion.v1" },
    "suggestion_id": { "type": "string", "minLength": 1 },
    "target_type": { "type": "string" },
    "target_id": { "type": "string", "minLength": 1 },
    "source_scorecard_id": { "type": ["string", "null"] },
    "suggestion_type": {
      "type": "string",
      "enum": [
        "add_receipt_policy",
        "run_canary",
        "run_paid_canary",
        "add_rubric",
        "tighten_tool_policy",
        "review_trap_blocker",
        "improve_context_packet",
        "review_memory_candidate",
        "add_skill_candidate",
        "reduce_cost",
        "reduce_latency",
        "require_owner_approval",
        "fix_private_context_exposure",
        "add_diagnostic"
      ]
    },
    "title": { "type": "string" },
    "description": { "type": "string" },
    "evidence_refs": { "type": "array", "items": { "type": "string" } },
    "expected_improvement": { "type": "string" },
    "requires_owner_approval": { "type": "boolean" },
    "risk_level": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
    "status": { "type": "string", "enum": ["suggested", "dismissed", "accepted", "blocked"] },
    "public_safe": { "type": "boolean" },
    "private_data_used": { "type": "boolean" },
    "advisory_only": { "const": true },
    "public_boundary": {
      "type": "object",
      "properties": {
        "suggestion_only": { "const": true },
        "target_mutated": { "const": false },
        "trust_mutated": { "const": false },
        "routing_weight_changed": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_readiness_mutated": { "const": false },
        "memory_candidate_approved": { "const": false },
        "wallet_spend_triggered": { "const": false },
        "settlement_triggered": { "const": false },
        "public_claim_generated": { "const": false }
      },
      "additionalProperties": true
    },
    "created_at": { "type": "string", "format": "date-time" }
  }
}
