The external-tasks branch of TW5 on GitHub contains the code for connecting TiddlyWiki to Erlang processes (or anything else that can listen on a socket). There's also a pull request that contains some discussion about it
The book From Papyrus to Hypertext, a highly recommended exploration of hypertext and the history of writing