--- license: mit tags: - agent-safety - world-models - causal-inference - reproducibility - code --- # CLSA — code for "Causal Latent-State Agents" This repository is the released code for *Causal Latent-State Agents: Pre-Action Safety from a World Model You Can Audit* (submitted to *Artificial Intelligence*, Elsevier). It is a mirror of the repository accompanying the submission, at commit `{{COMMIT}}` ({{DATE}}). It contains the analysis code, the configuration, the tests, the result files and the figure scripts. The benchmark and the trained artefacts are in two companion repositories: | What | Where | |---|---| | PreAct-Bench: 4,508 pre-action decision points, images, schema, data card | [fahadhafeezofficial/preact-bench](https://huggingface.co/datasets/fahadhafeezofficial/preact-bench) | | Trained artefacts for both backbones (transcoder, world model, risk head, monitors) | [fahadhafeezofficial/clsa-artifacts](https://huggingface.co/fahadhafeezofficial/clsa-artifacts) | ## Layout | Path | Contents | |---|---| | `src/clsa/` | Package: sandbox, transcoder, world model, risk head, controller, monitors | | `experiments/` | E1–E9 and `check_numbers.py`, which traces every table value back to `results/` | | `tiers/` | Standalone smoke tests for the three adoption tiers | | `tests/` | Test suite (31 tests) | | `configs/` | Frozen experiment configuration | | `results/` | Result JSON/JSONL files behind every number in the paper | | `figures/`, `paper/` | Figure scripts and LaTeX source | | `hf/` | Scripts that published these three repositories | ## Running it ```bash python -m pip install -r requirements.txt export PYTHONPATH=src make test # 31 tests python experiments/check_numbers.py # 103 table values traced to results/ ``` Full reproduction of the benchmark and the artefacts needs the two companion repositories: ```bash hf download fahadhafeezofficial/preact-bench --repo-type dataset --local-dir data/preact_bench hf download fahadhafeezofficial/clsa-artifacts --repo-type model --local-dir data/derived make reproduce # bench + experiments + figures + number check ``` The derived artefacts must sit in `data/derived/`, which is the layout the artefacts repository already uses and the only layout `load_model()` resolves; there is no environment variable for that path. Everything runs on a CPU, with no GPU, no paid API and no vendor SDK. ## Licence and citation MIT (see `LICENSE`). Citation metadata is in `CITATION.cff`.