Summary
Add the ability to define a global .env.schema file in folder say in ~/.varlock that contains commonly used global environment variables (like API keys, tokens, etc.) that can be used across all projects when running varlock run.
Motivation
When using varlock run to execute commands in an agentic context (e.g., running varlock run pi), the command may be launched from any folder and requires certain environment variables like OPENAI_API_KEY to be set.
Currently, users must define these variables in each project's .env.schema file, which is:
- Repetitive - Same variables need to be defined in every project
- Error-prone - Easy to forget to add them to a new project
- Inconvenient - Can't use global tools like
varlock run pi without project-specific setup
Proposed Solution
Introduce a global .env.schema file (e.g., at ~/.varlock/global.env.schema or similar) that:
- Contains commonly used environment variables accessible across all projects
- Is automatically loaded when running
varlock run or varlock load
- Contains sensitive variables like API keys, tokens, etc.
Precedence/Override Behavior
When both global and local .env.schema files define the same variable:
- Local project
.env.schema takes precedence for the variable definition
- This allows projects to customize or override global defaults as needed
Example:
# Global (~/.varlock/global.env.schema)
OPENAI_API_KEY=@required @sensitive
ANTHROPIC_API_KEY=@required @sensitive
# Project (.env.schema)
OPENAI_API_KEY=@required @sensitive @example("sk-proj-...")
In this case, the project's local definition would override the global one.
Use Cases
- Agentic tools: Running tools like
pi that need OPENAI_API_KEY set from any directory
- Common credentials: API keys, tokens, secrets used across multiple projects
- Developer convenience: Avoiding duplicate configuration across projects
Additional Considerations
- The global schema file location should be configurable
- Users should be able to disable global schema loading if needed
- Security: ensure the global file is properly secured (permissions, etc.)
Summary
Add the ability to define a global
.env.schemafile in folder say in~/.varlockthat contains commonly used global environment variables (like API keys, tokens, etc.) that can be used across all projects when runningvarlock run.Motivation
When using
varlock runto execute commands in an agentic context (e.g., runningvarlock run pi), the command may be launched from any folder and requires certain environment variables likeOPENAI_API_KEYto be set.Currently, users must define these variables in each project's
.env.schemafile, which is:varlock run piwithout project-specific setupProposed Solution
Introduce a global
.env.schemafile (e.g., at~/.varlock/global.env.schemaor similar) that:varlock runorvarlock loadPrecedence/Override Behavior
When both global and local
.env.schemafiles define the same variable:.env.schematakes precedence for the variable definitionExample:
In this case, the project's local definition would override the global one.
Use Cases
pithat needOPENAI_API_KEYset from any directoryAdditional Considerations