Skip to content

Support dynamic env variables, e.g. from project-local direnv #258

@jinnovation

Description

@jinnovation

Currently, agent-shell supports "plain" .env files, as documented here.

My team's use cases revolve heavily around direnv, which allows for some "Bash-like" initialization of env variables. Case in point, from direnv docs:

[The .direnv file] is loaded into a bash sub-shell and all exported variables are then captured by direnv and then made available to the current shell.

This is important for e.g. re-authenticating against cloud environments and setting env variables based on the success/failure of that re-authentication flow.

Proposed user flow:

  • On initialization, agent-shell looks to see if there is a .direnv file in the project's root directory;
  • If found, attempt to execute it;
  • If execution fails, allow user to configure agent-shell to either start up anyway or fail immediately and refuse to start up;
  • If execution succeeds, all exported env variables are exposed to agent-shell for use.

Checklist

  • I've read the README's Issues section.
  • I'm running the latest agent-shell version.
  • I'm running the latest agent version (ie. Claude Code, Geminig CLI).
  • I'm running the latest agent ACP package (ie. claude-code-acp).
  • For requesting new agent support, I'm including a link to the ACP-capable agent or related ACP package.
  • For issues, I'm including ACP traffic (as per README).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions