Each example declares configuration, applies deterministic inputs, asserts one consumer-visible invariant and returns its commands or outputs as JSON.
Sensor policy
Occupancy fusion
Motion establishes occupancy. Optional presence can hold it after motion clears, but cannot establish it alone.
presence:on → no output
motion:on → occupied:true
motion:off → held
presence:off → occupied:false
Open executable example →
Motion policy
Occupancy to lighting intent
Dark, enabled occupancy produces semantic intent; it does not publish a device command.
{ occupied: true, trigger: "motion" }
→
{ kind: "intent", state: "ON",
targets: ["ceiling", "worktop"] }
Open executable example →
Switch policy
Explicit manual brightness
A classified double action becomes one full-brightness intent with manual ownership.
{ action: "double" }
→
{ state: "ON", manual: true,
values: { brightness: 254 } }
Open executable example →
Command owner
Room lighting boundary
The room controller converts semantic lighting intent into the sole transport command and records its policy source.
{ kind: "intent", state: "ON",
source: "motion" }
→
{ topic: "demo/lighting/ceiling/set",
lighting_command: { source: "motion" } }
Open executable example →
Readiness policy
Media-source evidence
Command success enters confirmation. Fresh active-application evidence is what satisfies application readiness.
activate → command_result:ok → confirming
observed:{ active, application, paused }
→ ready
Open executable example →
Command ownership
Bounded receiver volume
Rapid relative requests accumulate against one target. Fresh confirmation releases ownership so later external adjustment becomes the baseline.
relative:+1 → MV31
relative:+1 → MV32
observed:32 → ready · released
observed:28 → external baseline
Open executable example →
Coordination
Theatre activity
One activity request fans out semantic target intents and reaches ready only from fresh mandatory evidence.
movie_night request
→ display · receiver · source · lighting · backlighting
→ fresh target evidence
→ { phase: "ready", availability: "available" }
Open executable example →