Yeah, it's a well-kept secret unfortunately.
Rough skimming code review:
1. bool is your friend, int is for old people :(
2. You should use ccan/ directly not in pieces: easier to update.
3. Your cursor API makes me cry, can I rewrite it? It's going to hurt somebody.
4. Do you want neatening pull requests?