Very interesting, I hadn’t realised opam switch link worked like that. I’ve switched over to using that today and so far it works nicely, with Emacs and shells picking up the right thing.
The only curiosity is I have a stray /Users/tim/.opam/4.10.1/bin in my path but the local switch for my current directory is earlier in the list so takes precedence. Is there a default switch that gets set? Ideally I would want no switch to exist unless explicitly set.
I still need .direnv for other things but this is a welcome improvement.