# Managed SSH (1Password), sending keys, and ${NAME} secrets

> Hand an API token or .env to an agent without pasting it into chat, keep workspace secrets safely in your OS secret store, reference ${NAME} variables in layouts, and gate SSH/Git signing through 1Password.

- **Category:** Setup and safety
- **Updated:** 2026-12-01
- **Reading time:** 8 min
- **Canonical page:** https://cmdbrief.com/guides/managed-ssh-and-secrets

## Quick verdict

- Click the **key button** beside any agent’s paperclip to send an API token, private key, or `.env` without pasting it into chat: the agent receives only the key name and reads it **once within 10 minutes** via a pane-bound one-read pipe.
- Use whole-value `${NAME}` references in workspace startup environments so secrets never sit in `layout.yaml`, and choose **Use once** or **Keep** (**Settings › Saved secrets**) for credentials stored in the macOS Keychain or private `0600` files.
- Turn on **Managed SSH** (off by default, macOS and Linux) to route Claude and Codex SSH and Git operations through your **1Password SSH agent** with per-request attribution, human **Allow / Deny**, and sanitized Git execution.

## What you get

- **You & local secret stores:** Key button beside paperclip (masked, Use once or Keep); 1Password SSH agent retains private keys; macOS Keychain / Linux 0600 files / Windows owner-only files
- **Agent pane (local or paired):** Sees only key name & id (never the value in chat or logs); One-time `cmdbrief_secret_take` within 10 minutes; Managed SSH/Git prompts you with reason & destination
- **You & local secret stores → Agent pane (local or paired):** one-read FIFO path or single signed request
- **Agent pane (local or paired) → You & local secret stores:** secret request (`cmdbrief_ask_secret`) or SSH reason
- **Connection:** Secrets stay on the host; cross-computer sends use the encrypted direct line only

Pasting an API token, `.env` file, or private key directly into an agent chat writes it into the prompt history, transcript files, and provider requests. CmdBrief replaces copy-paste secrets with three dedicated mechanisms — **Send a secret**, **`${NAME}` layout references**, and **Managed SSH** through 1Password — while keeping credentials strictly local to each machine. If you also register local or remote MCP servers, see [how to run an MCP server without Docker](https://cmdbrief.com/guides/how-to-run-mcp-without-docker) to keep credentials out of config files.

## Where CmdBrief stores secrets on Mac, Linux, and Windows

| Platform | Credential storage location | Important boundary |
| --- | --- | --- |
| macOS | **macOS Keychain** (`ee.cmdbrief.account`, `ee.cmdbrief.apikeys`, `ee.cmdbrief.local-access.*`, `ee.cmdbrief.saved-secrets.*`) | Authorization follows the app’s code-signing identity; MCP helpers never read the Keychain directly. |
| Linux | Private **`0600` files** inside `~/.local/share/CmdBrief/secrets/` (`0700` folder) | Any program running as the same Linux user can read those files. |
| Windows | Owner-only files inside `%USERPROFILE%\AppData\Local\CmdBrief\secrets` | Same-user boundary; Managed SSH is still marked **Coming soon** on Windows. |

*CmdBrief never copies CLI sign-ins (~/.claude, ~/.codex, etc.) or saved workspace secrets between computers.*

When you move a workspace to another computer, its saved secrets remain on the original computer; when you delete a workspace, CmdBrief removes that workspace’s saved secrets on that computer. See [Multiple CLI accounts and usage limits](https://cmdbrief.com/guides/multiple-accounts-and-usage-limits) and [Pair another Mac or Windows PC](https://cmdbrief.com/guides/pair-mac-and-windows) for how paired computers stay isolated.

## Send an API token or .env with the key button

**Step 1 of 3 · You do this** (Key button beside the paperclip in any agent pane)

1. Click the **key button** next to the paperclip in any Standard agent pane (including mirrored panes on a paired computer with full use, where values travel over the encrypted direct line).
2. Enter a name and paste a token, password, private key, or click **Choose file** to load a UTF-8 file such as `.env` (binary files are refused and the file path is not kept). Click **Add field** to send up to **8 named values** together (up to 64 KB per value, 128 KB total).
3. Masked fields display 12 dots regardless of length with copy/cut disabled; **Show** automatically re-masks after 30 seconds, when the window loses focus, or on Send. PEM and OpenSSH private keys preserve LF line endings and their final newline.
4. Pick **Use once** (held only in host memory for **10 minutes**) or **Keep** (saved for that workspace in the local secret store, up to 50 per workspace, manageable under **Settings › Saved secrets** with a per-secret **Ask each time** toggle), then click **Send**.

The agent receives only the key’s name, value names, and an ID — **the secret never appears in the chat transcript, logs, or tool results**. Within **10 minutes**, only a process the OS kernel ties to that exact pane and active session may call `cmdbrief_secret_take(id)` **once**:

- **One-read named pipe on macOS and Linux:** CmdBrief creates a mode `0600` FIFO under `<app support>/secret-drops/` (`0700`) that unlinks the instant one reader opens it (`TOKEN="$(cat <path>)"` or `ssh-add - < <path>`), and deletes it after 10 minutes if unread. (On Windows, CmdBrief creates an owner-only file removed after 10 minutes.)
- **Session-bound expiry:** if the pane closes, clears, hands off, or restarts before the secret is taken, the dropped secret is wiped immediately and the new session cannot take it.
- **Agent-initiated requests (`cmdbrief_ask_secret`):** leads and crew members can ask you for secrets via a masked card docked over the message box (foldable to one line so you can inspect the chat first). You can **Send**, **Decline**, or reply in words; chat apps and Voice show that a request waits but **cannot** view field names or submit secrets.
- **Workspace passwords too:** since v0.5.101 (see the [changelog](https://cmdbrief.com/changelog)), allowing `cmdbrief_reveal_workspace_password` also delivers the password through a one-read 10-minute private file instead of returning it inside a tool result.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Agent chat | Send a test token with **Use once** via the key button | The chat shows `You sent …` with the key name only (never the value), and the agent reads it once via `cmdbrief_secret_take`. |
| Settings › Saved secrets | Inspect a secret sent with **Keep** | Listed under its workspace with **Ask each time** and **Remove**; no raw value is printed. |

## Use ${NAME} references in workspace layouts

**Step 2 of 3 · You do this** (Workspace layout YAML and run target editor)

Startup environment entries in workspace layouts and run targets support whole-value `${NAME}` references. CmdBrief resolves each reference from its own environment when the pane launches so tokens never sit in `layout.yaml` or exported templates:

**Example run-target env block in layout.yaml**

```yaml
env:
  STRIPE_WEBHOOK_SECRET: "${STRIPE_WEBHOOK_SECRET}"
  POSTHOG_API_KEY: "${POSTHOG_API_KEY}"
  NODE_ENV: "development"
```

- The run-target editor flags secret-looking literal values so you can replace them with `${NAME}` before saving.
- Exporting a workspace layout prompts for confirmation before writing any literal secret-like value.
- If you run a headless Linux server, pipe connector, OpenRouter, or DeepSeek keys over stdin with `cmdbrief settings set <key>` instead of putting them in shell history (see the [CLI reference](https://cmdbrief.com/guides/cmdbrief-cli-reference)).

## Enable Managed SSH with the 1Password SSH agent

**Step 3 of 3 · You do this** (Settings › Coordination › Managed SSH)

**Managed SSH** is **off by default** and supports local panes on **macOS and Linux** (marked **Coming soon** on Windows). It attributes every agent SSH or Git signing request to its exact workspace, tab, pane, and stated reason before forwarding a single signature to 1Password.

1. Turn on the SSH agent in **1Password › Settings › Developer › SSH agent**. CmdBrief checks the socket at `~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock` on macOS or `~/.1password/agent.sock` on Linux (1Password’s Flatpak and Snap builds on Linux do not provide an SSH agent).
2. Open **Settings › Coordination › Managed SSH**, verify the socket check succeeds (CmdBrief checks reachability without requesting keys or signatures), turn **Managed SSH** on, and save.
3. **Start a new agent pane** after turning Managed SSH on — existing sessions do not gain the helper environment or routing hooks retroactively.
4. When a Claude or Codex agent runs SSH or Git (`fetch`, `pull`, `push`, `ls-remote`), its pre-tool hook routes covered commands through `$CMDBRIEF_SSH_HELPER` (`cmdbrief ssh` / `cmdbrief git`) or the local MCP tools (`cmdbrief_ssh_start`, `_status`, `_cancel`).
5. Review each signing dialog showing the pane, agent, workspace, resolved host, quoted command/Git args, reason, and key fingerprint. Click **Allow** for one request, **Deny** to stop it, or tick **Keep allowing** before **Allow** for a session-only, in-memory standing grant (revocable in the right sidebar’s SSH section; never persisted across restarts, and repositories outside the workspace always prompt).

**How agents invoke the Managed SSH helper**

```bash
cmdbrief ssh --reason "Check service status before proposing a restart" \
  -- deploy@staging.example 'systemctl status cmdbrief'

cmdbrief git --reason "Fetch the upstream branch before comparing changes" \
  -- fetch origin
```

- **No silent fallback:** if 1Password later becomes unavailable, Managed SSH stays on and reports the problem instead of falling back to ordinary SSH.
- **Stricter Managed Git:** runs `/usr/bin/git` in a private allow-listed folder so repository hooks, `core.sshCommand`, filters, and aliases cannot execute; stages new objects/refs privately and rejects symlinks inside `.git`, reftable repositories, and Git LFS pushes. `pull` fetches only and instructs the agent to merge locally without SSH.
- **Own-key hosts (`IdentityAgent none`):** hosts configured with `IdentityAgent none` in your `~/.ssh/config` (such as an internal dev or [Linux build box](https://cmdbrief.com/guides/linux-build-machine)) bypass Managed SSH and run directly — ignoring any caller-supplied `-o IdentityAgent=none` or `-i` flags — and are logged as **Direct** runs.
- **Expiry & audit trail:** pending signing requests expire after **10 minutes** (the top-bar **Needs you** button turns red at 2 minutes left, and an expired request leaves a pinned notice). The app-global **SSH access** pane keeps up to 500 metadata records for 7 days (`ssh-auth-history.json`).

> **Tip:** Managed SSH provides attribution and human review for agent-triggered SSH signing — it is not an OS sandbox against arbitrary processes running as your user. Pair it with [Claude Code sandboxing](https://cmdbrief.com/guides/claude-code-sandbox) and [worktree + dev-server guards](https://cmdbrief.com/guides/worktrees-heavy-jobs-and-dev-servers) for defense in depth, and see [Features](https://cmdbrief.com/features) for the full security model.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Your terminal | `ssh -G my-dev-box \| grep -i identityagent` | Shows `identityagent none` for hosts that should bypass 1Password and run directly. |
| Settings › Coordination › Managed SSH | Click **Open SSH access** after running one managed fetch | The operation appears under its workspace with decision, signature count, exit code, and duration. |

## If it fails

| What it says | Fix |
| --- | --- |
| Agent gets “That secret was already taken, its 10 minutes ran out, or the session it was sent to ended.” | **You:** Secrets sent via the key button are single-use and bound to the exact session for 10 minutes. Send it again from the key button (or approve a saved secret). |
| Pane header shows **SSH: restart agent** after enabling Managed SSH | Start a fresh pane and agent session so CmdBrief attaches the private `runtime/ssh-bin` helper and verifies the control-socket ancestry. |
| Settings › Coordination › Managed SSH cannot find 1Password on Linux | **You:** Confirm `~/.1password/agent.sock` exists and 1Password was installed from the native `.deb`/`.rpm` package — Flatpak and Snap builds of 1Password have no SSH agent. |
| Managed `git pull` exits 1 after fetching, or a push is refused for Git LFS | **You:** By design, Managed Git `pull` fetches only so the agent merges locally without SSH, and Git LFS pushes are refused before sending. Run LFS pushes yourself in a normal terminal. |
| An own-key dev host still triggers Managed SSH review | Remove caller overrides like `-i`, `-F`, `-o IdentityAgent=none`, or `GIT_SSH_COMMAND` from the command — only your `~/.ssh/config` `IdentityAgent none` makes a host direct. |
| Managed SSH toggle is dimmed on Windows | Managed SSH is still marked **Coming soon** on Windows; use Send a secret and `${NAME}` layout references there today. |

## Questions

### Can a crew member take a secret I sent to the lead pane?

No. `cmdbrief_secret_take` checks kernel process identity and live pane ancestry (`LOCAL_PEERPID` on macOS, `SO_PEERCRED` on Linux, and Windows process checks). Any other pane receives “That secret was sent to another agent.”

### Can I approve Managed SSH requests from Grok Bot or my phone?

Yes, for a single request only. With [Remote control](https://cmdbrief.com/guides/grok-bot-remote-control) on and reach over that workspace, a connected chat app (as well as a paired computer with **Full use** or your own Linux terminal outside CmdBrief’s cgroup via `cmdbrief answer host:ssh:... Allow`) can send a one-time **Allow** or **Deny**—never “Keep allowing”—and the request still hands off to 1Password on the host computer. CLI sign-ins, computer sign-in approvals, and secret asks (`cmdbrief_ask_secret`) can never be answered from a chat app.

### Does a cached 1Password approval bypass CmdBrief’s Managed SSH dialog?

No. Even if 1Password recently authorized a key, CmdBrief still gates every managed request until you click **Allow** (or grant an in-memory **Keep allowing** approval for that pane, destination, and key).

### What happens to a secret I sent with “Keep” when I delete the workspace?

Deleting the workspace removes its saved secrets from that computer’s secret store. You can also remove any saved secret individually under **Settings › Saved secrets**.

## Primary sources

Provider terms and product behavior can change. Confirm plan, pricing, model, and permission details in the current official documentation.

- [1Password Developer: SSH Agent](https://developer.1password.com/docs/ssh/agent/)
- [OpenSSH: ssh_config manual (IdentityAgent)](https://man.openbsd.org/ssh_config)
- [Apple Developer: Keychain Services](https://developer.apple.com/documentation/security/keychain-services)

## Keep reading

- Setup and safety: [CmdBrief CLI reference for headless Linux and terminal control](https://cmdbrief.com/guides/cmdbrief-cli-reference)
- Setup and safety: [Claude Code sandbox and permissions: how to run it safely](https://cmdbrief.com/guides/claude-code-sandbox)
- Setup and safety: [How to run an MCP server without Docker](https://cmdbrief.com/guides/how-to-run-mcp-without-docker)
- Setup and safety: [Pair another Mac or Windows PC with CmdBrief](https://cmdbrief.com/guides/pair-mac-and-windows)
- Workflows: [Team dashboard, Daily goals, and Connectors](https://cmdbrief.com/guides/team-dashboard-and-connectors)

---

Markdown mirror of https://cmdbrief.com/guides/managed-ssh-and-secrets, generated at build time from the same data the HTML page renders. Machine-readable index: https://cmdbrief.com/llms.txt
