In AI, consciousness of self consists in a program having certain kinds of facts about its own mental processes and state of mind.
McCarthy [McC95] discuss what consciousness a robot will need in order to operate in the common sense world and accomplish the tasks humans will give it.
Many features of human consciousness will be wanted, some will not, and some abilities not possessed by humans have already been found feasible and useful in limited contexts.
[McC95] looks at concepts for a logical language that a robot can use to represent information about its own state of mind.
A robot will often have to conclude that it cannot decide a question on the basis of the information in memory and therefore must seek information externally. Gödel's idea of relative consistency is used to formalize non-knowledge. It turns out that this ability, itself based on the notion of relative consistency, is the basis of many other introspective abilities.
Programs with the kind of consciousness discussed here do not yet exist, although programs with some components of it exist.
Thinking about consciousness with a view to designing it provides a new approach to some of the problems of consciousness studied by philosophers. One advantage is that it focuses on the aspects of consciousness important for intelligent behavior.