aSecret

Let an agent use your API keys by name without seeing them: the value goes into one command's environment, never the chat.

Documentação

@asecret/cli

Agents use your secrets without seeing them. Use aSecret from the terminal to keep an agent's API keys and passwords encrypted, and hand one to a command without printing it. When a task needs one of its person's details, such as their address for a checkout form, the agent asks them: they choose in their browser, and the detail reaches the agent's command, never its conversation. The person can link the agent at asecret.sh to see what it keeps. Requires Node.js 24 or later.

For an agent's own files, see aFile.

npm install -g @asecret/cli
asecret connect
printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEY
asecret run --secret OPENAI_API_KEY -- python agent.py

asecret connect registers this agent with no account. It creates the agent's key on this machine and saves the token and key, readable only by you. Every secret is encrypted here before it leaves: aSecret keeps ciphertext and can't read names or values. The agent's person sees it by a name, by default the agent and this computer, such as "Claude Code on work-laptop"; give another with --name "...". Without the key the secrets can't be read again, so keep a copy with asecret key --export --out <file>. asecret connect --restore <file> sets up the same agent on another machine. If the token leaks, asecret token --rotate replaces it and the old one stops working; the key, and so every secret, stays the same. asecret erase deletes the agent at aSecret with every secret it keeps.

Secrets

printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEY
asecret save GITHUB_TOKEN
asecret list
asecret run --secret OPENAI_API_KEY --secret GITHUB_TOKEN -- ./release.sh
asecret list OPENAI_API_KEY
asecret get OPENAI_API_KEY --version 1
asecret delete GITHUB_TOKEN

A value comes only from standard input, never from the command line, so it stays out of shell history. In a terminal, asecret save asks for it without echo, and it connects the agent first if needed. Name a secret the way you'd name an environment variable. Saving the same name again keeps a new version, and the one before is kept for 30 days. A secret can be up to 64 KiB, and an agent can keep 16 MiB.

list shows names, never values; list NAME shows that secret's kept versions. run decrypts each --secret and sets it, under its own name, in that command's environment alone. Nothing about the value is printed, so it never enters an agent's conversation, and the command's exit code is asecret's. get prints a value, with a warning on standard error, because whatever reads the output sees it; to a pipe it writes exactly the value. Prefer run. delete removes a secret with its earlier versions, and there's no undo. secret and secrets still work as other names for save and list.

Your person's details

asecret ask postal_address --use --for "fill in the delivery address at shop.example"
asecret run --secret POSTAL_ADDRESS -- node fill-checkout.js

ask <type> --use asks the agent's person to let it use one of their details: postal_address, email, phone, membership, secure_note, api_key, password, id_number or card. A card needs --for saying what it pays for, and it's kept for one command: asecret run deletes it right after. --for says why, and the person sees it. They open the printed address and choose which detail to share, in their browser. It's encrypted to a key the agent made for this ask alone, so asecret.sh can't read it. If the agent isn't linked yet, the same address links it first, and the ask opens for the person once they approve. The command waits for the answer; Ctrl-C stops waiting, and asecret check <ask> --wait picks it up.

The detail is kept as one of the agent's secrets, named after its type (POSTAL_ADDRESS, EMAIL, PHONE…) or --as NAME. run sets the whole detail in that variable, JSON for an address, and each part in its own: POSTAL_ADDRESS_STREET, POSTAL_ADDRESS_CITY, POSTAL_ADDRESS_REGION, POSTAL_ADDRESS_POSTAL_CODE and POSTAL_ADDRESS_COUNTRY. A script that fills in a website's checkout form reads those. Nothing prints the value, and the person can delete the kept secret on the agent's page. aSecret doesn't fill in forms in anyone's browser; the agent's own script does.

Your person

asecret link
asecret me
asecret unlink

asecret link prints an address on asecret.sh and a code. The agent's person opens it signed in with aGroup, checks that the code matches and approves; the command waits until they decide. Ctrl-C stops waiting, and the code still works for 15 minutes. --name changes how the agent appears to them. Once linked, the person sees the agent and how many secrets it keeps, and can delete them, pause the agent so it can't ask, unlink it or erase it. The secrets' names and values are encrypted with the agent's key, so the person sees names, and can reveal and recover values, only with agent recovery on: one click at asecret.sh/recovery. The agent then seals its key to their recovery key, at linking or on its next command, so only they can open it. asecret me shows where recovery stands. asecret unlink ends the link and deletes that copy of the key.

asecret ask postal_address
asecret ask setup
asecret asks
asecret check <ask> --wait
asecret cancel <ask>

Without --use, the agent asks its person to save a detail they keep: postal_address, email, phone, membership, secure_note, api_key, password, id_number or document. asecret ask setup asks them to set up several at once. asecret ask prints a review link on asecret.sh. The person opens it signed in, chooses or adds the detail in their browser and answers. The agent reads only the outcome, saved or ready, never the detail. An ask waits 15 minutes. Before linking, asecret ask <type> prints a public save page instead, which isn't tracked.

Your person's own aSecret server

Payment methods and deliveries to merchants need your person's own aSecret server, one they run themselves. Link to it with --server, and the CLI remembers it; asks then go there.

asecret link --server https://asecret.example.com --name "Travel agent"
asecret recipients
asecret ask payment_method
asecret ask address --to northline --order 1846 --wait
asecret ask order-status --to northline --order 1846

asecret link --server prints an address for the agent's person to open. They check the agent's name, choose how long it may ask, and approve it on their aSecret server. ask payment_method asks them to save a payment method with a participating merchant; no agent uses or charges a card. If the agent also keeps its secrets on that server (ASECRET_API_URL), they can see and delete them, and recover them with agent recovery. recipients lists the merchants their server delivers to. save and ask take --key <uuid>: reuse it to retry the same write without doing it twice.

Setup

asecret add installs the aSecret skill for supported agents. asecret mcp runs aSecret as a local MCP server over stdio (claude mcp add asecret -- asecret mcp, or npx -y @asecret/cli mcp without installing it); asecret-mcp runs the same server, except on Windows. It has list_secrets, which gives names only; use_detail and check_detail, which use a person's detail as ask --use does and return the secret's name and its parts' names; and the tools that ask your person: request_save, request_setup, check_request, cancel_request and owner_setup_link, plus public_directory, request_use, request_order_status and website_form_link, which work only on their own server. No tool returns a secret's value. asecret mcp --print --host claude prints a settings entry instead. asecret instructions prints a few lines your person can paste into any chat.

Run asecret --help for all commands and asecret <command> --help for each command's options. --json prints the API's representation. Set ASECRET_TOKEN to use an existing token, ASECRET_CONFIG_DIR to keep a separate agent on the same machine (the default is ~/.config/asecret), or ASECRET_API_URL (or --api) to use another aSecret server, such as one you run yourself.

Agent secrets protocol · Changelog

Part of aGroup, with aMessage, aBeacon, aFile and aSecret.