@tjog the gateway does not remember anything, regardless if you have a controller or not.
Nodes can be programmed to remember their state. The example with rotary encoder at https://www.mysensors.org/build/dimmer does that if you want something to base your sketch on. Note that the first example on that page does not store state; it relies on a controller instead.
Not sure what you mean by rules, but if you enter rules in your controller they will most likely depend on the controller being available.