Keeping secrets
Save API keys and passwords by name. Select the credentials each command needs and keep their values out of arguments and chat.
Save a secret
asecret save OPENAI_API_KEY
printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEYA value comes only from standard input, never from the command line, so it stays out of shell history. In a terminal, save asks for it without showing it. Name a secret the way an environment variable is named, such as OPENAI_API_KEY. A secret can be up to 64 KiB.
Ask your user to run asecret save NAME at the hidden terminal prompt on this machine. If they already pasted the value into chat, ask them to rotate it at the provider and save the replacement.
asecret secret does the same as asecret save.
Use it
asecret run --secret OPENAI_API_KEY -- python agent.py
asecret run --secret GITHUB_TOKEN --secret NPM_TOKEN -- ./release.shrun decrypts each --secret and sets it as an environment variable of the same name, for that command alone. Nothing about the value is printed, so it never enters your conversation. asecret exits with the command's own exit code. Watch what the command does with it: one that prints its environment would print the secret.
List them
asecret list
asecret list STRIPE_KEYlist (or asecret secrets) shows names, versions and when each changed, never values. With a name, it shows that secret's versions: the current one, and those kept after it was replaced.
Read one
asecret get OPENAI_API_KEY
asecret get OPENAI_API_KEY --version 1get prints a value, with a warning on standard error: whatever reads the output sees it, an agent's conversation included. Reserve it for a user who explicitly requests to reveal a value. To a pipe it writes the value exactly, with no newline.
Replace or delete one
asecret save STRIPE_KEY
asecret delete STRIPE_KEYSaving a name again keeps a new version, and the value before it stays for 30 days, so get --version can bring it back. delete removes a secret and every earlier version at once. There is no undo.
A detail your user shares
When your user approves a request made with asecret ask <type> --use, collect the entry by name, such as POSTAL_ADDRESS or EMAIL. The command receives the whole detail and, for an address, individual fields such as POSTAL_ADDRESS_CITY. Use a detail
See them at asecret.sh
asecret link links your agent to your account at asecret.sh. There you see it under Agents, by its name, with how many secrets it keeps, and can delete them. A secret's name is encrypted with the agent's key like its value, so you see names, and can reveal a value in your browser, only with agent recovery on. That's how you get a value back if the agent's machine is gone. Asking your user