# AgriMesh Federated Privacy AgriMesh is a Python package for privacy-preserving coordination across neighboring farms. It models local irrigation and resource constraints, exchanges aggregated signals, records tamper-evident plan deltas in SQLite, and produces coordinated irrigation plans for drought conditions. ## What It Includes - Pydantic models for farms, local problems, shared signals, regional constraints, adapters, and plan deltas. - A SQLite governance ledger for farms, contracts, adapters, events, and offline delta sync. - An ADMM-lite irrigation allocator that respects farm budgets and regional water and energy caps. - A canonical mapping layer that converts AgriMesh inputs into a CatOpt-style intermediate representation. - A drought demo for 2 to 3 farms. ## Package Layout - `src/idea170_agrimesh_federated_privacy/models.py` - validated data models. - `src/idea170_agrimesh_federated_privacy/ledger.py` - SQLite governance ledger. - `src/idea170_agrimesh_federated_privacy/solver.py` - cross-farm allocator. - `src/idea170_agrimesh_federated_privacy/canonical.py` - CatOpt mapping. - `src/idea170_agrimesh_federated_privacy/demo.py` - drought scenario builder. ## Quick Start ```python from idea170_agrimesh_federated_privacy import build_drought_demo result = build_drought_demo() for delta in result.deltas: print(delta.farm_id, delta.irrigation_liters) ``` ```bash bash test.sh python3 -m idea170_agrimesh_federated_privacy ``` ## Testing The repository is wired for: - `bash test.sh` - `pytest -q` - `python3 -m build` ## Packaging This project is published as `idea170-agrimesh-federated-privacy` and uses `README.md` as its package description source.