{
  "metadata": {
    "name": "rxguard_commons",
    "version": "1.0.0",
    "profile": "worldwide-agentic-web-mvp-0.3",
    "description": "Four-agent Open Agentic Web medication safety desk: checks drug-drug interactions, live U.S. FDA enforcement recalls & boxed warnings, absorption-safe schedules, and consent-gated peer composition with deny-by-default sly_data patient privacy.",
    "sample_queries": [
      "Audit my active cabinet for major drug interactions and dosing conflicts.",
      "Check live FDA recalls and boxed warnings for Warfarin and Ibuprofen.",
      "Create a daily schedule separating Levothyroxine and Calcium Carbonate.",
      "Verify baby gear recalls via peer site Recalled? after asking my permission."
    ]
  },
  "llm_config": {
    "model_name": "openai/gpt-4o-mini",
    "temperature": 0.1
  },
  "max_steps": 12,
  "execution_limits": {
    "max_depth": 4,
    "max_invocations": 12,
    "max_remote_calls": 4,
    "timeout_ms": 25000
  },
  "sly_data_policy": {
    "default": "deny",
    "allowed_internal_fields": [
      "patient_age_group",
      "pregnancy_status",
      "recorded_allergies",
      "renal_impairment_flag"
    ],
    "allowed_cross_origin_fields": [],
    "note": "Patient health profile fields in sly_data stay strictly inside the visitor's browser and are never transmitted to peer sites, external APIs, or unredacted traces."
  },
  "link_labels": {
    "https://chen931222.github.io/recalled/recall_check": "Recalled? (CPSC & Health Canada Recall Desk)",
    "https://sainath998.github.io/plainly-agent/plainly_document_helper": "Plainly (Plain-Language Document Explainer)",
    "https://montbaga.github.io/agent-customs/agent_customs": "Agent Customs (Peer Agent Safety Inspector)"
  },
  "commondefs": {
    "replacement_strings": {
      "site_name": "RxGuard Commons",
      "safety_rules": "You provide grounded medication safety evidence, U.S. FDA citations, and scheduling guidance ONLY. You are NOT a licensed clinician and MUST NEVER prescribe, stop, or diagnose medical conditions. Always advise verifying changes with a pharmacist or physician. Never claim a drug or product is '100% safe' — report only verified matches or 'no matching alert found in checked databases'.",
      "privacy_rules": "Personal health data (patient name, DOB, allergies, pregnancy status, notes) resides in private sly_data and MUST NEVER be copied into outbound peer requests, URLs, or external API queries. Send only generic drug names or non-identifying questions across site boundaries."
    }
  },
  "tools": [
    {
      "name": "triage_coordinator",
      "function": {
        "description": "Front agent for RxGuard Commons. Routes patient, caregiver, and peer-agent requests across interaction auditing, live FDA recall checking, dosing schedule planning, and consent-gated peer agent networks.",
        "parameters": {
          "type": "object",
          "properties": {
            "request": {
              "type": "string",
              "description": "Plain-language medication safety, recall, scheduling, or peer-delegation request."
            }
          },
          "required": [
            "request"
          ]
        }
      },
      "instructions": "You are the front agent (triage_coordinator) for {site_name}. {safety_rules} {privacy_rules} Delegate clinical interaction checks to interaction_auditor, live U.S. FDA recalls and label warnings to recall_watchdog, and daily timing schedules or signed safety cards to care_plan_writer. For non-drug household/baby product recalls, delegate to https://chen931222.github.io/recalled/recall_check after visitor consent. For explaining complex medical bills or lab letters in plain English, delegate to https://sainath998.github.io/plainly-agent/plainly_document_helper after visitor consent. To audit an unfamiliar peer agent before trusting it, delegate to https://montbaga.github.io/agent-customs/agent_customs.",
      "allow": {
        "to_downstream": {
          "sly_data": [
            "patient_age_group",
            "pregnancy_status",
            "recorded_allergies",
            "renal_impairment_flag"
          ]
        }
      },
      "tools": [
        "interaction_auditor",
        "recall_watchdog",
        "care_plan_writer",
        "https://chen931222.github.io/recalled/recall_check",
        "https://sainath998.github.io/plainly-agent/plainly_document_helper",
        "https://montbaga.github.io/agent-customs/agent_customs"
      ]
    },
    {
      "name": "interaction_auditor",
      "function": {
        "description": "Analyzes a list of medications for contraindicated, major, and moderate drug-drug interactions, duplicate therapeutic classes, and patient allergy/pregnancy alerts using deterministic clinical rules and NIH RxNorm normalization.",
        "parameters": {
          "type": "object",
          "properties": {
            "medications": {
              "type": "array",
              "items": { "type": "string" },
              "description": "Generic or brand medication names to audit."
            }
          },
          "required": [
            "medications"
          ]
        }
      },
      "instructions": "You are interaction_auditor inside {site_name}. {safety_rules} Call website_check_drug_interactions and website_get_cabinet_state to gather deterministic clinical interaction evidence. Summarize severity (CONTRAINDICATED, MAJOR, MODERATE), mechanism, and actionable pharmacist questions with exact citations.",
      "tools": [
        "website_get_cabinet_state",
        "website_check_drug_interactions"
      ]
    },
    {
      "name": "recall_watchdog",
      "function": {
        "description": "Queries live U.S. FDA openFDA Drug Enforcement Recalls (Class I/II/III) and official FDA Drug Labeling (Boxed Warnings, Contraindications, Warnings) directly in the browser.",
        "parameters": {
          "type": "object",
          "properties": {
            "drug_name": {
              "type": "string",
              "description": "Generic or brand drug name to check against openFDA."
            }
          },
          "required": [
            "drug_name"
          ]
        }
      },
      "instructions": "You are recall_watchdog inside {site_name}. {safety_rules} Call website_check_fda_recalls and website_get_drug_safety_summary. Cite exact FDA recall numbers, classification (Class I/II/III), recalling firm, report date, and verbatim boxed warning excerpts. Never fabricate recall statuses.",
      "tools": [
        "website_check_fda_recalls",
        "website_get_drug_safety_summary"
      ]
    },
    {
      "name": "care_plan_writer",
      "function": {
        "description": "Builds an absorption-safe daily dosing schedule (Morning, Noon, Evening, Bedtime), updates the local medication cabinet, and exports cryptographically signed Medication Safety Cards after explicit visitor confirmation.",
        "parameters": {
          "type": "object",
          "properties": {
            "medications": {
              "type": "array",
              "items": { "type": "string" },
              "description": "List of medications to schedule."
            }
          },
          "required": [
            "medications"
          ]
        }
      },
      "instructions": "You are care_plan_writer inside {site_name}. {safety_rules} Use website_build_dosing_schedule to separate known timing/absorption conflicts (such as Levothyroxine vs Calcium or Iron by 4 hours). Only call irreversible actions (website_export_signed_safety_card or website_clear_medication_cabinet) when explicitly requested; the browser runtime owns confirmation.",
      "tools": [
        "website_build_dosing_schedule",
        "website_add_medication_to_cabinet",
        "website_export_signed_safety_card",
        "website_clear_medication_cabinet"
      ]
    }
  ]
}
