# AGENTS.md ## Architecture - Python 3.11 package under `src/idea170_agrimesh_federated_privacy`. - SQLite-backed governance ledger for farms, adapters, contracts, deltas, and sync state. - Pydantic models validate local problems, shared signals, plan deltas, and adapter contracts. - `solver.py` contains the ADMM-lite allocator for cross-farm irrigation planning. - `canonical.py` maps AgriMesh primitives into a CatOpt-style intermediate representation. - `demo.py` assembles a drought scenario for 2 to 3 farms. ## Tech Stack - Standard library: `sqlite3`, `json`, `hashlib`, `hmac`, `math`, `random`, `dataclasses`, `pathlib`. - External dependency: `pydantic` for strict data validation. - Tests: `pytest`. ## Rules - Keep changes minimal and deterministic. - Preserve SQLite schema compatibility unless a migration is explicitly added. - Any new public data model should have validation and at least one test. - Preserve canonical JSON ordering when hashing or signing payloads. - Do not bypass the solver or ledger abstractions with ad hoc state. ## Testing - `bash test.sh` - `pytest -q` - `python3 -m build`