This looks awesome! Clearly you have put in a lot of hard work and thought into this.
Ive been itching for a scriptable personal knowledge base where I can store arbitrary datastructures and executable code in addition to the typical richtext note taking. Will be diving into the code asap. Cheers!