Open source library and CLI
Work with .env secrets without ever seeing them.
envsitter lists keys, fingerprints values with HMAC-SHA-256, and answers yes or no questions about them. Values stay in memory, so they never reach your terminal, your logs, or an AI agent's context.
$ npm install envsitter
Keys are readable. Values never leave memory.
Match operators
Ask questions about a value. Get a boolean back.
Every operator evaluates the value in-process and returns only true or false. Equality is checked by comparing HMAC digests, never the raw strings.
existsThe key is present in the source.
is_emptyThe value is exactly the empty string.
is_equalneeds a candidateDeterministic match against a candidate you supply, compared in constant time.
partial_match_prefixneeds a candidateThe value starts with the candidate.
partial_match_suffixneeds a candidateThe value ends with the candidate.
partial_match_regexneeds a candidateThe value matches a regex such as /^sk-/.
is_numberThe value parses as a finite number.
is_booleanThe value is true or false, ignoring case and surrounding spaces.
is_stringThe value is neither a number nor a boolean.
One rule everywhere
Keys, fingerprints, and booleans. Never values.
The same guarantee holds whether you run a command, call the library, or let an AI coding agent work in your project.
CLI
Inspect, validate, copy, and edit env files from your shell with JSON output and useful exit codes.
Command referenceLibrary
A typed TypeScript API for keys, fingerprints, matchers, scans, and file operations inside your own tools.
Library usageOpenCode guard
A plugin that blocks AI agents from reading or editing secret env files and hands them envsitter tools instead.
Guard for agentsCLI
Every command keeps values in memory.
Output contains keys, booleans, lengths, fingerprints, and line numbers. Commands that change files are dry runs until you pass --write.
$ npx envsitter keys --file .env
Exit codes: 0 success or match, 1 no match, 2 usage or runtime error.
| Command | What it does |
|---|---|
keys | List the keys in an env file |
fingerprint | Deterministic HMAC fingerprint of one key |
match | Match a candidate or operator against one, many, or all keys |
match-by-key | Bulk match a different candidate per key |
scan | Detect value shapes: JWT, URL, base64 |
redact | Replace secret values in text read from stdin |
validate | Check dotenv syntax with line and column |
copy | Copy keys between env files, with rename and conflict policy |
format, reorder | Sort and organize keys, by section or globally |
annotate | Add a comment above a key |
add | Add a new key, failing if it already exists |
set | Create or update a key |
unset | Set a key to an empty value |
delete | Remove one or more keys |
Library
The same guarantees, typed.
Build envsitter into release scripts, audits, or your own agent tools. Nothing in the API returns a plaintext value.
Path helpers such as isSensitiveEnvFile tell your tooling which files hold real secrets and which are committed templates like .env.example.
import { EnvSitter, setEnvFileKey } from 'envsitter';
const es = EnvSitter.fromDotenvFile('.env');
await es.listKeys(); // ['API_TOKEN', 'PORT', ...]
await es.matchCandidate('API_TOKEN', candidate); // true or false
await es.matchKey('PORT', { op: 'is_number' }); // true
await es.fingerprintKey('API_TOKEN'); // hmac-sha256 digest + length
// Dry run unless write: true. Returns a plan, never the value.
await setEnvFileKey({ file: '.env', key: 'API_TOKEN', value: next, write: true });
Security model
Comparisons without disclosure.
Values are read in-process for comparisons, but the library never returns them and the CLI never prints them.
Keyed fingerprints
Fingerprints are HMAC-SHA-256 with a local pepper, not raw hashes that are easy to dictionary-guess. The pepper comes from ENVSITTER_PEPPER or a .envsitter/pepper file created with mode 0600.
Constant-time equality
is_equal hashes the candidate and the stored value with the same pepper and compares the digests in constant time.
Candidates over stdin
Pass candidates and new values with --candidate-stdin or --value-stdin so secrets stay out of your shell history.
Not a secret manager: envsitter does not encrypt, sync, or relocate values. It works on your env sources in place.
For AI coding agents
Give your agent envsitter, not your secrets.
envsitter-guard is an OpenCode plugin for OpenCode 1 and 2. It blocks agents from reading or editing secret env files and gives them fifteen envsitter tools that never return values.