During exploratory programming I often use rails runner to run a script within the context of my rails app, and stop at a binding.pry while I build and experiment. Today my debugger shell kept dropping me into zeitwerk internals outside the context of my script. To fix this, add a nil at the end of your script.

# your code

binding.pry
nil

Then run the script normally be rails runner script.rb and you're in the context of the script!