The Metacognitive Loop: An Architecture for Building Robust Intelligent Systems