# Environment filter proof driver

Surface: native Android dev client, Pixel 9 / Android 16 API 36, 1080×2424, light theme.
Each commit runs its own Metro bundle and two servers, with fresh databases. Alpha's environment-id is `all`; Lab's is `lab`.

1. Run `seed-usage.sh` once with `PROOF_DATA` set to a fresh scratch directory. It records two actual Pi/OpenAI turns with synthetic prompts. Both commit runs scan those same session files. In this run: Alpha 340 tokens, Lab 371, aggregate 711 across two sessions.
2. In each checkout, run `configure.py <PROOF_DATA>` before starting the servers. This sets the two environment IDs and grants usage access only to the isolated Pi history.
3. Start the Alpha server with `T3CODE_DEV_SEED=0 T3CODE_ENVIRONMENT_LABEL=Alpha vp run dev:server --host 0.0.0.0 --port <alpha-port>`; start Lab with the same command, `T3CODE_ENVIRONMENT_LABEL=Lab`, its own port, and `--home-dir "$PWD/.t3-lab"`.
4. Run `seed.py <fresh-workspace-directory>` in the checkout. This creates a project and live/archived-named threads on each server through T3's CLI and its existing Replay (dev) recordings. Archive the two archived-named threads through their long-press menu (`archive-seed.py`).
5. Prepare/install through `vp run mobile:install android`, start Metro from that checkout, and pair both servers with the repository's `pair-client.sh`. Wait until both live rows appear before recording.
6. On Chats with no filter, run `thread-proof.py <base|head> <new-output-directory>`.
7. Settings → Archive → Archived thread options → Environment, then run `archive-flow.py <base|head> <new-output-directory>`.
8. Usage → Tokens, no environment filter, then run `usage-flow.py <base|head> <new-output-directory>`.

The flow scripts use the same AgentDevice session name. Every still is captured only after two screenshots at least 500 ms apart are byte-identical. Recordings include Alpha selection, Lab control, Alpha after Lab, and All environments restore. Duplicate-key warning toasts in the base are generated by the reported defect. Head has no such warnings during these flows.
