Do you have any code in the resolver where you parse output from the /run/knot-resolver/control socket? I could use some inspiration. I wrote some code to process the output, but it seems fragile to me with respect to termination conditions. It simply reads line by line until there is a line containing either new line only "\n" or a prompt with a new line "> \n". Is there a better way?
I do not know your timelines etc. but it might make sense to contribute to the YANG project instead of wasting time on custom hack ... The "binary" protocol is just stopgap measure and will go away once we have the YANG pieces in place.
It came from lower layers of networking but it is generic enough for almost anything.
E.g. https://tools.ietf.org/html/rfc8343#appendix-A might give you an idea how the model looks. The API is generated from the model and then all what's missing are "hooks" for each implementation to transform the abstract description (data stored in the model) into paritcular configs, e.g. into policy statements for Knot Resolver.