Varlock Lets Your AI Agent See Your Config, Not Your Keys. Here's the Catch.
Cloudflare just bet on a schema for .env files. Here is what it protects, what it doesn't, and how to set it up in an afternoon
Most coding agents with access to your project folder can read your .env file. They don't have to try. The file sits next to the code, the agent reads project files to understand the project, and your Stripe key can come along for the ride into a prompt processed on someone else's server.
That used to be a slow-burn risk. Cloudflare's December 2 announcement that Varlock is joining the company calls it something else: coding agents "turned this fragile chore into an immediate security risk."
Varlock is the open-source tool Cloudflare is betting on, and its idea is simple and good. Give the agent a description of your configuration, and keep the actual values somewhere it can't read. But read the docs closely and the protection turns out to have a precise shape. It keeps secrets out of the files an agent reads. It doesn't stop an agent that can run commands from asking for them. Knowing where that line sits is the difference between a real improvement and a false sense of safety.
What Varlock is, in plain terms
Varlock is a command-line tool and a set of plugins for managing environment variables, the KEY=value settings your app reads at startup. It is MIT-licensed and, per Cloudflare's post, will stay open source and vendor-neutral after the move. The latest release at the time of writing is varlock 1.25.0, from November 13, 2026.
The core change is one file. Most projects keep a .env.example that lists the variables you need, usually out of date, plus a real .env with the values. Varlock replaces the example file with a .env.schema that you commit to Git. The schema uses comments as rules (Varlock calls this comment format @env-spec, its proposed standard for annotating .env files), which looks like this example from the README:
# @type=port
API_PORT=8080
# @type=url
API_URL=http://localhost:${API_PORT}
# @required @sensitive @type=string(startsWith=sk-)
OPENAI_API_KEY=
That file tells a person (or an agent) everything about the configuration except the secrets. API_PORT must be a port. API_URL must be a URL. OPENAI_API_KEY is required, must start with sk-, and is marked @sensitive. The value itself is blank.
The values come from somewhere else. Plugins let a line point at a secret manager instead of holding the secret:
# @plugin(@varlock/1password-plugin)
# ---
DB_PASS=op(op://my-vault/database-password/password)
The README lists plugins for 1Password, AWS, Azure, Google Cloud, HashiCorp Vault, Infisical, Bitwarden, Doppler and more. The schema also handles the part of config that usually lives in someone's head: which file applies where. The README's example sets an APP_ENV variable that is checked against a list (development, preview, production, test) and controls which .env.* file gets loaded on top of the schema. So "what does staging need?" has an answer in a file anyone can read, instead of a Slack thread from last spring.
If you don't want an external service, the AI tools guide says you can keep encrypted values in a gitignored .env.local using device-local encryption.
Why the schema idea is right
Think of it like handing a contractor the floor plan of your house instead of your house keys. The floor plan says where the doors are, which rooms need special locks and what goes where. That is everything they need to plan the work. The keys stay with you.
An agent writing code against your config needs the floor plan. It needs to know that DATABASE_URL exists, that it is a URL, that the app breaks without it. It almost never needs the actual connection string. Varlock's guide puts the goal plainly: the schema gives agents "full context on your configuration (variable names, types, validation rules, descriptions)" while the secret values stay out of plain-text files.
There is a second layer for the other direction, where the agent leaks a secret into code. varlock scan looks for secret values that ended up in your files, and the guide recommends running it as a git pre-commit hook so a hardcoded key never gets committed. In supported JavaScript setups, Varlock's integrations can also redact secrets from logs at runtime, when you turn that feature on.
Where the line actually is
Here is the part the "AI-safe" label skips. The schema keeps the values out of files. It doesn't change what happens when something asks Varlock for them, and an agent with a terminal can ask.
You can see this in Varlock's own guidance for agents. The guide describes varlock load --agent, which validates your config and prints JSON with every @sensitive value redacted, "safe to keep in a transcript." Then it warns that plain --format json-full "emits raw secret values and must not go into an agent transcript," and that agent mode is not compatible with --format env or --format shell because those "would expose raw values."
Read that again as a security property. The safe output exists. The unsafe output also exists, one flag away, and the only thing choosing between them is whoever types the command. If your agent can run shell commands in the project, it can run either one.
The same goes for varlock run. Its whole job is to resolve your secrets and hand them to a child process, as in varlock run -- python script.py. That is exactly what you want for your app. It also means any command an agent launches through varlock run receives the real values in its environment, and a command that prints its environment prints them.
So the honest summary of Varlock's protection: the agent can't see your secrets by reading. It can still get them by doing.
The one human checkpoint worth keeping
There is a place where a person stays in the loop, and it is worth setting up on purpose. The guide's examples use 1Password because, in its words, "it uses biometric authentication for local access." When a secret has to be fetched from the vault and the vault is locked, you get the sign-in prompt, not the agent.
That checkpoint only exists if you keep it. A cached session, or a service-account token (a long-lived credential meant for machines, so no person signs in; the README's own 1Password example declares one, OP_TOKEN), lets the vault answer without asking anyone. For the machine where your agent runs, prefer the interactive sign-in.
That prompt is a real control. If your agent kicks off a command that needs a secret and you weren't expecting it, the fingerprint or password request is your cue to stop and look. A plaintext .env gives you no such moment. The schema plus a vault that asks before it answers is the setup where Varlock's protection reaches past the file and into the command.
Put this into practice
This is the lowest-friction path for a project where you already use a coding agent such as Claude Code or Codex. Plan on an afternoon, most of it spent writing the schema.
1. Install the CLI. From the README:
npx varlock init # in a JavaScript project
brew install dmno-dev/tap/varlock # standalone binary on macOS
2. Write your .env.schema. Start from your existing .env.example. Mark every key, token and password @sensitive, and add @required and a @type where you know them. Commit it.
3. Move the values out of plaintext. Point sensitive lines at your vault with a plugin, or use Varlock's local encryption for .env.local. Delete the old plaintext .env once the app loads cleanly.
4. Let the agent see the schema. The guide notes that many AI tools ignore .env.* files by default. Add this line to .gitignore so the schema stays visible:
!.env.schema
5. Tell the agent which command to run. Varlock publishes an agent skill (npx skills add dmno-dev/varlock) with rules for working with the schema. Add one line of your own to your agent instructions file: validate config with varlock load --agent only, and never run varlock load with --format json-full, --format env or --format shell.
6. Add the leak check. Run varlock scan before you trust it, then wire it into a pre-commit hook, a script Git runs before every commit. It exits with code 1 when it finds a leaked secret, so it can block a commit.
What to expect: varlock load fails loudly the first time on anything you marked @required but haven't wired up yet. That is the schema doing its job. Fix those, and the agent's next config question gets answered from the schema instead of your keys.
Honest limitations
Redaction only covers what you marked. varlock load --agent hides values tagged @sensitive; a secret you forgot to tag prints like any other value.
The protection depends on the agent following instructions. Step 5 is a request, not a lock. A determined or confused agent with shell access can still run the unredacted command, and nothing in Varlock prevents it.
"AI-safe" is the project's own label, and it covers file reads. It is not a sandbox. If you need a hard guarantee that an agent can't reach production keys, the answer is not giving those keys to that machine at all, or running the agent where they don't exist.
The deepest integrations are JavaScript-first. Runtime log redaction and leak prevention come through drop-in integrations, and Cloudflare's post lists deeper support outside JavaScript as roadmap work.
The vault plugins need the vault. 1Password, AWS and the rest need their own accounts and setup, and the biometric checkpoint only exists if your provider offers one.
And the Cloudflare future is still a roadmap. The post says effort that would have gone into a hosted Varlock now goes into Cloudflare Secrets Store, and that the team wants .env.schema to become an open standard. None of that has shipped yet.
What's actually worth taking away
Varlock gets the split right: agents should read the shape of your config, and humans should hold the values. That alone fixes the most common leak, an agent pulling a plaintext .env into a transcript because it was sitting in the folder.
What it can't do by itself is decide what your agent is allowed to run. So pair the schema with the two things that cover the gap: a vault that asks you before it hands over a secret, and an agent told, in writing, which command is safe. Then the next time a fingerprint prompt appears while you weren't expecting one, you'll know exactly what it means.
Sources: Cloudflare, "Varlock is joining Cloudflare," December 2, 2026; dmno-dev/varlock README (main branch, read December 2, 2026; latest release varlock 1.25.0, November 13, 2026); Varlock AI tools guide; Varlock JavaScript integrations.