Modifiers like :ratchet are lexically scoped, and therefore extend into any embedded <?before...> or <?after...>, I think. These days if you find yourself saying "surrounding context", you should usually ask yourself whether you mean "lexical" or "dynamic", and that often indicates the direction I'll be leaning on underspecced issues, especially if you assume I have a bias towards lexical unless dynamic is explicitly mentioned.
I supposed it could be argued that the argument to a before or after is hidden from the outer lexical scope, such as in <foo("arg")> but I'd say that even there, the language inside the parens is still inherited from the surrounding language braid, which is a lexically scoped concept. The current outermost language is called $~MAIN (see S02) while the current regex language is called $~Regex. It just has to look outward a bit further to see what the current definition of $~MAIN is than it would have to look for $~Regex. But all the ~ twigil variables are working together to define the current lexical scope's language in an interwoven fashion. Which is why we call it a "braid" of languages. Larry