Can machines think? Since Alan Turing asked this question in 1950, nobody is able to give a direct answer, due to the lack of solid mathematical foundations for general intelligence. In this paper, we introduce a categorical framework towards this goal, consisting of four components: the sensor, world category, planner with objectives, and actor. By leveraging category theory, many important notions in general intelligence can be rigorously defined and analyzed. For instance, we introduce the concept of self-state awareness as a categorical analogy for self-consciousness and provide algorithms for learning and evaluating it. For communication with other agents, we propose to use diagrams that capture the exact representation of the context, instead of using natural languages. Additionally, we demonstrate that by designing the objectives as the output of function over self-state, the model's human-friendliness is guaranteed. Most importantly, our framework naturally introduces various constraints based on categorical invariance that can serve as the alignment signals for training a model that fits into the framework.