# Mercury Notebook Template

Copy-me starting point for a Palladium study, per
[`docs/Mercury_Notebook_Pattern_V1-00.md`](../../docs/Mercury_Notebook_Pattern_V1-00.md).
The toy model is complete on purpose — every pattern mechanism (verbatim
anchor + contracted overlay, ramp mechanics, baseline-relative frame,
widget-pair reactivity, verification gate, backstage appendix, exports)
is present and runnable, so you replace math, not plumbing.

## Start a study

```bash
cp -r template/MercuryNotebook studies/YYYYMM_Client_EngagementName
cd studies/YYYYMM_Client_EngagementName
# 1. Rename the package (underscores only — dashes break Python imports):
#    studylib/ → <yourstudy>lib/, then fix pyproject.toml + imports.
# 2. Replace studylib/model.py's toy domain with your math;
#    re-pin tests/test_model.py with hand-checked numbers.
# 3. Rework notebooks/business_case.ipynb section by section —
#    keep the widget-pair cells, gate cell, and appendix cell structure.
pip install -e ".[dev]"
```

## Run

| Task | Command |
|---|---|
| Tests | `pytest` |
| Serve (the stage) | `mercury --working-dir notebooks/` (run from project root so `config.toml` loads) |
| Analyst view (backstage) | `jupyter lab` |
| Headless check | `jupyter nbconvert --to notebook --execute --inplace notebooks/business_case.ipynb` |
| Export for LLMs | `python scripts/export_report.py` |

## What's here

```
studylib/model.py      # ALL math — notebooks hold none
studylib/staging.py    # on_stage()/backstage() — Mercury vs JupyterLab/nbconvert
notebooks/business_case.ipynb
scripts/export_report.py
tests/                 # hand-checked pinned acceptance numbers
config.toml            # Mercury theme (NTT DATA brand)
pyproject.toml         # full toolchain as core deps — no requirements.txt
```

Reference implementation (a full multi-notebook study):
`studies/202607_CTM_GenesysCX/`.
