Abstract : This paper presents a general way to represent and manage computer based activity traces, which allow human and computational agents to parse, process and assist users in their complex and dynamic activities. To succeed, such a system has to provide mechanisms to declare, evolve and improve the sufficient knowledge to observe, interpret and reason about its observations of this environment. We propose unambiguous language capable of expressing this knowledge, together with some precise and well understood way of manipulating sets of observations which allow to draw inferences, answer queries, make interpretations and update both the knowledge base and the desired system behaviour. We consider traces of user computer interaction as system's knowledge of user activities and experiences. As a knowledge-based system (KBS) exploits an explicit representation of different kinds of knowledge, we describe Trace-Based System (TBS) as a kind of KBS whose main source of knowledge is the set of trace subsuming user-system interactions and evolving with his/her activities. The paper presents the general architecture of the TBS framework. We propose a formal representation of the concept of modelled traces and the associated languages supporting reasoning about them and their interpretation. Firstly, we focus on formalization of trace model and M-Trace in offline exploitation. Then, we specify a language to describe M-Traces based patterns, queries, and transformations. We extend this formalisation to online exploitation. Finally, we describe a TBS implementation in datalog and we discuss our proposition and future works.