As @kewms mentions the official method that works well for many people, there is also an unofficial and unsupported path that a coding model could probably orchestrate:
@cavalierex has done most of the hard work to parse the project XML and supports conversion of the custom RTF that Scrivener generates (styles are not part of RTF “spec” so KB uses custom markup in RTF). Gets you clean structured markdown, and what goes one way could go back the other. Understanding the XML hierarchy from the Binder + conversion of Scrivener’s styled RTF (solved by squarto) would enable a agent skill to pull structured text out, and inject changes back… BUT this is wholly unsupported and one would certainly want project backup before any sane person would let an agent anywhere near their work…