How to ask for a letter of rec from a first semester professor in a masters' program? How to ask for a letter of rec to apply for PhD prospectively from a first semester professor in a masters' program who I won't take any future courses with?

Assume I receive an A but I'll never take classes with them again, and they'll probably forget about me. I won't apply to PhD programs as a masters student until I graduate.

Option 1: Ask for an informal letter of rec, sent to me, and I keep it for references/jobs that don't require confidential letters withheld from me.

Option 2: Don't ask at all. 

Option 3: Have them write something pretending that I'm already graduated from the masters program, and archive it on some disk. Trust that they won't lose it or "write it" or have them sent it to some other professor who is the department head. 

Option 4: Risk asking them later when they forget about me.
After you complete the course and receive an A, you email your professor along the following lines. 


  "Dear Prof X, I was a student in your class Z. I found it very
  interesting and really enjoyed learning about the subject (don't say
  this if you didn't). Next year, I am thinking about applying for W.
  Would you see yourself in a position to write a letter of
  recommendation for me for those applications? If you want, I'm happy
  to discuss my plans in person. Sincerely, Q"


Note that letter of recommendation that simply state "Student Q took my class Z, and they got an A" will not be particularly valuable for PhD applications. I would make sure to interact with the professor beyond just passively taking the class and really stand out. Don't do this just for the sake of getting a LOR (they can tell). Only if you're actually interested in the material!

Also, use those interactions to discuss your academic career plans with the professor! Maybe they know someone in your specific field of interest, maybe they are looking for PhD students themselves etc. That could become more useful than the LOR!