Foucault talks about the historicity of subjectivity, how it changes and how it is constituted through "techniques of the self."
It seems, according to some suggestions by Habermas, that one can distinguish three major types of techniques in human societies: the techniques which permit one to produce, to transform, to manipulate things; the techniques which permit one to use sign systems; and the techniques which permit one to determine the conduct of individuals, to impose certain wills on them, and to submit them to certain ends or objectives. That is to say, there are techniques of production, techniques of signification, and techniques of domination. Of course, if one wants to study the history of natural sciences, it is useful if not necessary to take into account techniques of production and semiotic techniques. But since my project was concerned with the knowledge of the subject, I thought that the techniques of domination were the most important, without any exclusion of the rest. But, analyzing the experience of sexuality, I became more and more aware that there is in all societies, I think, in all societies whatever they are, another type of techniques: techniques which permit individuals to effect, by their own means, a certain number of operations on their own bodies, on their own souls, on their own thoughts, on their own conduct, and this in a manner so as to transform themselves, modify themselves, and to attain a certain state of perfection, of happiness, of purity, of supernatural power, and so on. Let's call this kind of techniques a techniques or technology of the self.
In order to understand subjectivity we must "take into account the points where the technologies of domination of individuals over one another have recourse to processes by which the individual acts upon himself. And conversely, the points where techniques of the self are integrated into structures of domination." This is his notion of governmentality, closely related to Gramsci's hegemony. The subject has a subjectivity predisposed to obedience, which is not recognized by the self as being obedience.
What is at stake then is the discourses of self-production and how they are shaped and how they are transformed. The self-motivated compulsion to confess emerges as means to produce oneself along the predetermined lines while experiencing that constraint as freedom -- freedom as the pleasure of concretizing the self, of knowing identity rather than feeling it is amorphous, unrecognized.