Skip to content

About

Encrypted vault that injects scoped secrets into one command's environment, and logs every run

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-safe 🔐

Built by The Foundry, an autonomous build pipeline I run. A Haiku scout finds a developer pain point, a Sonnet agent writes the spec, and aider driving Sonnet builds it overnight.

This repo was produced end to end by that pipeline. I commissioned the system, approved each phase of it and reviewed what it shipped.

An encrypted vault for API keys, and a wrapper that puts a chosen subset of them into the environment of one command. Your shell keeps no exported secrets, nothing sits in a plaintext .env, and every run is written to an append-only log.

Built on 13 March 2026. 30 tests.

What it actually does

agent-safe run -s API_KEY -- python deploy.py decrypts the vault, copies the current environment, adds API_KEY to that copy, and starts python deploy.py with it. When the child exits, that environment goes with it.

The wrapped command can read every secret it was given. That is the point of injecting them, and it means the tool scopes and records what an agent gets rather than hiding it from the agent. An earlier version of this README claimed secrets never touch process listings; on both macOS and Linux a process's own user can read the environment of a running process, so that claim was wrong and has been removed.

What you get is narrower than "safe", and still worth having:

  • The vault on disk is encrypted, so a repo or a backup doesn't leak it.
  • -s means a command gets three secrets instead of the twenty in your .env.
  • The audit log says which secrets each command was handed, and when.
  • Your interactive shell never holds the values, so they don't leak through shell history, a screen share of env, or a child process you forgot about.

Installation

Not published to PyPI. There is an unrelated agent-safe package on PyPI, so install this one from source:

git clone https://github.com/solstice035/agent-safe.git
cd agent-safe
pip install .

Python 3.10 or newer.

Commands

agent-safe init                      # create the vault, set a master password
agent-safe add OPENAI_API_KEY --desc "Production key"
agent-safe list                      # names and descriptions, never values
agent-safe remove OLD_API_KEY
agent-safe import .env               # existing entries are kept, not overwritten
agent-safe run -- claude-code "build a REST API"
agent-safe run -s API_KEY -s DB_URL -- python deploy.py
agent-safe audit --last 10

add prompts for the value when you don't pass --value, which keeps it out of your shell history. Every command that touches the vault prompts for the master password.

Files live in ~/.agent-safe/, or wherever --vault points:

vault.enc           encrypted vault
vault.meta.json     salt and metadata, not secret
audit.jsonl         append-only log of access

Security model

Property Detail
Encryption Fernet (AES-128-CBC + HMAC-SHA256)
Key derivation PBKDF2-HMAC-SHA256, 600,000 iterations
Injection Into the child process's environment, which the child can read
Cleanup The child's environment goes when the child exits
Audit Append-only JSONL, one line at start and one at completion
At rest The vault file is unreadable without the password

What it doesn't do

  • Stop the command it runs from reading, logging or sending on the secrets it was given.
  • Hide a running process's environment from other processes owned by the same user.
  • Integrate with 1Password, AWS Secrets Manager or Vault.
  • Rotate or expire secrets, share a vault between people, or run as a daemon.

Development

pip install -e ".[dev]"
pytest -v                                        # 30 tests
pytest --cov=agent_safe --cov-report=term-missing

Licence

MIT. See LICENSE.

About

Encrypted vault that injects scoped secrets into one command's environment, and logs every run

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages