I created a library a while ago that does something very similar to what you did, for the groovy language. http://aaronbabcock.blogspot.com/2011/11/groovy-debugging.ht...
It avoided having to pass in variables explicitly by using groovy's AST transform ability (macros) to examine the code for which variables would be in scope and pass those into the repl automatically. I wonder if something similar would be possible in scala?