As the past perfect normally connects a past situation to a later past situation, the time period extends from the earlier to the later past time period, 'Before' (the later time period) is therefore appropriate; 'ago', which works back from the present time is normally inappropriate. I've used the word 'normally', because I am sure we can come up with some examples in which past perefect + 'ago' works if we try.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Englishmaven"Before" is not indefinite. I'm not sure what is meant by that.I'm pretty sure the OP means "ago" is measured from the moment of utterance and "before" is measured relative to some past moment in expressions like the following. (I doubt that full before-clauses have anything to do with the question.)
Anonymousinstructed me that I must change [ago] ... into [before].By the way, 'earlier' will serve as well as 'before' for that purpose.