The article provides a theoretical basis of multi-agent recursive cognitive architectures as a distributed intelligent system of decision-making and control of an ambient intelligence system. It is dealt with the formalization of such cognitive architectures based on recursive deterministic abstract automata. The work introduces a method of automatic contexts formation in systems of ambient security based on the formal representation of semantics. Attempts are made to model and visualize semantic primitives and contexts. Successful experiments on the multi-agent representation of the subset of natural language limited by the domain of ambient assisted living systems for elderly people were conducted.