Tokyo Cabinet internal coherence checking code

This code is part of the agent diagnosis code.
It's more deep than the base TC check.