theuth
Reference

Secrets

The encrypted, versioned vault the agent uses by name but never reads — key storage, versions and restore, the secret placeholder, output scrubbing, masked entry on every surface, and the limits of the scheme.

The vault holds named, versioned secrets: provider API keys, web search keys, Slack tokens, and anything you add. The agent references a secret as {{secret:NAME}} in a tool argument; the harness substitutes the value when the tool runs and scrubs it from the result. No tool returns a value, and no model-facing surface ever shows one.

Storage and keys

ItemWhere
Vault<data_dir>/secrets.sqlite; each value is encrypted with XChaCha20-Poly1305 under the mesh key, with the row id as associated data
Mesh keyone key every engine paired into your mesh shares (an unpaired engine has one of its own), so a row written on one machine opens on all of them; stored in the vault's local metadata, encrypted under this engine's own key
Engine keythe OS keychain (service theuth, account secrets:<absolute data_dir>: macOS Keychain, Linux Secret Service, Windows Credential Manager) or <data_dir>/secrets.key (base64, mode 0600)

secrets.key_store in config.yaml chooses:

ValueBehaviour
auto (default)keychain when one answers; if the keychain backend is unavailable, fall back to secrets.key with the warning no keychain available: …; vault key in <data_dir>/secrets.key (mode 0600)
keychainkeychain only; fail if unavailable
filesecrets.key only; never touches the keychain

A corrupt keychain item (not 32 bytes) is a hard error, not a fallback. If the vault cannot be opened the harness still runs: the log says secrets vault unavailable: … and provider keys come from /login and the environment only. Losing the engine key (or the keychain item) loses every secret; back up secrets.sqlite together with secrets.key or the keychain item.

Two legacy inputs are migrated on open: a single-file secrets.vault is imported and renamed secrets.vault.migrated, and a flat credentials.yaml (name: value) is imported and deleted.

Names and versions

Names are [A-Za-z0-9_.-]{1,64}, case-sensitive. Names containing / are reserved for the harness's own rows (oauth/…, mesh/…, sandbox/…, share/…) and are never listed or expandable.

Reserved rows you may meet: mesh/… holds the mesh's own keys (including the key that identifies your mesh to the sharing edge, mesh/share_key), sandbox/<vm>/vnc a sandbox's VNC credential, and share/<domain>/<name>/tls the private key of a public share name (see Sharing). They replicate with the vault like any row. The shared browser profile (cookies and site storage) is not in the vault: it lives in its own <data_dir>/webprofile.sqlite, each row encrypted under the same mesh key.

Every write (set, a secret_request answer, secret_capture, restore) creates a new version; the five most recent versions are kept and older ones are deleted. Writing a value identical to the current one is a no-op. Restoring copies an older version to the top as a new version (source restore v<N>), so history is never rewritten. Deletion is hard: every version of the name is removed.

Expiry

The card a secret_request opens has an Expires control, default Never: In a number of minutes, hours or days, or On a local date and time; the card shows the absolute time it resolves to and refuses a past time or a zero amount. One expiry covers every value stored from the card. In the TUI the last step of the card takes 30m, 2h, 3d or YYYY-MM-DD HH:MM (local), empty for never, and echoes the absolute time. The agent may suggest one (expires); it only pre-fills the control.

The expiry belongs to the version that set it: a later plain write (/secrets replace, secret_capture, a restore, a secret_request answered without an expiry) clears it. From the expiry on, a placeholder for the name — :-1 included — fails the tool call with secret NAME expired at <local time>, and the engine deletes the name with every version (on start, and on a timer armed for the soonest expiry), replicates the deletion like /secrets rm, and logs the name only. secret_list, list_secrets (expires, RFC 3339), the desktop Secrets page and the TUI /secrets list show when a secret expires.

Names used by convention:

NameUsed for
anthropic, openai, gemini, together, fireworks, … (genai adapter names)provider API keys; the name is the adapter, not the catalog id (google/* models use gemini, togetherai/* use together, fireworks-ai/* use fireworks); a vault key beats /login, which beats the provider's env var
<gateway>the key of a named OpenAI-compatible gateway from providers.yaml
opencodethe built-in Zen provider (opencode/<model> ids); else OPENCODE_API_KEY. Not a gateway: /provider add opencode is refused
openrouter (or genai's open_router)the built-in OpenRouter provider (openrouter/<model> ids); else OPENROUTER_API_KEY / OPEN_ROUTER_API_KEY; agent.openrouter.* tunes headers and routing
bedrock_apia Bedrock bearer key (else BEDROCK_API_KEY / AWS_BEARER_TOKEN_BEDROCK); an explicit agent.aws_profile wins over it
firecrawl, brave, openserp, xai, githubweb search providers and GitHub search
slack_bot, slack_appSlack tokens written by t --slack-setup
telegram_botthe Telegram bot token written by t --telegram-setup or Settings › Channels › Telegram
mcp.server.tokenthe bearer token of theuth's own MCP server (Settings › MCP); rotating it mints a new one
a2a_<peer>_outbound, a2a_<peer>_inbound (any names you choose)A2A credentials referenced from a2a/peers.yaml

/model lists only providers that are "configured": a vault key, a gateway, a login, or the adapter's env var.

The placeholder

{{secret:NAME}}        current version
{{secret:NAME:-1}}     previous version, up to :-4

Placeholders are recognised in every string value of a tool's arguments, nested arrays and objects included (object keys are not expanded): a shell command, a header, a URL, file content, an MCP tool's field, a shell env map. Expansion happens inside the harness after the approval gate; the transcript, the approval card and the model see the placeholder only. An unknown name fails the call with unknown secret NAME; secret_list shows the names; a missing version with NAME has N versions; :-K does not exist.

Rules around the gate:

  • A call that mentions a placeholder is raised to at least ask, even for a read_only tool, unless approvals are off for the session or globally. deny stays deny.
  • Tools whose arguments are literal sources or queries do not expand placeholders at all: app, task_draft, agent_draft, search, code_*, project_profile, sandbox_*, secret_request, secret_request_form, desktop_handoff. An app source keeps {{secret:…}} literally and the bound tool resolves it when a button is pressed.
  • In the Python runtime, http_request accepts placeholders in headers only (http_request: secret placeholders are allowed in headers only), and cpython sensors refuse them.
  • MCP files expand {{secret:…}} in command, args, env, url and headers when a server connects; see MCP.
# the model writes this; you see exactly this in the approval card
curl -H "Authorization: Bearer {{secret:github}}" https://api.github.com/user

Scrubbing

After every tool call the harness replaces, in the text and structured output, every exact value and every standard-base64 encoding of every kept version of every secret with its placeholder ({{secret:NAME}}, or {{secret:NAME:-N}} for an older version). Shell job output is scrubbed per chunk while streaming and once more exactly over the whole render when the job ends; the command shown in job cards and terminal viewports is scrubbed too; so are Python runtime output, vision questions and sensor errors.

Values shorter than 8 characters are not scrubbed; secret_capture warns value shorter than 8 characters cannot be scrubbed from tool output when it stores one.

The model's tools

All five are read_only and none returns a value. They exist only while secrets.tools is true.

ToolDoes
secret_listnames, versions, notes, timestamps and expiries; empty vault: no secrets; the user adds them with /secrets add, Settings › Secrets or t --secret-set, or call secret_request
secret_request{name, note} or secret_request{title, fields: [{name, label, masked?, note?}]}, expires?asks you to type one value into a masked field, or up to 16 on one card (masked defaults to true; note becomes the secret's note, else the label); expires (30m, 2h, 3d, an ISO-8601 date or date-time) pre-fills the card's expiry. Receipt stored a v1, b v2 (plus ; expires <local time> when you set one), declined, no answer after N s (secrets.request_timeout_secs, 1800), or, when you waive the request, a note that no secret is coming and the agent should proceed without the named values and say what it could not do
secret_request_form{title, fields, expires?}older name for secret_request with title + fields; same card, same receipt
secret_capture{name, tool, args, pattern?, replace?}runs another tool quietly and stores its output (or the first match of pattern) as a secret without showing it to the model; refuses an existing name unless replace: true
secret_restore{name, back}makes version back (1–4) current as a new version

secrets.tools: false removes the tools and the prompt block, leaves {{secret:…}} literal and scrubs nothing; the vault, /secrets and the harness's own keys keep working.

Entering a secret

SurfaceHow
CLIt --secret-set NAME prompts twice without echo on a TTY (values differ on mismatch); from a pipe it reads the first line of stdin: printf %s "$KEY" | t --secret-set anthropic. --secret-note <text> attaches a note. t --secret-list prints key: keychain|file and one line per name with version count and note; t --secret-rm NAME deletes
TUI/secrets opens the menu (a add, r replace as a new version, h history and restore, d delete after typing the name); /secrets add [name], /secrets rm <name>, /secrets restore <name> [n] skip the menu. Values are typed into a •-masked field
DesktopSettings › Secrets with a password input (expiring secrets show expires in 3 h or the date); a secret_request from the agent appears as a card with a field per value and the Expires control
Desktop Inboxan open secret request is also an Inbox item; Dismiss waives it: nothing is stored, the request is not declined, and the agent is told to proceed without it
Slack, Signal, Telegrama secret_request posts a notice only; the value is never entered there, because it would sit in the channel's history
RPClist_secrets, set_secret, restore_secret, delete_secret, answer_secret(id, value, values, expires_ms?), secret_requests_list

The desktop header and /secrets title show which key store is in use (key: keychain or key: file).

Rotation

Rotation is a new version: t --secret-set NAME again, r in /secrets, or a secret_request. The previous value stays reachable as {{secret:NAME:-1}} during the switch and falls off after five newer versions. There is no command to rotate the engine key. Pairing a new engine into a mesh re-seals rows under a shared mesh key automatically. There is no export command: a backup is the secrets.sqlite file plus the engine key.

Vault-key rotation on unpair

Unpairing a machine (Settings › Network › ⋯ › Unpair…, or t mesh remove <id>) rotates the shared vault key:

  • The machines that stay get a new key and re-encrypt every secret with it.
  • A machine that is offline asks for the new key when it reconnects; its secrets never read blank meanwhile.
  • The old key is destroyed about 10 minutes after nothing uses it.
  • The removed machine keeps the old key and every secret it already had, and receives nothing written afterwards. Replace those secrets at their providers if it is lost; the Unpair dialog lists the names, plus OAuth sign-ins to redo.
  • A machine on an older theuth cannot read secrets after the rotation until it is upgraded.

Settings › Network › Advanced › Rotate vault key rotates without an unpair. A failed rotation keeps the old key and offers Retry.

Limitations

These follow from the design and are worth knowing before relying on the vault:

  • The destination sees the value. Scrubbing protects the transcript, not the world: a shell command receives the real value on its command line or environment, write_file with a placeholder writes the real value to disk, and an HTTP request sends it. The model can still direct a value somewhere observable; the approval prompt is your check.
  • Only exact and base64 forms are scrubbed. Hex, URL-encoding, reversed or split values pass through. A value split across two streaming chunks escapes the live scrub and is caught only by the final pass.
  • Short values are not scrubbed (fewer than 8 characters).
  • key_store: file leaves the engine key as a readable file beside the vault; anyone with your user account can decrypt it. Prefer the keychain.
  • Replication. Vault rows replicate between the engines of your mesh; concurrent writes to the same name on two engines resolve last-writer-wins.
  • Login grants are hidden rows. Provider /login tokens are stored as reserved oauth/<provider> rows of the same vault: never listed, never expandable by placeholder. Legacy <data_dir>/oauth/<provider>.json files are migrated in and renamed .migrated; MCP server tokens stay as files under oauth/mcp/.
  • A pairing string is a secret. Pairing a machine hands it the mesh key, so whoever completes a pairing can read every row. Pair only your own machines.
  • Unpairing does not take secrets back. A removed machine keeps what it already had; rotate at the provider.
  • Security: what is encrypted where, and what leaves your machine
  • Mesh: pairing, replication and the mesh key
  • Tools and permissions: the approval gate placeholders raise
  • MCP: placeholders in MCP server files

On this page