Ego is a system's (an entity, structure, etc) capacity not only for awareness of what it is doing, but for reflection on what it is doing, or did, or plans to do. Ego requires time, in that a being living in an endless present cannot have any sense of self, because 'self' is the product of interpreting present events in terms of past events. 'I' refers to the sum of knowledge/memories about events; I am defined by my previous actions, thoughts, etc, which determine my present actions, thoughts, etc. Think of a end stage Alzeimer's patient; no memory-an endless present, no sense of self, no ego.
The above is admireable and complete, but for one element, emotion, emotion about all the above, emotion about ones interactions with the world, indeed emotions can create a proud aggressive ego or an ego which has become timid. An ego which is to small cannot dream of great feats. I have heard the ego's cage described once as a tiger cage, used to torture prisoners in Nam, it is a good analogy, for it reduces ego, reduces ones humanity. I believe the main source in everyday life of the damage done to ego, is done by other people, parents, teachers and peers, authority in general can be a problem for the developing ego. To violate an individual, is to violate them emotionally, to do damage to their abilities to function in the world, to reduce their ego. Ego is then self-esteem and self-esteem is ones relation to the world.