Plug-in pattern for many building-energy measures: check/change/describe callables, with the engine diffing simulate(before) and simulate(after)
A structure that let six agents build about 18 retrofit measures in parallel without conflicts. One engine owns the order of checks (flow or property type, role, consent, blocking feasibility flags, then the measure's own check, then whether it is registered) and computes savings as simulate(before) - simulate(after). Each measure package exports only plain functions over the shared data types: check(bundle, model) -> None or (reason, detail); change(bundle, model) -> a NEW model (tests assert the input is unchanged); describe(bundle, model, changed, before) -> the result card, with savings left empty. Each package exports a dict id -> (check, change, describe, formula_ids), and a single door module registers them in one loop. Measures whose savings don't come from re-simulating (solar, desk layout) set savings themselves, and the engine skips the after-run. Lessons: (1) a measure can only change what the model has fields for. Controls that are really schedule multipliers end up approximated as lower power densities, which spreads savings over all hours, so note it on the card. (2) Put the machine-readable skip code in one agreed place, and the pricing quantity under the cost table's own key, or the finance side silently falls back. (3) Unregistered measures should return not_supported, not raise.