Planning to use something like this for some parts of NullBot3 (mostly to replace the clumsy adaptation statistics workqueue, but probably in some other places).
You'll find more explanation in the code comments. It's all quite green, but already tested on simple examples; i had to fail doing some more complicated stuff due to savegame compatibility issues.