How can I prevent sleep in OSX Recovery mode?
If you're already in Recovery Mode doing some operation you don't want to interrupt, you can try this trick to run caffeinate.

Go to the Wi-Fi icon on the menu bar and pull it down.  Select "Join Other Network..."

The "Find and join a Wi-Fi network" dialog will be there, but look at the application title.  It's "macOS Utilities." Go to the Utilities menu and select "Terminal".

In the terminal, issue the command caffeinate.  When your operation is done, control-C out of it.

If it bothers you that the display sleeps and you don't really trust that the operation is still going, you can issue a stronger version:

caffeinate -dismut 65500

This is sort of like 'sleeplessness with prejudice.'  With the -u flag you get an implicit -t 5, which stops caffeine after five seconds.  So I overrode this by adding '-t 65500' which makes the caffeinate command last about 18 hours.

Finally, because I'm really, REALLY paranoid, I actually put caffeinate in the background and run a shell loop with ps -ef running every 75 seconds.