Agent Secret docs
Set up approved secret access for coding agents.
Install the local macOS app, connect either 1Password or Bitwarden Secrets Manager, keep references in project profiles, and validate requests without printing secret values.
Last updated: June 16, 2026
Start with the signed macOS release.
Homebrew installs the notarized app into /Applications
and links the bundled agent-secret command into
Homebrew's bin directory.
brew tap kovyrin/agent-secret https://github.com/kovyrin/agent-secret
brew install --cask agent-secret
agent-secret skill-install
agent-secret doctor
Run agent-secret doctor after install or upgrade. It
prepares the background helper if needed and checks the socket
directory, audit log, native approver, and 1Password desktop
integration without resolving any item references.
agent-secret install-cli also tries to refresh the
local background helper after repairing the command symlink.
Use op:// refs for desktop-backed secrets.
Agent Secret uses the 1Password desktop app SDK integration. In
1Password, open Settings -> Developer and enable
Integrate with other apps under
Integrate with the 1Password SDKs.
Reference shape
Use the same references 1Password copies for item fields:
op://Vault/Item/field. The reference stays in
config; the resolved value is delivered only after approval.
Account selection
If there is one usable desktop account, Agent Secret can infer
it. If multiple accounts make a request ambiguous, set
account in config or pass --account.
agent-secret exec --reason "Run Terraform plan" \
--secret CLOUDFLARE_API_TOKEN=op://Example/Cloudflare/token \
-- terraform plan
Agents can inspect item metadata without seeing values:
agent-secret item describe --format env-refs
"op://Example Infra/Database Credentials".
Use bws:// refs for Bitwarden secrets.
Bitwarden support uses the official Bitwarden-signed
bws CLI and a local macOS Keychain token alias. Agent
Secret v1 supports official Bitwarden cloud endpoints and looks
for bws at fixed common paths such as
/opt/homebrew/bin/bws and /usr/local/bin/bws.
agent-secret bitwarden secrets-manager token install --alias work
agent-secret bitwarden secrets-manager token status --alias work
The token install command uses hidden terminal input by default.
Use --from-stdin only for scripts that already hold
the token outside shell history.
Reference shape
Use bws://<secret-uuid> when a single source is
available, or bws://<source-alias>/<secret-uuid>
when multiple Bitwarden sources need disambiguation.
What "source" means
Source is Agent Secret terminology. For Bitwarden Secrets Manager, a source is a local config alias that points at one local token alias. It is not a Bitwarden UI object.
Commit references and request metadata, never values.
Put agent-secret.yml or .agent-secret.yml
at the project root. Profiles keep the reason, TTL, references,
and provider disambiguation in the repo so an agent can request a
known workflow without carrying raw credentials.
version: 1
default_profile: deploy
sources:
bitwarden:
work-secrets:
kind: secrets_manager
token_alias: work
profiles:
deploy:
account: Example Corp
reason: Deploy application
ttl: 10m
session:
bind: parent
secrets:
CLOUDFLARE_API_TOKEN: op://Example/Cloudflare/token
RELEASE_WEBHOOK:
ref: bws://5f3f59f6-cb33-4d7a-9f92-86f75b5ce4c1
source: work-secrets
With default_profile, running
agent-secret exec -- terraform plan from the project
directory uses that profile. Use --profile NAME when
a repo has multiple workflows.
Approve a bag once, then run bounded commands.
Sessions are for short workflows where an agent needs the same
approved set of references in different combinations. Agent
Secret stores values in background helper memory and returns a
public session ID for management plus a secret session token for
with-session calls from the same requester process
tree.
agent-secret session create \
--profile terraform-cloudflare \
--bind-parent \
--max-reads 3 \
--json=compact
agent-secret with-session astok_123 --only CLOUDFLARE_API_TOKEN -- terraform plan
agent-secret with-session astok_123 \
--only CLOUDFLARE_API_TOKEN,STATE_TOKEN \
-- terraform apply
agent-secret session list
agent-secret session destroy asid_123
session create can combine a project profile, env
files, and one-off --secret ALIAS=REF flags.
Use --json=compact when a shell wrapper needs one
JSON object on one line.
Keep the returned session_token for
with-session; use the returned or listed
session_id for inspection and cleanup.
session list never reveals session tokens.
with-session injects every approved alias by default,
or a per-command subset with --only. Unknown aliases
fail before the child command starts. Use sessions inside one
task shell, wrapper script, or agent process tree.
Session tokens are bound to the requester process tree by default.
Use --bind-parent when a wrapper creates the session
inside command substitution and later calls
with-session from the parent shell. Deeper wrappers
can use --bind-ancestor N up to 3;
Agent Secret accepts only ancestors of the current
agent-secret process, not arbitrary PIDs. When the
wrapper depth varies across accepted agents, repeat
--bind-ancestor-name NAME; it matches the nearest
eligible ancestor executable basename in the allowed set within
the current ancestry.
Profiles can set session.bind: parent,
session.bind: auto,
session.bind: { ancestor: N }, or
session.bind: { ancestor_name: NAME } /
session.bind: { ancestor_names: [NAME, ...] }. Session list
JSON includes non-secret binding metadata so process mismatch
failures are easier to debug.
Sessions end when TTL passes, the read count is exhausted,
session destroy succeeds, or the helper stops. V1
sessions do not expose raw socket reads or long-lived interactive
shells.
Check requests without leaking values.
Use --dry-run --json to inspect exactly what an agent
is about to ask for. Dry runs do not start the background helper,
prompt for approval, resolve secret values, or spawn the child
process.
agent-secret exec --dry-run --json --profile deploy -- terraform plan
For a live smoke test, print metadata only. Lengths and hashes are enough to prove delivery without exposing the secret:
agent-secret exec \
--reason "Bitwarden smoke test" \
--secret BITWARDEN_SMOKE=bws://work/00000000-0000-0000-0000-000000000000 \
-- python3 -c 'import os, hashlib; v=os.environ["BITWARDEN_SMOKE"].encode(); print(len(v), hashlib.sha256(v).hexdigest()[:12])'
Most failures are setup or trust state.
macOS says bws cannot be verified.
Use the official Bitwarden-signed binary. If you downloaded it
manually, clear Gatekeeper quarantine only after verifying the
source and checksum. Homebrew-installed bws under
/opt/homebrew/bin/bws avoids most path issues.
Bitwarden token reads require repair.
Reinstall the token alias with the currently installed
released CLI:
agent-secret bitwarden secrets-manager token install --alias work.
This refreshes the macOS Keychain access control for the app
bundle that will resolve the token.
Doctor reports an unexpected background helper.
Run agent-secret repair. Agent Secret refreshes
trusted old helpers automatically and refuses unexpected
socket owners without sending secrets.
Approval is denied because the computer is locked.
Agent Secret refuses to show native approval while the screen is locked. Unlock the Mac and rerun the command.
Short answers for common integration questions.
Does Agent Secret store raw secret values?
It does not write raw secret values to project files or audit logs. Reusable approvals may keep approved values in background helper memory until the TTL or use count expires, then they are cleared.
Can an approved child process leak a secret?
Yes. Agent Secret is an approval broker, not a sandbox. After approval, the child process receives the environment variable and can use or leak it like any other process with that value.
Why does 1Password use account while Bitwarden uses source?
A 1Password account is provider identity. A Bitwarden source is local Agent Secret routing metadata that selects a token alias. Both are shown only to make ambiguous references explicit.
Can I mix 1Password and Bitwarden in one profile?
Yes. Each secret reference keeps its own provider metadata, and approval, audit, reuse, and cache matching include that metadata.
How is Agent Secret different from Varlock?
Varlock is built for application environment configuration: schema, validation, type-safe environment access, provider plugins, encrypted local overrides, leak scanning, and runtime integrations. Agent Secret is narrower. It is a local approval broker for agent-run commands: an agent requests exact secret references for an exact command, you approve or deny that request locally, and approved values are injected only into the wrapped child process.
How is Agent Secret different from fnox?
fnox is a full secret manager for development, CI, and production. It supports encrypted secrets in Git, remote secret providers, shell integration, profiles, local sync, credential leases, and MCP access. Agent Secret deliberately avoids shell auto-loading and general secret management. It focuses on approval before resolution, exact command scope, short reuse windows, and value-free audit logs for coding-agent workflows.
Can I use Agent Secret with Varlock or fnox?
Yes. Use Varlock or fnox for application and team secret workflows when they fit your stack. Use Agent Secret for high-trust agent operations where you want explicit human approval before a specific command receives operational secrets.