Open-ended learning allows humans and robots to autonomously acquire an increasingly large repertoire of skills, that later can allow them to produce suitable actions to achieve desirable effects in the environment ('goals'). Empirical evidence from developmental psychology suggests that a pivotal mechanism possibly driving open-ended learning is represented by action-outcome contingencies. Here we propose a specific hypothesis, expressed in the form of a blueprint cognitive architecture, that sketches the general mechanisms through which contingency-based open-ended learning might take place. According to this hypothesis, the matching (or distance) between a desired goal and the actual effect produced by the action can be used to drive the learning of both the motor skill used to accomplish the goal and the internal representation of the action outcome. We report here a computational model that implements the hypothesis and we illustrate two developmental psychology experiments related to the presented theory. Overall the model and experiments show the soundness of the hypothesis and represent a start towards validating it experimentally.