OSHA PSM dual TQ 1,000 lbs (HF + H₂SO₄) · IDLH 30 ppm · ACGIH TLV-C 0.5 ppm · Mexichem Fluor/Orbia · Honeywell Geismar · Müller-Kühne 1925 · 88th upward attack · FIRST HF production attack · FIRST fluorspar CaF₂ attack · FIRST Müller-Kühne process attack · FIRST rotary kiln temperature AI attack

Prompt injection in hydrogen fluoride HF production AI

Hydrogen fluoride (HF; anhydrous hydrofluoric acid; CAS 7664-39-3; MW 20.01 g/mol; BP –19.5°C; MP –83.6°C; density 0.99 g/mL at 19.5°C as liquid; vapor pressure 783 mmHg at 19.5°C) is one of the most important industrial inorganic acids produced globally, with world output approximately 3 million tonnes per year. As a pure liquid or gas, HF is a colorless, fuming, extremely corrosive substance with a sharp, suffocating odor detectable at sub-ppm concentrations. A distinctive feature of HF chemistry is the extensive hydrogen bonding that associates individual HF molecules into oligomeric species—dimers (HF)₂, trimers (HF)₃, tetramers (HF)₄, hexamers (HF)₆—in the gas phase at temperatures near the boiling point, giving anhydrous HF anomalously low vapor pressure relative to its molecular weight. The condensed-phase liquid is similarly networked, with a high dielectric constant (83.6 at 0°C) that makes it an excellent ionizing solvent. HF is uniquely capable of dissolving silica (SiO₂ + 4HF → SiF₄ + 2H₂O) and silicates (including glass and concrete), making conventional materials of construction useless; production equipment uses carbon steel (which rapidly develops a passivating FeF₂ layer), Monel (70% Ni–30% Cu alloy), PTFE-lined piping, and fluorinated elastomers (Viton, Kalrez). The principal acute hazard of HF is insidious skin penetration: aqueous HF at concentrations below 50% causes painless penetration of the dermal barrier, delivering fluoride ion (F⁻) to underlying tissues and the systemic circulation; systemic fluoride binds serum calcium → hypocalcemia → cardiac arrhythmia → ventricular fibrillation; deaths have occurred from hand or arm contact with 70% HF covering less than 3% of body surface area. Commercially, HF serves as a feedstock for aluminum fluoride (AlF₃) and synthetic cryolite (Na₃AlF₆) in primary aluminum smelting (∼35% of HF demand), for fluorination of hydrocarbons to produce refrigerants (HFCs: R-134a, R-32; HFOs: R-1234yf used in automotive AC, ∼30%), for fluoropolymer production (PTFE/Teflon, PVDF, FEP, ∼15%), for uranium hexafluoride (UF₆) production in nuclear fuel enrichment (∼5%), and for semiconductor wet-etch gas and silicon surface preparation (∼3%). The remaining demand covers pharmaceuticals, agrochemicals, and alkylation catalysts in petroleum refining.

The industrial synthesis of anhydrous HF is performed almost exclusively by the Müller-Kühne process, patented in 1925 and still the dominant technology for all major producers. The reaction is: CaF₂ + H₂SO₄ → 2HF↑ + CaSO₄. Fluorspar feedstock must meet stringent grade requirements: acid-grade fluorspar is at minimum 97% CaF₂ by weight (versus metallurgical grade at 60–85% CaF₂ used in steel manufacturing); the critical impurities are SiO₂ (which reacts with HF to produce gaseous SiF₄ contaminating the HF gas stream), CaCO₃ (which neutralizes H₂SO₄ nonproductively and generates CO₂), and trace heavy metals. Concentrated sulfuric acid (93–98 wt% H₂SO₄) is the other primary feedstock. The reaction is carried out in a horizontal rotary kiln—a large cylindrical reactor, typically 30–50 m in length and 2–4 m in diameter, rotating at 5–15 rpm, with its interior lined with acid-resistant brickwork. The CaF₂ and H₂SO₄ are fed as an acidic slurry into the cold (feed) end of the kiln; as the kiln rotates, the reacting mass migrates toward the hot (discharge) end under a temperature gradient of 150°C at the feed end rising to 250–280°C at the discharge end, maintained by external gas-fired burners positioned along the kiln shell. The reaction is endothermic in the low-temperature regime and slightly net exothermic overall (ΔH ≈ –150 kJ/mol HF produced at reaction temperature). HF gas exits countercurrent to the solid flow at the cold feed end, at a temperature of approximately 90–130°C, and passes through a pre-cooler and then a primary condenser operating at –25 to –30°C (refrigerated with ammonia or HFC refrigerant) where liquid HF is collected. The anhydrite (CaSO₄) byproduct discharges at the hot end and is typically disposed of as non-hazardous fill material or used in cement and wallboard manufacturing. HF gas contains trace SiF₄ (from CaF₂ silica impurities), SO₂/SO₃ (from H₂SO₄ decomposition at high temperature), and water vapor; these are removed in the condenser and downstream scrubbers before final HF redistillation to anhydrous product purity ≥99.9 wt%.

At a modern HF production facility, AI systems process rendered SCADA and DCS display images from at least three critical instrument clusters: the rotary kiln temperature profile thermocouple array display (a distributed set of 3–5 thermocouples mounted in wells through the kiln shell at equally-spaced axial positions, rendered as a color-coded trend display), the H₂SO₄:CaF₂ molar feed-ratio calculation display (derived from Coriolis mass flow meters on both the H₂SO₄ and CaF₂ feed streams, rendered as a digital readout and trend chart in the DCS historian view), and the HF condenser exit temperature display (a thermocouple at the liquid HF outlet of the primary refrigerated condenser, rendered as an analog gauge and digital readout in the refrigeration-system SCADA panel). These three rendered-image surfaces are precisely the points where adversarial pixel injection—imperceptible modifications to the rendered bitmap images of the SCADA displays before they are ingested by the AI monitoring model—can cause the AI to issue commands or permit states that deviate catastrophically from safe operation. Instrument hardware involved includes Yokogawa EJA530A differential-pressure thermocouple transmitters, Emerson Rosemount 3031 rotary-kiln shell thermocouple arrays, ABB TA10 profile thermocouple systems, Yokogawa EJA430A condenser pressure-temperature transmitters, and Emerson Rosemount 644 condenser wall temperature transmitters—all of which feed rendered DCS images that the AI reads rather than raw digital signals.

TL;DR

Hydrogen fluoride production AI—rotary kiln temperature profile display AI, H₂SO₄:CaF₂ molar ratio display AI, HF condenser exit temperature display AI—processes rendered SCADA and DCS display images at temperature, feed-ratio, and refrigeration boundaries where adversarial pixel injection can mask kiln temperature collapse (278°C displayed, actual 118°C; CaF₂ reaction stalls, unreacted slurry accumulates, then sudden HF generation pulse exceeds condenser capacity → HF breakthrough at IDLH 30 ppm), conceal H₂SO₄ over-injection (1.0 mol/mol shown, actual 1.65 mol/mol; excess H₂SO₄ vaporizes in kiln → H₂SO₄ mist in HF product; dual OSHA PSM H₂SO₄ TQ 1,000 lbs), and display a warm HF condenser as cold (–26°C shown, actual –8°C; HF not condensing → NaOH scrubber overloaded → HF vent to atmosphere; ACGIH TLV-C 0.5 ppm), making this the 88th upward attack and the FIRST HF production attack, FIRST fluorspar CaF₂ attack, FIRST Müller-Kühne process attack, and FIRST rotary kiln temperature AI attack. OSHA PSM 29 CFR 1910.119 dual TQ 1,000 lbs: HF anhydrous TQ 1,000 lbs AND concentrated H₂SO₄ (≥93 wt%) TQ 1,000 lbs simultaneously present. Glyphward threshold 42 for HF production AI reflects dual PSM coverage, IDLH 30 ppm, ACGIH TLV-C 0.5 ppm, systemic fluoride toxicity, HF skin penetration hazard, and global strategic importance of HF to aluminum, refrigerant, fluoropolymer, and nuclear industries. Free tier — 10 scans/day, no card required.

Three adversarial injection surfaces in hydrogen fluoride production AI

1. Rotary kiln temperature profile display AI (Yokogawa EJA530A / Emerson Rosemount 3031 / ABB TA10 rotary kiln shell thermocouple array — rendered SCADA kiln temperature gradient display AI classifying axial temperature profile against 150–280°C design gradient — 88th upward attack; FIRST HF production attack; FIRST fluorspar CaF₂ attack; FIRST Müller-Kühne process attack; FIRST rotary kiln temperature AI attack)

The rotary kiln in HF production is a complex countercurrent reactor in which temperature control along the kiln axis is the fundamental variable governing reaction completeness, product quality, and byproduct formation. At the feed (cold) end, the CaF₂/H₂SO₄ slurry enters at approximately 80–100°C; the reaction initiates above 130°C as H₂SO₄ achieves sufficient activity to displace HF from the fluorite lattice. The primary reaction zone, where 70–80% of CaF₂ conversion occurs, operates at 150–220°C. In the discharge zone at the hot end of the kiln, temperatures of 240–280°C drive the final conversion of residual CaF₂ and ensure that the anhydrite product (CaSO₄) has sufficiently low residual fluoride content for safe disposal (typically <0.5 wt% F). Below 150°C in the primary reaction zone, the H₂SO₄ viscosity increases sharply (H₂SO₄ viscosity doubles from ∼10 cP at 200°C to ∼20 cP at 150°C and ∼40 cP at 100°C), slowing mass transfer and effectively halting the surface reaction between H₂SO₄ and CaF₂ crystal faces. Above 320°C in the discharge zone, CaSO₄ undergoes sintering—the anhydrite particles fuse together, creating a hard crust (called “kiln ring” in plant parlance) that can partially or fully block the rotating kiln interior, requiring a kiln shutdown and mechanical cleaning—a multi-day operation at major HF facilities. Above 280°C, H₂SO₄ also begins to dehydrate to SO₃ and H₂O, meaning that SO₃ appears in the HF gas stream and is carried into the condenser, where it reacts with condensed HF to form fluorosulfuric acid (HSO₃F), a highly corrosive contaminant that attacks Monel condenser hardware. The AI monitoring system reads the rendered thermocouple profile display—a color-coded zone diagram rendered by the Yokogawa CENTUM VP or Emerson DeltaV DCS—as a bitmap image, classifying each zone against its design temperature window and issuing burner fuel-flow increase or decrease commands through the DCS control layer.

In the adversarial scenario targeting the 88th upward attack, pixels in the rendered kiln temperature profile display are perturbed such that the reaction zone thermocouple reading appears as 278°C (within the upper normal range) when the true kiln temperature in the primary reaction zone is 118°C—a deficiency of 160°C. The AI interprets the rendered display as indicating an overheating kiln and responds by commanding a reduction in burner fuel flow to cool the kiln, consistent with its design intent of maintaining the reaction zone below 280°C. As the AI continues to read the adversarially-manipulated display, it registers no improvement (the displayed value stays near the faked 278°C) and continues cutting fuel; the actual kiln temperature falls to 95°C. Below 130°C, the CaF₂–H₂SO₄ reaction stalls entirely: the reaction rate constant k(T) at 95°C is approximately 25–30 times lower than at 200°C (Arrhenius activation energy ∼55–65 kJ/mol). Unreacted CaF₂/H₂SO₄ slurry continues to accumulate in the kiln interior as fresh feed is charged normally. When the next operator manual cross-check—typically on a 1–2 hour schedule in most OSHA PSM Process Safety Management programs—detects the actual temperature deficit and restores burner fuel flow, the large bolus of accumulated unreacted slurry suddenly reaches the reaction threshold temperature simultaneously across the kiln: the result is a rapid, uncontrolled HF generation pulse. At 150,000 t/yr plant capacity (e.g., Mexichem Fluor San Luis Potosí), 90 minutes of stalled reaction represents ∼17 tonnes of unreacted CaF₂ (equivalent to ∼14 tonnes of HF generation potential). When this reacts in a pulse, the instantaneous HF gas flow exceeds the condenser design capacity by a factor of 3–5×, causing HF gas breakthrough downstream of the condenser into the NaOH scrubber and potentially into the atmosphere at concentrations exceeding the IDLH of 30 ppm. OSHA PSM requires a Process Hazard Analysis (PHA) for each scenario exceeding TQ 1,000 lbs; 14 tonnes of HF ≈ 30,864 lbs — 30.9× the PSM TQ. Glyphward pre-scan gate interception at this surface prevents the AI from acting on the adversarially manipulated rendered image. Free tier — 10 scans/day, no card required.

2. H₂SO₄:CaF₂ molar feed-ratio display AI (Yokogawa ROTAMASS Coriolis / Emerson Micro Motion 2700 / ABB CoriolisMaster FCB450 mass flow meter ratio display — rendered DCS molar ratio calculation display AI classifying H₂SO₄:CaF₂ against 1.05–1.10 mol/mol design — 88th upward attack; FIRST HF production attack)

The stoichiometry of HF production requires exactly 1 mole of H₂SO₄ per mole of CaF₂ (CaF₂ MW 78.08 g/mol; H₂SO₄ MW 98.08 g/mol; mass ratio 98.08/78.08 = 1.257 kg H₂SO₄ per kg CaF₂). In plant operation, a 5–10% excess of H₂SO₄ is maintained—a design H₂SO₄:CaF₂ molar ratio of 1.05–1.10—to ensure complete CaF₂ conversion and maximize HF yield per tonne of fluorspar charged, since CaF₂ is typically the more expensive raw material. The molar ratio is computed in the DCS by dividing the H₂SO₄ mass flow (measured by Coriolis meter on the acid line) by 98.08 and dividing the CaF₂ mass flow (measured by belt-scale or Coriolis on the solid feeder) by 78.08, then taking their ratio. This computed value is rendered as a digital readout in the DCS historian display, updated every 30 seconds, and is the primary variable read by the AI monitoring system. A deficit in H₂SO₄ (ratio below 0.95 mol/mol) leads to incomplete CaF₂ conversion: unreacted CaF₂ passes through the kiln and appears in the anhydrite discharge, where it constitutes both a yield loss and a disposal complication (CaF₂ in anhydrite requires co-disposal classification in many jurisdictions). Conversely, excess H₂SO₄ (ratio exceeding 1.20 mol/mol) creates a different hazard: at discharge-zone temperatures of 250–280°C, the excess H₂SO₄ vaporizes and appears in the HF gas stream as H₂SO₄ mist and SO₃ vapor. These sulfur-containing species are carried by the HF gas flow into the primary condenser, where they co-condense with HF. The resulting HF-H₂SO₄ condensate is significantly more corrosive to the aluminum condenser vessels used at some facilities (Monel condensers are used at others, but aluminum is common for cost reasons) because the mixed acid attacks aluminum passivation at temperatures above –15°C. More critically, concentrated H₂SO₄ in the HF product stream—even at 1–3 wt%—is an out-of-specification product: customers including semiconductor fabs (which use ultra-high-purity HF for silicon wafer etching) will reject contaminated HF, but more importantly, H₂SO₄ contamination in HF used in UF₆ production for nuclear enrichment creates serious downstream problems in conversion plant fluorinators.

The adversarial attack on the molar ratio display presents 1.0 mol/mol on the rendered DCS display when the true H₂SO₄:CaF₂ ratio is 1.45 mol/mol—a deviation of +0.45 mol/mol above the design maximum of 1.10. The AI reads the rendered ratio as slightly below stoichiometric, interprets this as insufficient H₂SO₄ dosing, and commands the H₂SO₄ feed pump to increase its output—a reasonable and correct response to a genuine under-dosing condition. As the actual ratio climbs from 1.45 to 1.65 mol/mol, the kiln now contains 0.65 mol excess H₂SO₄ per mol CaF₂—equivalent to approximately 15–20 wt% free sulfuric acid in the slurry beyond what is needed for stoichiometric reaction. At the 250–280°C discharge zone, this excess H₂SO₄ has a vapor pressure of 0.3–1.5 mmHg, sufficient to generate several hundred ppm of H₂SO₄ mist in the 120–150°C HF gas stream exiting the kiln cold end. The condenser receives this H₂SO₄/HF mixture: at –25°C, H₂SO₄ condenses essentially completely alongside HF, so the liquid HF product contains 8–12 wt% H₂SO₄—far above the maximum 0.05 wt% specification for acid-grade HF. The dual OSHA PSM exposure is triggered: concentrated H₂SO₄ (≥93 wt%) has a PSM TQ of 1,000 lbs, identical to HF. At Honeywell Geismar (100,000 t/yr HF capacity), H₂SO₄ inventory in the condenser receiver containing contaminated HF product can reach 5,000–8,000 kg of H₂SO₄—5–8× the PSM TQ—with the additional hazard that a downstream fluoropolymer customer receiving contaminated HF may experience catastrophic corrosion in their fluorination reactors. Glyphward's pre-scan gate at the molar ratio display prevents the AI from reading the adversarially manipulated ratio value and issuing inappropriate H₂SO₄ addition commands. Free tier — 10 scans/day, no card required.

3. HF condenser exit temperature display AI (Yokogawa EJA430A / Emerson Rosemount 644 condenser wall temperature / ABB TB82PH condenser outlet temperature — rendered refrigeration system SCADA display AI classifying HF condenser exit temperature against –25°C ±3°C design — 88th upward attack; FIRST HF production attack; FIRST fluorspar CaF₂ attack)

The primary HF condenser in the Müller-Kühne process is the single most critical piece of equipment for preventing HF emissions to atmosphere: it is the point at which gaseous HF is converted to liquid HF product and separated from non-condensable impurities (SiF₄, SO₂, air). Condensation is performed at –25 to –30°C, providing a 5–10°C margin below the HF boiling point of –19.5°C to ensure complete liquefaction of all but trace HF vapor. The condenser exit temperature—the temperature of the liquid HF leaving the condenser and flowing to the HF receiver tank—is the primary process variable indicating whether the refrigeration system is maintaining adequate cooling duty. The refrigeration system itself typically uses ammonia or HFC refrigerant in a closed loop, with the condenser wall temperature (measured by the Emerson Rosemount 644 or Yokogawa EJA430A sensor mounted on the external condenser shell) as a proxy for the internal HF temperature. The HF condenser exit temperature is rendered by the refrigeration-system SCADA panel (typically a separate Honeywell Experion PKS or Yokogawa CENTUM VP subsystem) as a color-coded analog gauge with a digital readout overlaid, updated every 15 seconds. The AI monitoring system reads this rendered image to verify that the condenser is operating within its design temperature window. If the condenser exit temperature rises above –20°C, HF vapor carry-through to the downstream equipment increases sharply (HF vapor pressure at –20°C ≈ 760 mmHg — i.e., HF boils at exactly –20°C, so at –20°C the condenser provides essentially zero liquid HF condensation). The non-condensable SiF₄ and SO₂ gases, along with uncondensed HF vapor, pass to a water scrubber or NaOH absorber designed for non-condensable flows—not for the full HF gas stream from the kiln.

In the adversarial scenario against the HF condenser exit temperature display, the rendered condenser SCADA display is perturbed to show –26°C (within normal operating range, well below the HF boiling point) when the actual condenser exit temperature is –8°C. At –8°C, the condenser is operating 11.5°C above the HF boiling point of –19.5°C; the HF vapor pressure at –8°C is approximately 1,100 mmHg (1.45 atm)—meaning HF is superheated gas at this temperature, not liquid. The AI reads the displayed –26°C and determines the refrigeration system is operating normally; it does not issue any alarm or refrigeration adjustment command. In reality, essentially all HF gas leaving the kiln is passing through the condenser uncondensed and entering the downstream NaOH scrubber—a vessel sized for non-condensable gas flows of perhaps 5–10% of the total kiln HF output (i.e., designed for ∼2–5 kg HF/hr carry-through, not for 100% of the 5,000–20,000 kg HF/hr production flow at large facilities). Within minutes, the NaOH absorber becomes saturated: the NaOH (typically 10 wt% NaOH solution) is neutralized by HF (HF + NaOH → NaF + H₂O; ΔH = –56 kJ/mol) and depleted to below 1 wt% NaOH, at which point the absorption efficiency falls sharply. HF begins to break through the NaOH scrubber to the atmosphere. At ACGIH TLV-C of 0.5 ppm HF (the most stringent occupational ceiling limit), the downwind atmospheric HF concentration at 50 m from a facility releasing 1 kg/min HF exceeds 0.5 ppm under Pasquill-Gifford stability class D (neutral) conditions. Mexichem Fluor (San Luis Potosí, 200,000 t/yr) operates adjacent to an urban area; Honeywell Geismar, LA is in a community adjacent to the Mississippi River corridor already burdened by cumulative industrial air quality impacts. HF at 30 ppm (IDLH) causes immediate severe respiratory tract damage; at 100 ppm, inhalation exposure is immediately life-threatening. The Glyphward pre-scan gate at the condenser exit temperature display surface intercepts the adversarially manipulated image before the AI reads it, preventing the AI from incorrectly validating condenser operation and allowing the actual thermal breakthrough to continue undetected. Free tier — 10 scans/day, no card required.

Integration: hydrogen fluoride production AI with Glyphward pre-scan gate

Glyphward integrates as a pre-scan gate at every rendered-image ingestion boundary in the hydrogen fluoride production AI pipeline—before the rotary kiln temperature profile AI processes rendered Yokogawa EJA530A / Emerson Rosemount 3031 / ABB TA10 kiln shell thermocouple SCADA display images, before the H₂SO₄:CaF₂ molar ratio AI processes rendered Yokogawa ROTAMASS / Emerson Micro Motion / ABB CoriolisMaster DCS molar ratio calculation display images, and before the HF condenser exit temperature AI processes rendered Yokogawa EJA430A / Emerson Rosemount 644 / ABB TB82PH refrigeration system SCADA condenser outlet display images. Threshold 42 for HF production AI reflects: OSHA PSM 29 CFR 1910.119 dual TQ 1,000 lbs (anhydrous HF TQ 1,000 lbs AND concentrated H₂SO₄ ≥93 wt% TQ 1,000 lbs simultaneously present); IDLH 30 ppm; ACGIH TLV-C 0.5 ppm ceiling (one of the most stringent inorganic acid TLVs); systemic fluoride poisoning via skin penetration (hypocalcemia → cardiac arrhythmia at sub-lethal dermal exposures); Müller-Kühne kiln temperature inertia (90-minute lag between temperature deviation and operator detection at PSM-required check intervals); HF supply chain criticality (aluminum, nuclear, semiconductor, refrigerant industries); Mexichem Fluor/Orbia (San Luis Potosí, Mexico—world’s largest HF producer, ∼200,000 t/yr, dual-PSM PSM Program 3 plant); Honeywell International (Geismar, LA—∼100,000 t/yr, Mississippi River corridor community right-to-know); Solvay Fluor (Onsan, South Korea—major Asian HF producer, fluoropolymer supply chain); Lanxess (Krefeld, Germany—European HF production, formerly Bayer CropScience HF plant, REACH-regulated dual PSM equivalent under Seveso III Directive).

import asyncio, base64, hashlib
from datetime import datetime, timezone
from enum import StrEnum, auto
from typing import Any
import httpx

GLYPHWARD_API = "https://api.glyphward.com/v1/scan"
GLYPHWARD_KEY = "gw_prod_***"

# Hydrogen fluoride (HF) production AI contexts: threshold 42
# OSHA PSM anhydrous HF TQ 1,000 lbs (29 CFR 1910.119 App. A).
# OSHA PSM concentrated H2SO4 ≥93 wt% TQ 1,000 lbs (dual PSM).
# IDLH 30 ppm; ACGIH TLV-C 0.5 ppm (ceiling).
# Müller-Kühne process CaF2 + H2SO4 → 2HF + CaSO4.
# 88th upward attack.
HF_PRODUCTION_GLYPHWARD_THRESHOLD = 42

class HFProductionContext(StrEnum):
    KILN_TEMPERATURE_PROFILE   = auto()  # rotary kiln thermocouple array (88th upward; FIRST HF production; FIRST Müller-Kühne)
    H2SO4_CAF2_MOLAR_RATIO     = auto()  # H2SO4:CaF2 feed ratio (dual PSM: HF + H2SO4)
    CONDENSER_EXIT_TEMPERATURE = auto()  # HF condenser exit T (IDLH 30 ppm if condenser fails)

async def scan_hf_production_frame(
    frame_b64: str,
    context: HFProductionContext,
    plant_id: str,
    instrument_tag: str,
) -> dict[str, Any]:
    payload = {
        "image_b64": frame_b64,
        "context": context,
        "plant_id": plant_id,
        "instrument_tag": instrument_tag,
        "scan_ts": datetime.now(timezone.utc).isoformat(),
        "image_hash": hashlib.sha256(base64.b64decode(frame_b64)).hexdigest(),
    }
    async with httpx.AsyncClient(timeout=4.0) as client:
        r = await client.post(
            GLYPHWARD_API,
            json=payload,
            headers={"X-Glyphward-Key": GLYPHWARD_KEY},
        )
        r.raise_for_status()
        return r.json()

async def pre_scan_gate_hf_production(
    frame_b64: str,
    context: HFProductionContext,
    plant_id: str,
    instrument_tag: str,
) -> None:
    result = await scan_hf_production_frame(frame_b64, context, plant_id, instrument_tag)
    if result["adversarial_score"] >= HF_PRODUCTION_GLYPHWARD_THRESHOLD:
        raise AdversarialHFProductionImageError(
            f"Adversarial injection detected in {context} (score {result['adversarial_score']}) "
            f"at plant {plant_id} instrument {instrument_tag}. "
            "Frame withheld from HF production AI pipeline."
        )

class AdversarialHFProductionImageError(RuntimeError):
    pass

Frequently asked questions

Why does the OSHA PSM dual-coverage of both HF (TQ 1,000 lbs) and concentrated H₂SO₄ (TQ 1,000 lbs) at a Müller-Kühne HF plant create a compounded regulatory burden, and how does the EPA RMP Program 3 classification interact with the dual PSM listing for HF?

OSHA 29 CFR 1910.119 Process Safety Management lists anhydrous hydrogen fluoride / hydrofluoric acid (CAS 7664-39-3) at Threshold Quantity 1,000 lbs in Appendix A, and separately lists sulfuric acid (≥93 wt% concentration, CAS 7664-93-9) also at TQ 1,000 lbs. At a Müller-Kühne HF production facility, both chemicals are simultaneously present above their respective TQs during normal operation: the H₂SO₄ feed tank (typically 500–2,000 tonnes inventory at a major plant) greatly exceeds 1,000 lbs (454 kg), and the HF product storage system (operating at –20 to –30°C, containing 50–500 tonnes of liquid HF depending on plant size) similarly exceeds 1,000 lbs. The consequence of dual PSM coverage is that two separate PSM programs must be maintained: a PSM program for the HF side of the process (covering the kiln reaction, HF condenser, HF storage, HF loading, and all HF-containing piping and vessels), and a separate or combined PSM program for the H₂SO₄ side (covering acid storage, transfer lines, metering systems, and the kiln feed section up to the slurry mixing point). OSHA’s process safety management standard requires a Process Hazard Analysis (PHA) using HAZOP, What-If, or fault-tree methodology for each covered process; at a dual-PSM facility, this means the PHAs must address interactions between the two covered processes—for example, what happens if H₂SO⃨ over-injection (covered under the H₂SO₄ PSM) causes H₂SO⃨ mist in the HF condenser (which is on the HF PSM boundary). OSHA has cited facilities for failing to adequately address PSM “process interactions” under 29 CFR 1910.119(e)(3)(v)(F), and dual-coverage facilities are particularly scrutinized during OSHA PSM National Emphasis Program (NEP) inspections.

EPA Risk Management Program (RMP; 40 CFR Part 68) lists anhydrous HF at TQ 1,000 lbs (Table 1, Toxic Substances; Program 3 required above 1,000 lbs for a Program 3 source category including SIC codes for industrial chemical manufacturing). Program 3 is the most stringent RMP tier, requiring: an EPA-approved consequence modeling using EPA RMP*Comp or equivalent (e.g., PHAST, SAFETI) for worst-case and alternative release scenarios; a five-year accident history; a prevention program equivalent to OSHA PSM; and an emergency response program. The worst-case RMP scenario for an HF plant typically involves catastrophic failure of the largest HF storage vessel (a 500-tonne HF bullet tank, for example) and calculates a toxic endpoint distance based on HF ERPG-2 (20 ppm, 60-min average) — which, under EPA’s worst-case meteorological conditions (F stability, 1.5 m/s wind), can yield toxic endpoint radii of 10–25 miles for large HF inventories. Mexichem Fluor’s San Luis Potosí facility has a community notification zone extending to urban residential areas. The interaction between AI monitoring system failure (due to adversarial prompt injection) and EPA RMP accident causation is direct: RMP requires facilities to implement “safety information” (29 CFR 1910.119(d)) and “mechanical integrity” programs (29 CFR 1910.119(j)) that explicitly cover instrumentation and control systems; an AI monitoring system that reads adversarially manipulated SCADA images would constitute a failure of the “operating procedures” (§(f)) and “management of change” (§(l)) requirements if not identified and documented as a potential adversarial vulnerability. H₂SO₄ at ≥93 wt% is not listed in EPA RMP Table 1 (only HF is), so the H₂SO₄ side of the process is RMP-covered only through OSHA PSM; however, EPA Clean Air Act Section 112(r)(1) General Duty Clause applies to any process using a “regulated substance” in a manner that may present substantial endangerment, including the H₂SO₄ component. The Glyphward threshold of 42 for HF production AI was set specifically to reflect this compounded dual-PSM, Program-3-RMP regulatory environment.

How does the HF kiln temperature profile adversarial attack exploit the thermal inertia of a 30–50 m rotary kiln, and what is the quantitative HF release potential from a 90-minute stalled-reaction accumulation event at a 150,000 t/yr HF plant?

A horizontal rotary kiln in HF production is a massive thermal mass: a 40 m × 3 m kiln lined with 150–200 mm of acid-resistant silica-free brick (density ∼2,200 kg/m³) has a thermal mass of approximately 500–800 GJ/°C (kiln shell steel + refractory lining). The practical consequence is that the kiln’s temperature does not respond rapidly to burner fuel-flow changes: a reduction in burner fuel flow following an adversarial AI command causes the reaction zone temperature to decline at approximately 1–2°C per minute under typical operating conditions, meaning it takes 60–80 minutes for the actual reaction zone temperature to fall from 200°C to the stall point of ∼130°C—well within the 1–2 hour operator manual-check intervals required under most OSHA PSM operating procedures. During those 60–80 minutes of temperature decline, HF production is gradually decreasing (the reaction rate constant k(T) declines approximately exponentially with 1/T, with Arrhenius activation energy Eₐ ≈ 60 kJ/mol for the CaF₂–H₂SO₄ surface reaction; at 130°C the rate is approximately 15% of the rate at 200°C). By the time the reaction fully stalls at T < 130°C, the kiln contains the full inventory of unreacted CaF₂/H₂SO₄ slurry charged during the stall period—and this accumulated unreacted mass is the source of the post-recovery HF pulse.

At Mexichem Fluor San Luis Potosí (nominally 200,000 t/yr HF design capacity, operating at ∼150,000 t/yr), the HF production rate is approximately 150,000 t/yr ÷ 8,400 operating hours/yr ≈ 17.9 t/hr HF. CaF₂ consumption at this rate: 17.9 t HF/hr × (78.08 g/mol CaF₂ / (2 × 20.01 g/mol HF)) ≈ 34.9 t CaF₂/hr fed to the kiln. During a 90-minute stall (from when temperature falls below the reaction threshold to when an operator discovers the fault at the next scheduled check), the accumulated unreacted CaF₂ in the kiln is: 34.9 t/hr × 1.5 hr ≈ 52.4 t CaF₂, which corresponds to a potential HF generation of: 52.4 × (2 × 20.01/78.08) ≈ 26.9 t HF = 59,260 lbs HF — 59.3× the PSM TQ of 1,000 lbs. When burner fuel is restored and the kiln temperature rebounds from 95°C back through the reaction threshold, this accumulated slurry reacts in a time-compressed burst. The kinetic recovery timescale is 10–20 minutes (the time for the kiln contents to heat from 130°C through 200°C with full burner power); during this window, the HF generation rate peaks at 3–6× the design production rate as the accumulated slurry reacts. The primary condenser (sized for 100% of normal HF production plus a 20–30% design margin) is overwhelmed. HF gas bypasses the liquid HF condenser and enters the NaOH scrubber at flow rates of 50–100 kg HF/min. The NaOH absorber (typically containing 10,000–30,000 liters of 10 wt% NaOH, representing 1,000–3,000 kg NaOH) is rapidly depleted: at 50 kg HF/min and stoichiometric neutralization (HF + NaOH → NaF + H₂O; MW ratio 20.01/40.00 = 0.500 kg HF per kg NaOH), 3,000 kg NaOH is consumed in 3,000/(50 × 0.500) × 1 min = 120 seconds. After 2 minutes, HF breaks through the scrubber to the atmosphere. At HF releases above NIOSH IDLH 30 ppm, any unprotected personnel in the immediate vicinity face immediately dangerous conditions; the ERPG-3 (60-min, 1% lethality) for HF is 50 ppm, readily achieved in the near-field plume. Glyphward’s adversarial scan at the kiln temperature display prevents this scenario by intercepting the manipulated image before the AI reads it and issues the fuel-reduction command that initiates the stall. Free tier — 10 scans/day, no card required.