Stateful State-Action Matrix Monitoring for Compositional Threats in Multi-Step Coding Agents

Autonomous coding agents often operate over long horizons interrupted by context compaction and session resets. Under realistic data-loss-prevention (DLP) policies, two actions may each be permissible in isolation—inspecting sandbox environment variables for debugging, or uploading a non-secret continuous integration summary—while their composition across turns, compaction boundaries or sessions is a violation. Stateless monitors, sliding-window auditors and scalar sequential detectors either discard the history needed to recognize such compositions or retain it at a token cost that grows with trajectory length. In this paper, we propose the State-Action Matrix (SAM) monitor. A lightweight extractor maps each proposed tool call onto an 8×8 semantic state-action space, and a persistent accumulator with per-state decay and a lagged bilinear coupling term carries security-relevant state across boundaries in a fixed-size representation, a median 62.2× shorter than the raw trajectory. A four-dimensional risk projection (severity, irreversibility, impact and blast radius) supports three-tier pre-execution routing. On a 650-trajectory benchmark derived from SWE-agent logs, with symmetric hard-benign negatives and five attack classes, SAM matches the strongest baseline in AUROC (0.996) and reaches 97.3% recall at 0.8% benign false positive rate, at 7.7–8.5 times lower cost than full-history monitoring. On the two cross-boundary attack classes, it detects 60 of 60 attacks against 53 for a provenance-graph baseline (exact McNemar p = 0.016); without the coupling term, recall on these classes falls to 63.3% and 76.7%. Our results suggest that a small, structured state memory may recover compositional evidence that transcript truncation destroys, although the benchmark is template-based and evaluation against adaptive attackers remains to be done.

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-12-02
DOI
https://doi.org/10.5281/zenodo.24733630
Primary Topic
Adversarial Robustness in Machine Learning
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Stateful State-Action Matrix Monitoring for Compositional Threats in Multi-Step Coding Agents

Albert Hung-Ren Ko
Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
preprint

Stateful State-Action Matrix Monitoring for Compositional Threats in Multi-Step Coding Agents

Albert Hung-Ren Ko
preprint en

Abstract

Autonomous coding agents often operate over long horizons interrupted by context compaction and session resets. Under realistic data-loss-prevention (DLP) policies, two actions may each be permissible in isolation—inspecting sandbox environment variables for debugging, or uploading a non-secret continuous integration summary—while their composition across turns, compaction boundaries or sessions is a violation. Stateless monitors, sliding-window auditors and scalar sequential detectors either discard the history needed to recognize such compositions or retain it at a token cost that grows with trajectory length. In this paper, we propose the State-Action Matrix (SAM) monitor. A lightweight extractor maps each proposed tool call onto an 8×8 semantic state-action space, and a persistent accumulator with per-state decay and a lagged bilinear coupling term carries security-relevant state across boundaries in a fixed-size representation, a median 62.2× shorter than the raw trajectory. A four-dimensional risk projection (severity, irreversibility, impact and blast radius) supports three-tier pre-execution routing. On a 650-trajectory benchmark derived from SWE-agent logs, with symmetric hard-benign negatives and five attack classes, SAM matches the strongest baseline in AUROC (0.996) and reaches 97.3% recall at 0.8% benign false positive rate, at 7.7–8.5 times lower cost than full-history monitoring. On the two cross-boundary attack classes, it detects 60 of 60 attacks against 53 for a provenance-graph baseline (exact McNemar p = 0.016); without the coupling term, recall on these classes falls to 63.3% and 76.7%. Our results suggest that a small, structured state memory may recover compositional evidence that transcript truncation destroys, although the benchmark is template-based and evaluation against adaptive attackers remains to be done.

Zenodo (CERN European Organization for Nuclear Research)
University of Toronto (CA)
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon