# @nous/lab-driver

Physical-lab autonomy for the Phase-178 autonomous-research stack
(TODOS/phase-178 §178.8). Extends Phase 130 (Kalika autonomous experimentation)
with cloud-lab / robotic-lab driver abstractions and a defensive safety gate.

## Components

| Module         | Summary                                                                                                                                                                                                                                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `driver.py`    | The unified **`LabDriver` trait** (`reserve`/`run`/`observe`/`log`/`abort`) with **Emerald Cloud Lab** (emits real Symbolic Lab Language), **Strateos** (emits real Autoprotocol JSON) and **Opentrons OT-2/Flex** (emits a real Python protocol) drivers over a fail-loud transport, plus an instrument catalogue. (§178.8.1) |
| `campaigns.py` | **Coscientist** active-learning reaction optimisation (real UCB/k-NN loop over a Suzuki–Miyaura space), **A-Lab** candidate → synthesis → **XRD phase-ID** → active-learning campaign, and **ChemCrow** 18-tool executive (real MW + safety-screen tools, seams for the rest). (§178.8.2)                                      |
| `models.py`    | **FAIR-Chem/UMA** property prediction and **Boltz-2/AlphaFold3/ESM3** protein design as fail-loud seams, each with a real offline baseline (group-contribution molar-mass/boiling-point; Kyte–Doolittle hydropathy). (§178.8.2.4–.2.5)                                                                                         |
| `safety.py`    | A **defensive wet-lab hazard classifier** (CWC-Schedule-1, controlled-substance, precursor-export, biosafety-level, high-energy, germline-CRISPR), a **mandatory human-in-the-loop gate** (PROHIBITED categories never dispatch; HIGH/BSL-3+/dual-use require approval), and a tamper-evident **chain-of-custody**. (§178.8.3) |

The native-program emission (SLL/Autoprotocol/Opentrons), the active-learning
loop, XRD matching, offline model baselines, and the entire safety gate +
chain-of-custody are fully local and tested. The cloud-lab APIs, learned
chemistry/protein models and LLM tool backends are honest fail-loud seams.

## Testing

```bash
python3 -m pytest tests/ -q     # 25 tests
python3 -m ruff check .
```
