{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/agent-memory-candidate.v1.json",
  "title": "Agoragentic Agent Memory Candidate",
  "description": "Policy-scoped, receipt-backed memory candidate for Agent OS Memory Mesh. This schema does not approve, inject, globally propagate, mutate Router trust, publish listings, activate x402, or expose private ECF context.",
  "type": "object",
  "additionalProperties": true,
  "required": ["schema", "candidate_id", "source_refs", "candidate_type", "proposed_scope", "status", "policy", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.agent-memory-candidate.v1" },
    "candidate_id": { "type": "string" },
    "deployment_id": { "type": ["string", "null"] },
    "workspace_id": { "type": ["string", "null"] },
    "source_type": { "type": "string" },
    "source_refs": {
      "type": "array",
      "items": { "type": "string" }
    },
    "outcome": {
      "type": "string",
      "enum": ["success", "failure", "blocked", "partial", "review_required", "cancelled", "unknown"]
    },
    "candidate_type": {
      "type": "string",
      "enum": [
        "reasoning_memory",
        "provider_trust_memory",
        "listing_memory",
        "pricing_memory",
        "failure_memory",
        "x402_canary_memory",
        "codebase_procedure_memory",
        "owner_preference_memory",
        "skill_candidate",
        "rubric_candidate"
      ]
    },
    "title": { "type": "string" },
    "description": { "type": "string" },
    "content": { "type": "string" },
    "proposed_scope": {
      "type": "string",
      "enum": [
        "private_owner_only",
        "deployment_only",
        "workspace_only",
        "team",
        "organization",
        "marketplace_public",
        "enterprise_tenant"
      ]
    },
    "public_safe": { "type": "boolean" },
    "requires_owner_approval": { "type": "boolean" },
    "can_influence_router": { "type": "boolean" },
    "owner_approved": { "type": "boolean" },
    "status": {
      "type": "string",
      "enum": [
        "extracted",
        "pending_policy_review",
        "pending_owner_review",
        "approved",
        "rejected",
        "merged",
        "expired",
        "rolled_back",
        "blocked_by_policy"
      ]
    },
    "policy": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "public_safe": { "type": "boolean" },
        "requires_owner_approval": { "type": "boolean" },
        "can_influence_router": { "type": "boolean" },
        "private_ecf_context": { "type": "boolean" }
      }
    },
    "failure_classification": {
      "type": ["object", "null"],
      "additionalProperties": true
    },
    "receipt_backed": { "type": "boolean" },
    "missing_requirements": { "type": "array", "items": { "type": "string" } },
    "blockers": { "type": "array", "items": { "type": "string" } },
    "warnings": { "type": "array", "items": { "type": "string" } },
    "approved_by": { "type": ["string", "null"] },
    "approval_id": { "type": ["string", "null"] },
    "rejection_reason": { "type": ["string", "null"] },
    "rollback_ref": { "type": ["string", "null"] },
    "rollback_reason": { "type": ["string", "null"] },
    "reviewed_by": { "type": ["string", "null"] },
    "reviewed_at": { "type": "string" },
    "public_boundary": {
      "type": "object",
      "required": [
        "memory_artifact_only",
        "global_memory_enabled",
        "raw_private_ecf_context_captured",
        "raw_private_tool_output_captured",
        "raw_secret_captured",
        "router_trust_mutated",
        "marketplace_publication_triggered",
        "x402_route_created",
        "settlement_triggered",
        "wallet_spend_triggered"
      ],
      "properties": {
        "memory_artifact_only": { "const": true },
        "global_memory_enabled": { "const": false },
        "raw_private_ecf_context_captured": { "const": false },
        "raw_private_tool_output_captured": { "const": false },
        "raw_secret_captured": { "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" }
  }
}
