---
name: secretstore
description: Use API keys and other secrets from the owner's Secret Store on this Mac, with their approval, without putting them in files or the conversation. Use when a command or script needs a key, token or password.
---

# Secret Store

The owner keeps secrets in Secret Store, a Mac app. You can ask it for the ones they've
shared with you; each request shows them an approval prompt.

There are two ways in, and the owner may have set up either or both:

- **The `secretstore` command**, if `command -v secretstore` finds it. Check it works with
  `secretstore status`, which also names the client you're acting as.
- **The MCP server `secretstore`**, if its tools (`list_secrets`, `get_secret`, …) are
  available to you.

Use whichever is there. If neither is, tell the owner and point them to
https://coreydaley.dev/apps/secretstore/help/scripts-and-agents/ — don't look for secrets
anywhere else.

## Rules

- Never print, echo, log, commit or repeat a secret's value, in messages or files.
- Never write a value into a `.env` file or any other file.
- Prefer handing values straight to the command that needs them, so they never enter this
  conversation.
- Ask for one secret or one tag at a time. There's no way to get everything, by design.
- If the owner denies a request, don't retry it in a loop; ask them what they want.

## With the secretstore command

Run a command with a project's keys. The secrets under the tag become environment
variables for that command only, and stay out of this conversation:

    secretstore run --tag env/<project> -- <command> [args...]

Add `--only NAME,NAME` to pass just some of the variables.

- `secretstore list` — the names, tags and variable names you may use, as JSON. Never values.
- `secretstore get NAME [--tag TAG]` — prints one value. Only use it inside the command that
  needs the value, like `curl -H "Authorization: Bearer $(secretstore get API_KEY)" …`,
  never on its own, where the value would be printed into this conversation.

Errors come as a `secretstore:` message on stderr and a non-zero exit. Read the message: it
says what's wrong (locked, not approved, not shared, no such secret, more than one, busy).

## With the MCP tools

- `list_secrets` — names and tags you may use. Never values.
- `get_secret` — one value, after the owner approves. Pass it straight to the command that
  needs it.
- `add_secret` — store a key you just generated, after the owner approves. It won't
  overwrite an existing one.
- `list_metadata` — names, ids, tags, notes and kind of the secrets you may use, with a
  hint of what each value looks like. Never values. After the owner approves.
- `propose_changes` — one batch of renames, tags, notes and kinds for the owner to
  review. Nothing changes until they accept; `list_metadata` then shows the outcome.

If the `secretstore` command is there too, still prefer `secretstore run` for running
commands: `get_secret` puts the value in this conversation.

### Error codes

- `locked` — Secret Store is locked; ask the owner to unlock it.
- `denied` — the owner said no. Don't retry without asking.
- `forbidden` — not shared with you; the owner grants it in Secret Store ▸ Settings.
- `not_found`, `ambiguous` — check the name; add a tag to choose between twins.
- `busy` — another request is waiting for approval; wait, then try again.
- `unauthorized`, `disabled` — the token or the feature is off; tell the owner.
- `unsupported_change` — only names, tags, notes and kind can be proposed.

## Organising secrets

This needs the MCP tools. When the owner asks you to tidy their secrets, call
`list_metadata`, plan clear names and tags from the names, notes and hints, then send
everything as one `propose_changes` batch. Names, tags and notes you read leave the Mac
with you, so don't copy them anywhere else.
