Managing Environments

Oct 6, 2025

With the introduction of tools like Claude Code, managing your environment gets little more complicated. Tools like direnv are helpful when working in a shell, but Claude is often helpful outside a single repo as it can act as an agent, crossing typical development boundaries. Thankfully, I ran into similar issues throughout the years using Emacs for all the things. A common challenge would be switching projects and needing to load different environment variables for different use cases. This became compounded when I would do operational work as well.

One option is to create tooling in my editor, Emacs. This often brought me farther away from a solution that others could leverage. Most devs would use their shell, vim, and/or vscode, which all solved the problems differently. My solution was to write we .

we works on a per-command basis, effectively allowing you to always start from a clean room. You can add defaults via a config file and layer different YAML files to create overlays. You can also write config files that get removed after the command exits. Scripts can also be used to hydrate config, so you can grab secrets when necessary. Lastly, you can write config files based on templates before running a command and delete them when the command exits. I’ve found it to be really handy over the years.

Now, when using AI tools, it is trivial to add a “use we before running commands” to the context and ensure I can control the environment accordingly. I use the same technique in Makefiles and in my editor when configuring modes and tools. If you give it a try, let me know how it goes!