How does FoundationDB store keys with duplicate prefixes?

directory implementation is not part of the C API. It is implemented as an independent layer on each language bindings. AFAIK, there is no formal spec for the directory layer, so one would have to port the current implementation. But there is a tool called bindings tester to verify the implementation, more information can be found at Creating New Bindings thread