Skip to content

feat: support global .env file in AgentBox directory #6

@shrwnsan

Description

@shrwnsan

Summary

Support a global .env file in the AgentBox directory (e.g., ~/.agentbox/.env) that loads before project-specific .env files.

Use Case

Configure custom API endpoints and keys for 3rd party inference providers (e.g., non-Anthropic inference services) without needing to set credentials per-project.

Current Behavior

  • Only PROJECT_DIR/.env is loaded
  • Global configuration (API keys, custom endpoints, etc.) must be set per-project or via Claude auth volume
  • Using 3rd party inference requires configuring ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY in each project

Proposed Change

  • Load SCRIPT_DIR/.env first (e.g., ~/.agentbox/.env)
  • Then load PROJECT_DIR/.env if it exists
  • Project env vars override global ones (Docker env-file behavior: last wins)

Security Considerations

  • Low risk: Consistent with existing credential sharing via Claude auth volume
  • Credential concentration: API keys shared across projects (already true for Claude auth)
  • Override behavior: Project .env takes precedence (correct behavior)
  • Mitigation: Add ~/.agentbox/.env to .gitignore

Rationale

Aligns with AgentBox's simplicity philosophy - provides convenient global configuration for 3rd party inference without prompts or complex setup.


🤖 Generated by Claude Code - GLM 4.7

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions