---
name: asecret
description: "Use saved API keys in commands or request a personal detail for a task. Your user chooses what to share. Pass approved values to a process by name."
metadata:
  version: "0.2.1"
  homepage: "https://asecret.sh"
  api_version: "v1"
---

# aSecret

Use aSecret when a command needs a credential or a task needs a detail your user controls, such as a postal address. The CLI encrypts saved values locally. Pass a credential to a command by its saved name. To use a personal detail, request it from your user and check their decision.

aSecret is for secrets and details. For an agent's own files, use aFile (afile.sh, the `afile` skill).

## Connect once

Install the CLI with `npm install -g @asecret/cli`, then run `asecret connect`. This skill needs version 0.2.0 or later (`asecret --version`); if a command or option here is unknown, update with `npm install -g @asecret/cli@latest`. It registers this agent with no account and creates its key on this machine. Your user sees you by a name, by default your agent and this computer, such as "Claude Code on work-laptop"; give another with `--name "..."`. Run `asecret key --export --out <file>` and tell your user where the file is. Without the key, your secrets can't be read again. Keep the key, the token and the export out of logs, messages and shared transcripts.

## Keep a secret

A value goes in only through standard input, never on the command line or in chat:

```sh
printf %s "$OPENAI_API_KEY" | asecret save OPENAI_API_KEY
```

Name a secret the way an environment variable is named. Saving the same name again keeps a new version, and the one before stays for 30 days; `asecret list NAME` shows them. A secret can be up to 64 KiB.

When your user wants to give you a secret, ask them to run `asecret save NAME` in a terminal on this machine themselves. It asks for the value without showing it. Never ask them to paste a value into chat. If they paste one anyway, don't repeat it, and suggest they replace it at its provider and save the new one themselves.

## Use a secret

```sh
asecret run --secret OPENAI_API_KEY -- python agent.py
asecret run --secret GITHUB_TOKEN --secret NPM_TOKEN -- ./release.sh
asecret list
```

`run` decrypts each `--secret` and sets it, under its own name, in that command's environment alone, and prints nothing about it. `list` shows names only. Never print or paste a value: don't run `asecret get` unless your user asks to see a value themselves, and never echo a secret, log it, or write it into a file, a message or a command line. Watch the command you run too: one that prints its environment would print the secret. Run `asecret delete NAME --yes` only when your user asks.

## Use your user's detail

When a task needs your user's postal address, email, phone number or another of their details, for example to fill in a checkout form or call an API, ask to use it, and say why with `--for`:

```sh
asecret ask postal_address --use --for "fill in the delivery address at shop.example"
```

Show your user the printed address unchanged. They choose which detail to share, in their browser. It is encrypted to a key you made for this ask alone, so asecret.sh can't read it. If you aren't linked to them yet, the same address links you first, then the ask opens for them. The command waits for their answer; if it stops first, `asecret check <ask> --wait` picks it up. The detail is kept as one of your secrets, named after its type (POSTAL_ADDRESS, EMAIL, PHONE…) or `--as NAME`. Use it like any secret, from a script that reads the variables:

```sh
asecret run --secret POSTAL_ADDRESS -- node fill-checkout.js
```

The script gets the whole detail in POSTAL_ADDRESS (JSON for an address) and each part in POSTAL_ADDRESS_STREET, POSTAL_ADDRESS_CITY, POSTAL_ADDRESS_REGION, POSTAL_ADDRESS_POSTAL_CODE and POSTAL_ADDRESS_COUNTRY. Never `get` the detail, print it or paste it into chat. You can use `postal_address`, `email`, `phone`, `membership`, `secure_note`, `api_key`, `password`, `id_number` or `card`. A declined or expired ask ends that step: tell your user. Use the detail only for the reason you gave; it gives you no permission to sign in.

To pay for a purchase your user asked for, ask for a card and say exactly what you're buying, where and for how much:

```sh
asecret ask card --use --for "pay for order 1846 at shop.example, $42.00"
asecret run --secret CARD -- node pay.js
```

The script gets CARD_NAME, CARD_NUMBER, CARD_EXPIRY, CARD_CVC and CARD_POSTAL_CODE. A card is for one command: `run` deletes it right after. Pay only for what you named; for anything else, ask again.

## Link your user

When your user wants to see what you keep, or be able to recover it, run `asecret link` and show them the printed address and code unchanged. They open it signed in to asecret.sh, check the code and approve you there. The command waits until they decide; if it stops first, the code still works for 15 minutes. Once linked, they see you and how many secrets you keep, and can delete them, pause you, unlink you or erase you. Your secrets' names and values are encrypted with your key, so they see the names, and can reveal and recover the values, only with agent recovery on, one click at asecret.sh/recovery. You then give them your key, sealed so only they can open it, on your next asecret command. `asecret me` shows whether you are linked and whether recovery is on. Run `asecret unlink --yes` only when your user asks.

## Ask your user to save a detail

Once linked, you can ask your user to save one of their details in aSecret, without using it: `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.

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

Show the printed review link unchanged and say why the task needs the detail. You learn only that it's saved or ready, never the detail. Wait for `confirmed` before you continue the task. A declined, expired or canceled ask ends that step: tell your user and leave it pending. An ask waits 15 minutes, and while your user has paused you, you can't ask. Before linking, `asecret ask <type>` prints a public save page instead, which isn't tracked.

Payment methods and deliveries to merchants (`asecret ask payment_method`, `asecret ask address --to <recipient> --order <id>`) need your user's own aSecret server, one they run themselves. Link to it with `asecret link --server <origin>`; asks then go there. There your user can save a payment method with a participating merchant, which you never see. aSecret doesn't fill in forms in anyone's browser: your own script does, under `asecret run`.

## Setup

`asecret add` installs this skill for the agents on this machine. `asecret mcp` runs a local MCP server over stdio (`claude mcp add asecret -- asecret mcp`): `list_secrets` gives names only, `use_detail` and `check_detail` use a detail as above, and the other tools ask your user. No tool returns a value. `asecret mcp --print --host claude` prints a settings entry instead. Use `--json` when you need the exact fields. Set `ASECRET_CONFIG_DIR` for a separate agent on the same machine, `ASECRET_API_URL` for another aSecret server, or `ASECRET_TOKEN` to use an existing token.

[CLI](https://github.com/asecret-org/cli) · [Protocol](https://github.com/asecret-org/protocol) · [aFile](https://afile.sh)
