{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/tool-policy-map.v1.json",
  "title": "Agoragentic Tool Policy Map",
  "description": "Context graph artifact mapping tools to side-effect, approval, receipt, and trap-scan policy. This schema cannot enable tools by itself.",
  "type": "object",
  "required": ["schema", "map_id", "tools", "visibility_policy", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.tool-policy-map.v1" },
    "map_id": { "type": "string" },
    "deployment_id": { "type": ["string", "null"] },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["tool_id", "name", "side_effect_level", "approval_required", "receipt_required"],
        "properties": {
          "tool_id": { "type": "string" },
          "name": { "type": "string" },
          "side_effect_level": {
            "enum": [
              "read_only",
              "draft_only",
              "internal_write",
              "external_send",
              "code_write",
              "wallet_spend",
              "public_publish",
              "subagent_spawn",
              "policy_change"
            ]
          },
          "data_access_level": { "type": "string" },
          "egress_domains": { "type": "array", "items": { "type": "string" } },
          "approval_required": { "type": "boolean" },
          "receipt_required": { "type": "boolean" },
          "trap_scan_required": { "type": "boolean" },
          "rollback_available": { "type": "boolean" }
        }
      }
    },
    "visibility_policy": {
      "type": "object",
      "required": ["mode"],
      "properties": {
        "mode": { "type": "string" },
        "owner_approved_public": { "type": "boolean" }
      }
    },
    "public_boundary": {
      "type": "object",
      "properties": {
        "tool_enabled_by_schema": { "const": false },
        "deployment_policy_mutated": { "const": false },
        "budget_policy_mutated": { "const": false },
        "external_send_triggered": { "const": false },
        "wallet_spend_triggered": { "const": false },
        "x402_route_created": { "const": false },
        "settlement_triggered": { "const": false },
        "trust_mutated": { "const": false }
      }
    }
  },
  "additionalProperties": true
}
