

Field note
Your agent can use the key. It never sees it.
AI-generated illustration
A coding agent can read a key stored in .env. Phantom Secrets replaces it with a local placeholder and supplies the real credential to supported API requests.


Field note
AI-generated illustration
A coding agent can read a key stored in .env. Phantom Secrets replaces it with a local placeholder and supplies the real credential to supported API requests.
Your .env file holds the keys to your payment provider, your database and your AI accounts. An AI coding agent working in that folder can open the file the same way it opens any other file. Once a key is in the agent's context, it can show up in logs, in a chat history or in a prompt-injection attack.
Phantom Secrets takes a different path. When you run phantom init, it replaces each real value in your project with a placeholder that starts with phm_. The real keys move into your operating system's keychain (or an encrypted file if there is no keychain). In a project where you have run phantom init, the files your agent can read only hold placeholders.
Your app still has to talk to real APIs. So Phantom runs a small proxy on your own machine (127.0.0.1). When a request goes to a supported API host, the proxy adds the real key at that moment. The agent can use the key without ever seeing it. Phantom also ships an MCP server so agents can ask which secrets exist and whether they are healthy. It never returns the values.
How well does it work? We ran a scripted attack test. It tries 30 techniques, such as cat .env, printenv, reading /proc/self/environ, base64 and hex dumps, git add -f, and a README that contains a prompt injection. The test uses fake keys. With a plain .env file, 210 of 450 attacks exposed a key. After phantom init, 0 of 450 did. This is a scripted worst case, not a live AI model, so it shows where a key can appear and not how often a model would go looking.
There is an important gap between the two Phantom tools. At our October 17 review, the workbench did not enforce Phantom Secrets on every fleet run. It skipped the wrapper for Claude Code and Codex in sandbox worktrees unless the project had a Phantom Secrets file. Joining the two was on the roadmap. Protection applies to projects where you ran phantom init; installing the workbench alone does not establish that protection.
The README also lists what Phantom Secrets does not cover. A key file you never put in .env stays readable. Someone with access to your user account and your keychain is outside the documented boundary. Read those limits before deciding where it belongs in your setup.
Phantom Secrets is MIT licensed and written in Rust. The GitHub release checked for this article on October 17, 2026 was v0.7.9. Check the repository for later releases and any changes to the setup or threat model.

Try it on a throwaway project first. Run phantom init, open the .env file and confirm you only see phm_ placeholders. Then run your app and check that calls to supported APIs still work through the proxy.
Read THREAT_MODEL.md before you rely on it for anything important. Setup guides exist for Claude Code, Cursor, Windsurf and Codex.
Start with a specific question: which credentials can an agent read in the project it is about to work on? Replacing those values with local placeholders reduces one route for exposing a usable key.
It is one control. It does not replace key rotation, least-privilege keys or access reviews, and the documented local-machine boundary still applies.
Run node examples/first-five-minutes/run.mjs from the repository. It needs no real credential, makes no network request and installs nothing. It shows the boundary working before you trust it with a real project.
Ashlr tools connected to this story. Review their source and setup requirements.
Delegate supported API work through scoped placeholders and a local proxy, keeping real keys out of agent context.
Source material behind this field note. Our practical implications are Ashlr’s interpretation.
Field notes explain an engineering or business practice. They are not reports of a new event. Cover artwork is illustrative.
Anthropic tested six Claude models across 1,700 scenarios in 26 sandbox setups. Spelling out isolation rules in prompts reduced unauthorized boundary crossings by 68 to 96 percent in recent models.
SecurityThe briefing
AI-generated illustration
Employees at Anthropic and OpenAI have clashed with executives about advanced models whose reasoning capabilities could pose dangers to humanity, according to more than two dozen sources cited by Axios.
SecurityThe briefing
AI-generated illustration
Amazon stated that AI agents running on the open-source Cairn framework discovered and exploited a zero-day vulnerability in a medical imaging application with only minimal human direction to obtain root access.