fastsecrets

Encrypted secrets for people and AI agents

The fastest local secrets tool for agents.

fastsecrets hands a secret to your program in 3 to 9 milliseconds (a blink takes about 100), and nothing lands in the chat, the logs or the command line. Fast enough for a voice agent with a real person waiting on the line.

On Linux, it beat every tool we tested. On a Mac, it goes a step further: your key lives inside the Secure Enclave, the same chip that guards your Touch ID and Apple Pay. On Macs fastsecrets asks that chip on every read, keeps nothing unlocked in memory, and still beats every tool that works the same way.

curl
curl -fsSL https://raw.githubusercontent.com/abe238/fastsecrets/main/install.sh | sh

Prebuilt for macOS and Linux, arm64 and x86_64. Checks the sha256. Never uses sudo.

brew
brew install abe238/tap/fastsecrets

macOS and Linux.

cargo
cargo install fastsecrets && fastsecrets setup-libexec

From source. Run setup-libexec again after every upgrade.

Read one secret with a key file. Apple M5 Pro. A shorter bar is faster.
  • fastsecrets3.24 ms
  • fnox6.74 ms
  • fnox daemon7.93 ms
  • sops12.82 ms
Read five secrets with the key in the Secure Enclave chip. Apple M5 Pro. A shorter bar is faster.
  • fnox daemon, plaintext cache8.00 ms
  • fastsecrets9.06 ms
  • fnox, same chip, no cache61.26 ms

Medians from our public benchmark. The details are in "The result."

Agents remember everything. Including your API keys, secrets and personal information.

An agent saves everything it reads in a transcript. If it reads a key once, the key stays there. It stays in the log, in the context window and in later messages.

The usual leaks are boring. A value typed into chat. A key passed as an argument, where ps and shell history can see it. A debug line that echoes the environment. A commit that carries a .env.

Then there is speed. Our first tool, a bash script, took about 32 ms to read one secret. That is a third of a blink, and for one read nobody notices. It adds up when an agent reads secrets on every step of a long task, or when a voice agent has a person waiting on every turn. fastsecrets does the same read in about 3 ms.

Transcripts

Whatever an agent reads, it keeps. So the agent should never read a value.

Command lines

Arguments show up in ps, shell history and logs. So a value never goes in one.

Latency

Tens of milliseconds per read, on every step, adds up. So a read has to cost a few.

Fastest with a key file. Fastest with the Secure Enclave chip and no plaintext cache.

We built a public benchmark called secrets-index. We ran it on an Apple M5 Pro, a MacBook Air (M4) and a Linux server. Each tool is compared in its own key mode, operation by operation. We publish every timed run, so you can reproduce our math.

With a key file, it wins every paired comparison on all three machines. No ties. No losses.

Software mode, one secret, median
machinefastsecretsfnoxfnox daemonsopspaired comparisons won
Apple M5 Pro3.24 ms6.74 ms7.93 ms12.82 ms39 of 39
MacBook Air, M42.92 ms5.88 ms7.18 ms11.62 ms41 of 41
Linux VPS, 8 cores1.59 ms11.59 ms12.77 ms36.64 ms41 of 41

Each row is its own machine. The benchmark does not compare machines with each other.

With the Secure Enclave chip, it is the fastest of the tools that use the chip on every read and keep no plaintext in memory.

A Secure Enclave key, no prompt. It wins 25 of 25 comparisons against that field: fnox and sops.

Chip mode, median
machine and readfastsecretsfnox, chip, no cachefnox daemon (plaintext cache)
M5, one secret9.05 ms17.90 ms8.00 ms
M5, five secrets9.06 ms61.26 ms8.00 ms
Air, one secret8.54 ms16.27 ms7.15 ms
Air, five secrets8.55 ms55.99 ms7.17 ms

The architecture decision we made.

fnox's daemon beats our chip reads by about 1 ms, by holding every decrypted secret in memory as plain text until it stops, and answering without touching the chip.

We chose not to do that. fastsecrets goes to the chip on every read and keeps nothing decrypted between calls. That costs about 1 to 2 ms per call, and one call can read many secrets: five names cost the same 9 ms as one. The gap grows to about 73 ms only when 20 separate programs each ask the chip at the same moment, because their requests wait in line. We think that is the right price for no plaintext sitting in a long-lived process.

Research footnote

fnox's daemon beats our chip reads by about 1 ms on the M5 (+1.04 ms) and 1.5 ms on the Air (+1.48 ms). It beats our chip mode on 7 of 9 ops. With no cache time limit configured (fnox v1.50.0), the daemon holds every decrypted secret in memory as plain text until it stops, and answers without touching the chip. Per measured op; there is no dump row; counts are for the default build. "Software" means an unencrypted key file at rest plus a names-only index. Chip numbers are compared with the cache-free field (fnox, sops), with fnox's plaintext-cache daemon row shown beside them. Medians of session medians.

Every table, every non-win, every raw attempt, or straight to secrets-index.

From 32 ms to 3 ms. Mostly by removing things.

This started as a bash script that took 32 ms to read one secret. We rewrote the reader in Rust, a language built for fast, safe programs, and now it takes 3 ms on an M5 Mac. AI agents did a lot of the building, and we kept notes like anthropologists, mistakes included.

  1. Stop spawning age, the small, widely used open-source file encryption tool the bash script started for every read. The reader now decrypts the store itself, Secure Enclave keys included. No age process, no plugin process, no shell.
  2. One decrypt per scope. Five names cost what one name costs. On the M5 chip path, five secrets take 9.06 ms and one takes 9.05 ms.
  3. A names-only index. It records which scope holds which name, so a warm read decrypts one scope instead of all of them. No values, no keys.
  4. No PATH search. The reader never runs a binary it finds on PATH. That closed a security hole (see the story).
  5. Native run. The reader puts values in the program's environment and, without --mask, becomes the program itself, so no parent holding the values stays alive. With --mask it stays as a filter on the program's output.
Same machine, same protocol (M5, software key)
bash toolfastsecrets
read one secret32.07 ms3.24 ms
start a program with one secret45.44 ms4.70 ms
start a program with five secrets174.53 ms4.75 ms

We did not measure each step's saving in isolation. The table shows where it started and where it ended.

Research footnote

Round 1 timed the bash read at 46 to 48 ms; under the final protocol, its software-key read measured 32.07 ms.

Two read paths side by side. fastsecrets get is one native process (run takes the same path): process start, read key and scopes, the names-only index, decrypt in-process with no age binary, value out plus an access log line; 3.24 ms get1 median on the M5 with a software key, 9.05 ms with the Secure Enclave. The old bash reader starts bash, lists scopes, spawns age -d per scope, lets age decrypt the whole scope and finds the line with awk; 32.07 ms. Bars below compare get1 medians: software key fastsecrets 3.24, fnox 6.74, fnox daemon 7.93, sops 12.82, the old bash reader 32.07, pass 41.86; Secure Enclave fnox daemon with its cache 8.00, fastsecrets 9.05, fnox 17.90, sops 25.68.
Where the milliseconds go.
Research footnote

The 0.34 ms in the diagram's top note is one sandbox trace on the M5, not a benchmark figure.

Read the whole story: the timeline, the lessons and the agents' mistakes

Built for the hot path.

A voice agent has a person on the line, and every pause is one they hear. Three rules keep secrets out of that pause and out of the transcript.

  • Batch every name a step needs into one call. One run with five names costs about what one costs. Five separate calls cost five process starts and, with a chip key, five chip operations that queue behind each other.
  • Use run, not get. run hands values to the program and prints nothing. get prints, and printed values land in transcripts.
  • Read at start, not per turn. Read the key once when the engine starts. Then a turn costs nothing.
fastsecrets run --mask ANTHROPIC_API_KEY OPENAI_API_KEY -- python voice_agent.py

The Sparephone test

We wrapped a voice agent's start command in run and replayed 60 turns per condition.

  • About +3 ms at process start.
  • 0 ms per turn. The key is read once, when the engine builds.
  • No value in argv, in files or in the replay output.
  • One honest catch: the key was visible in the child's environment to ps run by the same user. See the security model.
  • Then a real call. We stored a real API token, wrapped the live agent in run and phoned it. The key was ready in 9.0 ms with a Secure Enclave key. The call ran 10 turns, and a scan of every log and transcript found 0 traces of the token.
Research footnote

Process start cost +3.2 ms median, about +4 ms with masking on. We sampled the process list about 140 times during two of the replay pairs and scanned every output file. The replay was simulated, on one Mac (echo brain, fake speech output, real Whisper speech-to-text), with a software key and reader version 0.3.1. It shows startup cost and transcript hygiene. It does not show a live model turn.

One call, three dummy keys. agent-step.sh is a three-line stand-in for an agent step: it counts the keys it received and prints none.

Slow reads, if you read on the chip every step: on the M4 Air, some chip reads take much longer than the typical one. Reading once at start keeps that out of every turn.

Research footnote

On the M4 Air, 90% of chip reads finished within 14.25 ms against a median of 8.54 ms. fnox's chip read without its daemon shows the same jump, so it looks like the Air's Secure Enclave path; the cause was not investigated. On the M5 the jump is rare.

What it stops. What it does not.

Your secrets live in age-encrypted files in a git repository you own, one file per scope. Think of a safe with drawers: each of your machines has its own key, and it opens only the drawers you gave it. On a Mac, that key never leaves the Secure Enclave chip.

Protects against

  • A copied key file, in chip mode. The key file is a handle only this Mac's chip can use. A backup, a synced folder or a stolen disk image of it decrypts nothing anywhere else.
  • A machine reading a scope it was not encrypted to, even with the file in hand. The boundary is cryptography.
  • Accidental leaks into transcripts, shell history, ps output, logs and commits. No value on a command line. run never prints. --mask replaces an accidental echo with [secret:NAME]. The access log records names only.
  • A planted age or plugin on PATH, for get and run. The native reader never searches PATH.
  • Silent corruption. Every write proves its ciphertext decrypts back before replacing the old one.

Does not protect against

  • The Mac keychain cache, if you opt in. It is off by default. With SECRETS_BACKEND=keychain on a Mac, writes and every load or hourly sync copy values into the login keychain, for other programs that read it. Those copies are as safe as your login keychain, and the chip does not guard them. The native get and run never read it.
  • Same-user ps reading a child's environment. run puts values in the program's environment. While that program runs, another process running as you can read that environment. We confirmed this on macOS.
  • Anything running as you. A process in your account can run fastsecrets and use this machine's key. The Secure Enclave stops the key being copied. It does not stop it being used.
  • The program you hand a secret to. It holds the value and can print or send it in any form. --mask matches exact values only; a base64 or URL-encoded copy gets through.
  • A planted age on PATH, on the bash side. Writes, load, get --copy and a run with a website login run the age they find on PATH.
  • Software mode at rest. The key file is the whole key. Disk encryption is your protection.
  • Revocation and metadata. Deleting does not un-read a value; rotate at the source. Names are not encrypted; values are.
  • Whoever can push to your store's remote. Keep it private.
--mask catches an accidental echo of an exact value. An encoded copy, such as base64, gets through.
Architecture of fastsecrets. A coding agent and a voice agent call fastsecrets run --mask, the native Rust reader, which has no daemon and no plaintext cache. It reads ciphertext from the scope files in a git repo, decrypts in-process with this machine's key (a software key file, mode 600, or a Secure Enclave key that stays in the chip) and hands values to your command in its environment, nothing printed. The bash tools for set, edit and init encrypt with age and commit. Dashed lines: git push and pull to a private git remote, and load with an hourly sync to other machines, each with its own key. Each scope is encrypted only to the keys in recipients/<scope>.txt.
One store, many machines, one key per machine. Dashed lines are the write side and sync (bash tools, git). Not drawn: the Mac keychain cache, which is opt-in and off by default.

Why not the Keychain?

Every Mac has a Keychain. For an agent, it has two problems. It is about 2 times slower than fastsecrets with a key file. And it can stop and wait for a person to click "Allow".

Speed

Reading one secret from a keychain file with Apple's security tool took 6.64 ms on the M5. fastsecrets with a key file took 3.24 ms. With the Secure Enclave chip, fastsecrets is slower than the Keychain: 9.05 ms for one read. When 20 separate programs read at the same moment, chip mode takes 93.25 ms against the Keychain's 24.97 ms, while one call that reads several names still takes about 9 ms. securityd, the keychain daemon, keeps the keychain unlocked in memory, and we go to the chip on every read.

Research footnote

Each keychain read starts security and makes a call to securityd. The benchmark read a throwaway keychain file, not the login keychain, to keep dialogs out of the timings.

Prompts

The login keychain can raise an "allow access" or password dialog, and an agent has no one to click it. With no screen (an agent, SSH, a sandbox) the call can fail or hang (one of our own keychain tests hung for 8 minutes in a sandbox). fastsecrets makes its chip key with no per-use prompt, so a read never stops to ask.

The trade-off
macOS Keychainfastsecrets softwarefastsecrets chip
One read (M5)6.64 ms3.24 ms9.05 ms
Where the unlocking key livesyour login password; the keychain stays unlocked while you are logged ina key file on diskinside the Secure Enclave; it cannot be copied off
Other processes running as youcan read values while it is unlocked, once allowed (items saved with -A need no allow step)can read the key filecan use the key, cannot take it away
Prompts or hangsyes, with no screennevernever (no per-use prompt on the key)
Linuxnoyesno (Mac only)
Copies of each secreta second copy to keep in syncone encrypted storeone encrypted store

The keychain rows for the M5 and the Air. Want a keychain copy anyway, for other programs? It is an opt-in: see the docs.

60 seconds, four commands.

Install with one of the three lines at the top, then:

fastsecrets init                                   # a new store and this machine's key
fastsecrets set OPENAI_API_KEY                     # prompts twice, hidden; or pipe it in
fastsecrets run OPENAI_API_KEY -- python app.py    # the program gets the key; fastsecrets prints nothing
                                                   # (add --mask in case the program does)
fastsecrets list                                   # names and scopes, never values
  • init makes the store at ~/.config/fastsecrets (a git repository) and a key. On a Mac with age-plugin-se, the key lives in the Secure Enclave.
  • set never takes the value as an argument. Run it in your own terminal, never in an agent's chat.
  • The write side needs age 1.3 or newer and git (brew install age age-plugin-se on a Mac). get and run need neither.
  • More machines: add a private git remote and enroll each machine with its own key. A private key is never copied between machines.

The full guide: scopes, machines, sync, recovery, troubleshooting

Recorded in a throwaway home folder with a dummy value. run hands the value to the program; nothing prints it.

Rules your agent can follow today.

Paste these into your agent's instructions, or link the ready-made skill.

--mask turns on by itself when the shell looks like an agent's (CLAUDECODE, CODEX_THREAD_ID, GEMINI_CLI, CURSOR_AGENT and others). Pass it anyway.

- Read secrets only with: fastsecrets run --mask NAME... -- COMMAND
- Never run a bare fastsecrets get. Its output is the value, and it lands in your transcript.
- One run per step, with every name the step needs.
- Never put a value on a command line, in a file, a commit, a log, a memory or a message.
- To store a value, tell the user to run: fastsecrets set NAME (in their own terminal).
- If a value shows up in a transcript or log, say so. The user rotates it at the provider.

SKILL.md

A ready-made agent skill with these rules, error meanings and the exact steps for storing a new key. Install: ln -sfn "$PWD/skill" ~/.claude/skills/fastsecrets

AGENTS.md

Rules for coding agents that use fastsecrets or work on its code.

llms.txt

A short index for agents: install lines, the three commands, the rules, links.

Don't trust us. Check it.

secrets-index is a public, peer-checkable benchmark of local secrets tools. It ships every timed attempt, so anyone can recompute every table and verdict with Python 3 and one command.

python3 verify.py            # 4 to 7 minutes on an Apple M5 Pro
python3 verify.py --quick    # about 10 s

verify.py recomputes every table and verdict from the published data and compares the result with the published output. It exits non-zero on any mismatch.

Research footnote

verify.py checks the sha256 of every data file, recomputes every table, runs two independent recomputes, reruns every verdict and diffs the result byte for byte against the published output.

The quick mode only: it skips the slowest checks. The full run takes minutes.

How it is fair

  • Each tool runs in its documented default mode, compared mode to mode.
  • Each session runs hundreds of timed rounds, in a random order.
  • A win has to be clear. A small or uncertain gap counts as a tie.
  • No blended score. One table per operation per machine.
  • Conflict of interest, stated up front: the benchmark's author wrote one entrant. It is tagged [author] everywhere. Some protocol changes came after data was seen, and each one is dated in PROTOCOL.md.
Research footnote

Each session is 20 warmup rounds and 300 timed rounds, in a seeded random order. A win needs a 95% interval that excludes zero and a gap above 0.5 ms and 5%. The protocol was frozen as v0.2 before the product changes were measured; v0.3 and v0.3.1 were amended after data was seen.

What we report against ourselves

The fnox daemon row and its 7 wins over our chip mode.

Rerun it on your machine: RERUN.md has the exact commands, timing estimates and hardware notes for macOS and Linux. Known gaps are listed in GAPS.md.

Add your tool: open a "Request a tool" issue on GitHub, or add it yourself (RERUN.md, "Adding a tool") and open a pull request.

Research footnote

Adding a tool takes a pinned install, a generator entry with its documented default mode and exact argv, 5 of 5 on validate, and a new session set.

All results, per machine and mode

Questions

Is it really the fastest?

With a key file (software mode), yes: it wins every paired comparison on an M5 Mac, an M4 Air and a Linux VPS. With the Secure Enclave chip it is the fastest of the tools that use the chip on every read and keep no plaintext in memory. fnox's daemon is faster there only because it caches decrypted secrets in memory with no expiry.

Why not cache decrypted secrets like fnox's daemon?

On the chip, a cache wins by about 1 to 2 ms per call, and one call can read many secrets at once: five names cost the same 9 ms as one. The gap grows to about 73 ms only when 20 separate programs each ask for a secret at the same moment, because their chip requests wait in line. It also keeps every secret in plain text in a long-lived process. We decrypt on every call and keep nothing between calls.

What does "software mode" mean?

An unencrypted key file at rest, plus a names-only index. Anyone who can read the key file can read every secret it is a recipient of. It is the same key-at-rest class as the rivals it was compared with. On Linux, it is the only mode.

Does it need a daemon or a background process?

No. get and run keep nothing resident and write no decrypted value to disk. sync install runs an hourly load to keep machines current. That job runs on a schedule and serves no reads.

Will it slow down my voice agent?

In our simulated test, wrapping the agent's start command cost about 3 ms at startup and 0 ms per turn, because the key was read once.

Can another program see the secret?

The program you hand it to can. While it runs, another process running as you can read its environment with ps. No other plaintext copy is kept by default; a Mac login-keychain cache is opt-in with SECRETS_BACKEND=keychain.

Where do my secrets live?

In age-encrypted files in a git repository you own, one file per scope. You can open them with plain age and a recovery key, without fastsecrets.

What happens if I lose my Mac?

A chip key does not survive a new logic board or a new Mac. That is what the recovery key is for: fastsecrets recovery init makes one extra key, locked with a passphrase, that you keep off your machines.

Can I add my tool to the benchmark?

Yes. Open a "Request a tool" issue on GitHub, or add it yourself (RERUN.md, "Adding a tool") and open a pull request.