# Reach

zn-gate reach shows what your coding agents can reach on this machine (names only, never values), with the command that fixes each finding. Read only.

Source: https://usezn.com/docs/zn-gate/reach/

`zn-gate reach` answers one question: what can the coding agents on this machine reach? It lists which agents zn protects, the names of the secrets in the `.env` files of a folder, the credential files in your home folder, the environment variables that hold a secret, and what `zn audit` finds in MCP servers and agent settings. Every finding comes with the command that fixes it.

```bash
npx -y zn-gate reach
```

Run it in the folder you work in. It sends nothing, starts no hook and changes nothing.

## What it checks

- **Agents:** Claude Code, Codex CLI, Cursor and OpenCode. It shows whether each one is on this machine and whether zn protects it for your user or only for one project. It uses the setup check of `zn-gate check` and does not start a hook.
- **`.env` files in the folder:** the names of their secrets, never the values. A file that is a link is not followed.
- **Credential files in your home folder,** such as `~/.aws/credentials`, SSH keys, `~/.npmrc` and `~/.kube/config`. zn only checks whether they exist. It never opens them.
- **Environment variables** whose name or value looks like a secret: names only.
- **MCP servers and agent settings** of this folder and of your user, with the same rules as `zn audit`.

## Example

On a machine where the three agents are protected, the report is short:

```
zn-gate reach: what can the coding agents on this machine reach?
Read: agent settings in your home folder and this folder, .env files here, names of environment variables. Nothing was sent anywhere.

AGENTS
  Claude Code  protected by zn (run `zn-gate check` to test it)
  Codex CLI    protected by zn (run `zn-gate check` to test it)
  Cursor       protected by zn (run `zn-gate check` to test it)
  OpenCode     not found on this machine

Nothing to fix. Your agents run with zn-gate.
```

When something needs attention, each finding has a severity, a short explanation and the command that fixes it. This is the real output of one run on a fake project (fake secrets and a fake AWS credentials file):

```
zn-gate reach: what can the coding agents on this machine reach?
Read: agent settings in your home folder and this folder, .env files here, names of environment variables. Nothing was sent anywhere.

AGENTS
  Claude Code  not protected
  Codex CLI    not found on this machine
  Cursor       not found on this machine
  OpenCode     not found on this machine
  HIGH   Claude Code is on this machine and zn does not protect it
         It can read any file and run any command you allow.
         Fix: npx -y zn-gate init

WHAT THEY CAN REACH (secrets and credential files an agent could read; names only, never values)
  HIGH   .env in this folder has 2 secrets (OPENAI_API_KEY, DATABASE_URL)
         Claude Code can read them today.
         Fix: npx -y zn-gate env shadow .env
  MEDIUM 1 credential file in your home folder (~/.aws/credentials)
         Claude Code can read them today.
         Fix: npx -y zn-gate init

NEXT: fix the high ones
  1. npx -y zn-gate init
  2. npx -y zn-gate env shadow .env

2 high, 1 medium, 0 low.
```

Severity depends on the setup. A `.env` file or credential file is **high** or **medium** when an agent on this machine is not protected yet. It is **low** when no agent is installed yet, and **information only** when zn protects every agent it finds. Environment variables are always **low**.

## Options

| Option | What it does |
| - | - |
| `[path]` | The folder to check. Default: the current folder |
| `--json` | The same report as JSON |
| `--sarif` | The report as SARIF 2.1.0, for code scanning. Findings about files of the checked folder are results (a `.env` with secrets an agent can read is `ZNR002`). Agents, credential files and environment variables are notifications of the run |
| `--fail-on high\|medium\|low\|none` | Exits 1 when a finding at or above that level is found. The default, `none`, keeps reach a report that exits 0. A usage error or a failure exits 2 |
| `--remember` | Keeps this run's counts (high, medium, low and the date) in `~/.zn/reach-last.json`, so the next run with `--remember` shows what they were. Without it, reach writes nothing |

## What it never does

- It never shows a secret value, and it never opens a credential file.
- It sends nothing over the network and starts no hook.
- It writes nothing, unless you pass `--remember`.

If the check runs out of time on a large folder, the report says that some files were not checked. `npx -y zn-gate audit --include-home` checks them all.

## Where it fits in the setup

1. `zn-gate reach` shows what your agents can reach today.
2. `npx -y zn-gate init` protects each agent. [Quickstart](https://usezn.com/docs/quickstart/)
3. `npx -y zn-gate check` tests that zn stops your agent from reading a test `.env` file. [Check](https://usezn.com/docs/check/)
4. `npx -y zn-gate env shadow .env` moves the plain-text secrets of a `.env` file into the local vault.

To fix a finding, run the command it shows. For agents that are not protected, that is `npx -y zn-gate init`. For environment variables, run `npx -y zn-gate secret set NAME` in your own terminal, then write `__ZN_NAME__` where the value goes.
