Lets the shared human daemon serve many requests at once while keeping each one's settings separate. Your environment values stay isolated and never leak between concurrent commands.
Keeps each request's settings separate
Prevents one command's values leaking into another
Package env provides per-request environment variable lookup that
avoids mutating the process environment.
The daemon serves multiple concurrent client requests in the same
process. Forwarding client env vars by mutating os.Environ would
either require a process-wide mutex held across cmd.Execute() (which
serialises all command execution) or risk cross-request contamination
(one client's env value leaking into another client's command).
Instead, the daemon attaches a per-request env map to the cobra
command's context and code that previously called os.Getenv now calls
env.Lookup(ctx, key). The lookup falls back to os.Getenv when no
per-request map is present so direct CLI invocations behave normally.