DUDE I was daydreaming about this the other day, but with postgres. Can I ask why you chose clickhouse? My idea was that every op could be an insert, and then the resulting state would be a transaction and logged? So you'd get basically logged cpu state? Idk cool stuff I'm pumped to dive in tonight.
This is amazing, and also psychic damage inducing - I thought I had seen some terrifying SQL things and then I see "ClickOS UDF"
Also, there is a music synthesizer built on ClickHouse: https://github.com/ClickHouse/NoiSQL