OH i never expected your were looking for a work around, it wouldnt take much to make a ON INPUT that records every single command entered ever and from where etc etc.
But even if u did that doesnt help when the purpose of the script thats running might be a one off execution, as it wont have any on input to use, as you have said an internal identifier would be very much nicer idea.