In the last discussion about the topic we did not have much details because of the lack of documentation about the directional model in LuaTeX.
After looking at the source code, I've written details about it under the section Notes on \LuaTeX's Direction Model in https://codeberg.org/polyglossia/luabidi/src/branch/master/luabidi.tex, and think some things should be reconsidered or changed.
As for unicode bidi algorithm (correct text order without special markup) there is the unibidi-lua package which works with OpTeX.
In the last discussion about the topic we did not have much details because of the lack of documentation about the directional model in LuaTeX.
After looking at the source code, I've written details about it under the section
Notes on \LuaTeX's Direction Modelin https://codeberg.org/polyglossia/luabidi/src/branch/master/luabidi.tex, and think some things should be reconsidered or changed.As for unicode bidi algorithm (correct text order without special markup) there is the unibidi-lua package which works with OpTeX.