The current positioning system is perhaps a bit too clunky when described in a rule. Also the constant change in the "in" system might overload the RETE tree.
One alternative could be to store inside any positional element a multifield describing the ordered list of upper elements in the hierarchy from closest to furthest.
Any change in positioning should be represented by overriding the position argument with the sole instance name that precedes the element.
Inmediately after that, a rule copies the whole position slot after the instance name of the direct predecesor for that instance.
Another rule executes in the children nodes which checks if the content of its positioning is equal to the positioning of its predecesor plus the very predecesor and updates its position. This executes in order until the last nodes are updated.
The current positioning system is perhaps a bit too clunky when described in a rule. Also the constant change in the "in" system might overload the RETE tree. One alternative could be to store inside any positional element a multifield describing the ordered list of upper elements in the hierarchy from closest to furthest. Any change in positioning should be represented by overriding the position argument with the sole instance name that precedes the element. Inmediately after that, a rule copies the whole position slot after the instance name of the direct predecesor for that instance. Another rule executes in the children nodes which checks if the content of its positioning is equal to the positioning of its predecesor plus the very predecesor and updates its position. This executes in order until the last nodes are updated.