# Open-Weights Licence Audit

Audit open-weights model licenses against commercial deployment restrictions, Monthly Active User (MAU) thresholds, synthetic data output constraints, and attribution requirements.

## Workflow

1. Ingest model license terms:
   - Model name and release family
   - License identifier (e.g. `"Apache-2.0"`, `"Llama-3.3-Community"`, `"DeepSeek-Open-Model"`, `"Gemma-Terms-of-Use"`)
   - Commercial use allowed: boolean
   - Monthly Active User ceiling (e.g. 700,000,000 MAU for Meta Llama)
   - Synthetic output training restriction: does the license forbid using model outputs to train competing models?
   - Patent grant inclusion: does the license contain an explicit patent license/grant?
2. Ingest prospective deployer profile:
   - Current product MAU
   - Planned downstream training use (e.g. distilling into smaller models)
3. Evaluate compliance:
   - Enforce MAU headroom check.
   - Enforce distillation / synthetic data restriction compliance.
4. Output structured license audit receipt.

## Synthetic Input Format

JSON object with:
- `schemaVersion`: 1
- `model`: string
- `license`:
  - `name`: string
  - `commercialUsePermitted`: boolean
  - `mauThreshold`: optional integer (null if unlimited)
  - `forbidsTrainingCompetingModels`: boolean
  - `patentGrantIncluded`: boolean
- `deployerContext`:
  - `currentProductMAU`: non-negative integer
  - `intendsToDistill`: boolean
- `assertions`:
  - `requireCommercialUse`: boolean
  - `allowDistillation`: boolean

## Exit Codes

- `0`: Valid configuration and fully compliant.
- `1`: License assertion failure (e.g. distillation forbidden or commercial use prohibited).
- `2`: Malformed input or safety violation.

## Verification

```sh
python3 scripts/check.py examples/synthetic.json
```
