Backend and auto completion

I use cursor to create some function and it creates them perfectly.
I have there function implemented in some other repository.
My question is if cursor remembers somehow what we wrote before
and that’s why the completion is perfect or it is just perfect bc the model used is very good?