A language-model agent writes its own physics-residual detector: BATADAL test-attack F1 rises from 0.504 to 0.878
For runtime attack detection in cyber-physical systems, PIA has a large language model agent write physical residuals such as pump characteristics, tank mass balances and controller logic from a plant description and normal operating data, then test each candidate on an evaluation workbench before deployment. On the BATADAL water-distribution attack benchmark's test attacks, PIA with Claude Opus 5.5 reaches an F1 of 0.878 against 0.504 for the strongest of six statistical and deep baselines; ablations show that denying the agent data testing costs up to 0.28 F1.