---
title: Agent tools and containment
description: Every tool the Bridge agent can call, which run on your machine and which on the server, and the limits on what they can reach.
section: Agent
order: 70
---

A Bridge chat drives a model, and the model acts through tools. Some tools run
on the machine that holds the project folder, executed by the Bridge agent
there. Others run on the Bridge server and never touch a machine. This page
lists them and the boundaries around them.

Source: `packages/server/src/agent-loop/tools.ts` (the tool definitions),
`crates/agent/src/tools/` (execution on the machine),
`crates/agent/src/tools/denylist.rs` (the blocked paths),
`packages/shared/src/levels.ts` (who may do what).

## Tools that run on the machine

Executed by the Rust agent, inside the project's folder:

| tool | what it does | read-only |
| --- | --- | --- |
| `Read` | Read a UTF-8 text file, with an optional offset and limit. PNG, JPEG, GIF and WebP files (up to 5 MB, 8000px a side) come back as an image, which is shown to the model when it supports image input. An image over 1568px on a side reaches the model scaled down; a tall one (height over twice the width) as up to 4 overlapping tiles, top to bottom. A request carries at most the 20 most recent images | yes |
| `ReadDocument` | Read a PDF, Word, PowerPoint or spreadsheet as markdown | yes |
| `Grep` | ripgrep-backed content search, skipping dependencies and build output | yes |
| `Glob` | Find files by pattern, newest first | yes |
| `codebase_search` | Meaning search over a local index (see [Semantic search](/docs/semantic-search/)), falling back to keyword search | yes |
| `ReadLints` | Linter and type-checker diagnostics | yes |
| `Write` | Create or overwrite a file | no |
| `StrReplace` | Replace an exact string in an existing file | no |
| `Delete` | Delete a file | no |
| `Shell` | Run a command, in the foreground or background. Requires a plain-language description, shown as the step's title. A command still running after its wait keeps running, and writes its output to a log file in the scratch folder. With `root` (see [Other folders](#other-folders)) the command runs in another read/write folder, on whichever machine hosts it; `AwaitShell` and `KillShell` follow such a job to that machine | no |
| `AwaitShell` | Wait, for up to 30 minutes in one call, for a background command to exit, print a matching line, go quiet, or open a port; or watch a file another process writes. A message sent to the chat during the wait, or the card's **Stop waiting**, ends it early with reason `interrupted`; the job keeps running | no |
| `KillShell` | Stop a background command and everything it started | no |
| `ListShells` | List the chat's background commands | yes |

An agent tells the server which of these it supports when it connects, so a
server never offers a tool that an older agent cannot run.

### Other folders

A chat works in one folder by default: its workspace's home, or another of
the workspace's folders set to edit if it was started there. It can also reach
every other folder of its workspace, and folders attached to it, with the same
tools. Each file tool (`Read`, `ReadDocument`, `Grep`, `Glob`,
`codebase_search`, `ReadLints`, `Write`, `StrReplace`, `Delete`, `Shell`) takes
an optional `root` naming the folder; paths are then relative to it. Without
`root`, every tool acts on the chat's own folder.

- **Each tool lists only the folders it may act on.** The read tools list every
  folder. `Write`, `StrReplace` and `Delete` list read/write folders only, and
  only in modes that write. `Shell` lists the workspace's read/write folders
  (on any machine) and read/write folders attached to the chat on the chat's
  own machine. Plan and Ask mode's read-only `Shell` takes no `root`.
- **A read-only folder can be read and searched, never changed or run in.**
  Writing to one is refused before anything reaches its machine.
- **Instructions come from the home folder.** `AGENTS.md` (or `CLAUDE.md`) and
  skills are loaded from the workspace's home, wherever the chat runs. The
  model is told to Read another folder's `AGENTS.md` itself when it works
  there.
- **The `*_reference` tools are retired.** `read_reference`, `grep_reference`,
  `glob_reference`, `search_reference`, `write_reference` and `edit_reference`
  are no longer offered. A call to one from an older chat is answered with the
  ordinary tool and `root` to use instead.

The model names a folder by its machine and its path, never by a single name:

```json
{ "machine": "pibox-erik", "path": "/root" }
```

- **Both parts must match one folder.** If the machine is right but the path
  belongs to a different machine, the call is refused before anything runs, and
  the refusal lists every folder as a machine and path pair. A wrong guess fails
  visibly instead of running on the wrong machine.
- **The values come from a fixed list.** The tool schema lists this turn's
  machines and paths, so the model can't invent either.
- **The machine** is the short hostname. When two machines share one, Bridge
  uses the display name instead, then the machine id. The server-side Virtual
  Workspace is `bridge-server` with path `/`.
- **The path** can be written with `~` or a trailing slash.
- **Results** carry `folder: "machine:path"`, so the model can tell where each
  result came from.
- **Older single names still work** when they pick out exactly one folder. That
  covers chats from before this change and files attached in the browser. A
  name shared by several folders, such as `root` on three machines, is refused
  with the list.

## Tools that run on the server

These need no machine and work while the agent is offline. None of them reach
your files except `SaveToProject`, which copies into the project folder through
the agent.

| tool | what it does | read-only |
| --- | --- | --- |
| `WebSearch` | Web search (needs a Brave Search key or a Bridge token plan) | yes |
| `WebFetch` | Fetch a public web page as markdown; see [WebFetch](#webfetch) | yes |
| `ViewImage` | Attach an image this chat already saw again, by the id in the line that replaced it once the request passed 20 images (a stored image URL or an attachment id). Resolves only images from the same chat | yes |
| `GenerateImage` | Generate an image into the server's own store, or edit one passed in `reference_images` (a generated-image URL or an attachment id from this chat). Draws with a Gemini key, an OpenAI key or the Bridge router, per Settings > Providers & Models > Image generation. GPT models on the Responses wire get OpenAI's hosted `image_generation` tool instead, which edits its own earlier pictures | yes |
| `SaveToProject` | Copy a generated image or an attached file into the project | no |
| `CreateProjectApiKey` | Give the project's own code a capped Bridge API key, written to its env file (see [The Bridge API](/docs/api/#project-keys)). Offered only with the `project-api-keys` flag on, a Bridge account connected and the machine online | no |
| `ReadBridgeReference` | Bridge's built-in guide to itself and a troubleshooting playbook, one static markdown document compiled into the server (`packages/server/src/agent-loop/bridgeReference.md`). `query` returns the "How to use this guide" section, the `##`/`###` sections that match by keyword, and a contents list with section ids; `sections` returns sections by id; `all: true`, or no arguments, returns the whole guide. Every system prompt carries a two-sentence pointer to it (the `bridge_reference` aspect) | yes |
| `SearchChats`, `ReadChat` | Search and read chats the user can open. `ReadChat` keeps the newest messages when a transcript is too long and pages back with `before_index`; `final: true` returns only the closing reply; `tools: "summary"` adds a line per tool call | yes |
| `SearchIssues`, `ReadIssues`, `ManageIssues` | Read and write the project's issues | `Manage*` no |
| `ReadChangelog`, `ManageChangelog` | See and close other chats' in-flight work. `ManageChangelog` action `report` gives the status of the chat's own plan build: `done` closes it, `still_building` (with a `reason`) keeps it open, `not_built` removes it. When a plan-build turn ends cleanly with todos still open and no report, a hidden end-of-turn request (fragment `note.changelog_review`) asks for one | `Manage*` no |
| `ManageTasks` | Scheduled tasks; anything it creates starts disabled. `tag_with_name` (default on) tags each run's chat with the task's name | no |
| `ReadCallSession`, `ReadCallTranscript`, `SearchCalls` | Voice call diagnostics and transcripts | yes |
| `Worktree` | Work in its own git worktree of the chat's workspace: `start` (create on a new branch, run setup, move the chat in), `status`, `finish` (commit, run checks, merge into the workspace's branch, move the chat back, remove the worktree), `abandon`. Offered only where the workspace allows agent worktrees; see [Agent worktrees](#agent-worktrees) | no |
| `Task` | A nested, read-only subagent for research. `speed: fast\|standard` picks a class of model; `model` names one (an id or a family such as `claude-sonnet`) from the MODELS list, inside the project's allowlist | yes |

### WebFetch

`WebFetch` reads a page from the Bridge server, not from the person's machine.

- **Requests look like a browser's.** It sends the header set desktop Chrome
  sends, keeps cookies for that one call (its redirects and one retry, never
  longer), and reads the body as a stream, capped at 5 MB.
- **Pages come back as markdown** with absolute links and without navigation,
  footers, scripts or hidden elements. schema.org product data goes first.
  Amazon product and search pages lead with a summary: price, rating, key
  facts, reviews on the page, one line per search result.
- **Long pages are paged.** Each call returns up to 40,000 characters. When the
  result has `nextOffset`, the same URL with `offset` reads on from a copy kept
  for 10 minutes.
- **Robot checks are not successes.** A challenge page (Amazon's, Cloudflare's,
  DataDome, PerimeterX, Imperva), HTTP 403/429/503, or a redirect to a sign-in
  page is retried once, then returned as a `Blocked:` error. Amazon serves its
  robot check with HTTP 200, which is why the status alone is not enough. The
  error says what to do next: use the browser tools when the turn has
  [Bridge for Chrome](https://bridgedesktop.com/chrome-extension/), otherwise
  tell the person about the extension. A turn without the browser tools also gets the `note.webfetch_blocked`
  prompt fragment, which admins can reword or switch off.
- **Private addresses are refused.** Loopback, RFC 1918, link-local (cloud
  metadata), CGNAT and tailnet (`100.64.0.0/10`, `fd7a:115c:a1e0::/48`), and
  `.localhost`, `.internal` and `.ts.net` names are refused, as is a name with
  any private record, and every redirect hop is checked again. Use `Shell` or
  `Screenshot` to reach a dev server.
- **Binary files** (PDFs, images, archives) are refused with a pointer to
  downloading them and opening them with `ReadDocument`.

A turn that can delegate (offered `Task`, or `StartChats` in a coordinator) also
gets a **MODELS** note listing the models delegated work may use: the project's
allowlist, or the org's model list, with family names and prices. Admins can
reword or switch it off as the `note.models` prompt fragment.

Control tools such as `AskQuestion`, `CreatePlan`, `UpdatePlan`, `TodoWrite` and
`SwitchMode` drive the interface rather than doing work.

`SwitchMode` from agent mode into plan, ask or brainstorm applies immediately.
Those modes only remove tools, so the turn ends and a new one continues in the
new mode. Every other switch, including any switch into agent, is a proposal
that waits for a person to approve it on a card.

`CreatePlan` takes a `name`, a human-readable `overview`, the markdown `plan`
body and technical `todos`. It also takes the plan card's summary fields:

- `highlights`: 2-4 plain-language outcomes.
- `size`: `S`, `M`, `L` or `XL`.
- `areas`: any of `frontend`, `backend`, `database`, `api`, `infra`,
  `mobile`, `desktop`, `docs` and `tests`.
- `risk`: `low`, `medium` or `high`.

The server reads loose values ("small", "Front-end") and drops the ones it
can't read, so an odd value never refuses a plan. The card shows the size in
its corner, a medium or high risk as a yellow line at the top of the card
(with `risk_reason`), the areas and an approximate file count as chips, and
the highlights under the overview. The todos are folded behind "N steps".
`UpdatePlan` accepts the same four fields as optional overrides.

`UpdatePlan` (plan mode) revises the chat's current plan with find/replace
`edits` to its body, plus optional `name`, `overview`, `todos` (upsert by id),
`remove_todos` and `replace_todos`. Each `old_string` must match exactly once
unless `replace_all` is set, and a batch with any failing edit applies nothing.
A draft is rewritten in place, in the same file and on the same card, and its
revision goes up. A plan that is already approved or superseded gets the edits
as a new `plan-N` version instead. A call with no changes re-presents the plan
unchanged. Like `CreatePlan`, it ends the turn.

`RequestWorkspace` is offered only in a project with more than one workspace. It
proposes moving the chat to another of the project's folders (`switch`) or lending
one to the chat read-only (`attach`). Both put a card in front of a person and end
the turn, and nothing changes until someone with the access approves. Approval
runs the same checks as moving the chat or attaching a reference folder by hand.
The approver can pick a different workspace on the card than the one proposed;
the agent is then told which one was used instead.
`detach` drops a lent folder immediately.

### Browser tools (Bridge for Chrome)

When the turn's person runs Bridge for
Chrome, paired and connected **on a computer the chat's workspace spans** (the
chat's own folder's computer is preferred), a chat also gets tools that act in
that person's Chrome. A chat whose workspace is only on their other computers,
on someone else's computers, or on the Bridge server gets none (the prompt and
any refused call say why), and switching a chat to another workspace drops the
old browser mid-chat. The workspace pill shows a globe when the chat's
workspace has the person's browser connected. The one exception is the person's own choice: a chat they drive from
a browser's side panel uses that browser while the chat stays on the workspace
it was on. They never use anyone else's browser, and they are not offered to
guests or subagents. Each runs in the chat's own tab group, titled Bridge: the
tab the chat started in and the tabs opened from it.

| tool | what it does | plan / ask |
| --- | --- | --- |
| `computer` | Mouse, keyboard and looking: `left_click`, `right_click`, `double_click`, `triple_click`, `type`, `key`, `scroll`, `scroll_to`, `hover`, `left_click_drag`, `screenshot`, `zoom`, `wait`. Coordinates are in the latest screenshot's pixels; a `ref` from `read_page` or `find` also works | looking actions only |
| `read_page` | The page as an outline of elements with refs (`filter: interactive` for controls only) | yes |
| `find` | Elements matching a description, ranked by a fast model | yes |
| `form_input` | Set a field, select, checkbox or radio by ref | no |
| `get_page_text` | The page's readable text | yes |
| `save_secret` | Copy a key or token from an element into a workspace file (`env_var` sets it in a dotenv file, default `.env`; otherwise `path` gets the bare value) without the model seeing it. The file is added to `.gitignore` | no |
| `navigate` | Open a URL, or go back or forward | yes |
| `javascript_tool` | Run a script in the page; values that look like secrets come back blocked | no |
| `read_console_messages`, `read_network_requests` | The page's console and request log (URLs only, secrets redacted) | yes |
| `resize_window` | Resize the tab's window | no |
| `tabs_context`, `tabs_create`, `tabs_close` | The chat's tabs | `tabs_context` only |
| `tabs_offer_close` | Leave a **Close tabs** button in the chat; pressing it closes the chat's whole tab group without involving the model (extension 1.2.2+) | yes |
| `upload_image`, `file_upload` | Put a chat image or attachment onto a file input or drop zone | no |
| `gif_creator` | Record the chat's actions and export a GIF to the chat, or Downloads | no |
| `update_plan` | Propose the sites and steps; approving it lets the turn act on those sites | no |
| `browser_batch` | Several actions in one call, stopping at the first failure | no |
| `shortcuts_list`, `shortcuts_execute` | The project's skills, run as browser workflows | `shortcuts_list` only |

Each chat has a browser setting: **Ask before acting** (default; the plan is
approved first), **Ask on every site**, or **Act without asking** (stored only
after its warning is accepted). An action the browser has not been allowed to
take puts a card on the call (*Allow this action*, *Always allow on* the site,
*Decline*); only the browser's person may allow it. Browser pages, the Web Store
and sites in the organisation's blocked list (Settings, owners and admins) are
refused in every mode. Screenshots are stored like generated images and shown
in the chat; they are never sent as text.

**Secrets on pages.** `read_page`, `find` and `get_page_text` hide values that
look like API keys or tokens (known prefixes such as `sk-`, `AIza`, `ghp_`,
JWTs and private keys, long random-looking strings, and the value of any field
named like a key or token) as `[secret hidden: N chars]`, and the server
redacts key-shaped text in every browser tool's output as a second pass. A call
can pass `show_secrets: true` to read the value anyway; its step line then
says "(secrets shown)". To put a key from a dashboard into the project, the
model uses `save_secret` with the element's ref: the extension reads the value,
the server writes it into the chat's workspace, and the model only learns the
file, variable name and length. Screenshots are not masked, so the model is
told not to take them of pages that show a key. Needs Bridge for Chrome 1.2.0.
When the server knows the browser runs an older extension, it refuses the call
before the browser sees it; either way the model gets a message that names the
tool and asks the person to update Bridge for Chrome, never the extension's raw
"does not support" error. The per-tool minimums are in
`packages/server/src/browser/extensionVersions.ts`.

Bridge for Chrome 1.5 also adds a right-click item for people, not for chats:
**Add this page to a Bridge Vault entry**. It sends only the page's address
and title to Bridge Vault on the same computer, through the Bridge app (no
server involved). Bridge Vault shows the address with the registered domain
picked out, suggests matching entries, and asks a second time before adding
the page to an entry for another site.

### Computer use (`Desktop`, macOS)

`Desktop` sees the whole screen of the Mac a chat's workspace is on and, where
allowed, uses its mouse and keyboard. It is a server tool: the server decides
whether the call may run, the agent carries it to a separate helper app,
**Bridge Computer Use**, and only the helper holds macOS Screen Recording and
Accessibility. `Shell` commands never get those permissions.

| action | needs |
| --- | --- |
| `screenshot`, `zoom`, `list_displays`, `list_windows`, `wait` | see |
| `left_click`, `right_click`, `middle_click`, `double_click`, `triple_click`, `left_click_drag`, `mouse_move`, `scroll`, `type`, `paste`, `key`, `activate`, `open`, `window` | control |

What the actions added in Bridge 0.1.68 do (an older Mac answers that Bridge
needs updating):

| action or option | what it does |
| --- | --- |
| `type` | One key per character on the key that makes it in the current layout, so browsers and Electron apps (1Password, Bitwarden) get every character, URLs with `#`, `?` and `=` included. At most 2,000 characters; it stops early when the person touches the keyboard or mouse. |
| `paste` | Puts `text` on the clipboard, presses cmd+v, then restores what was on the clipboard. Marked transient and concealed, so clipboard managers skip it. |
| `list_windows` | On-screen windows front to back: `window` id, app, bundle id, title, frame in screenshot pixels and size in points. Optional `app` filter. |
| `activate` | Brings `app` (a name or bundle id) to the front, starting it if it is installed. |
| `open` | Opens `url`, optionally in `app`. Never a file. |
| `window` | `op` `focus`, `move` (`coordinate`, the new top-left), `resize` (`size` in points), `minimize`, `restore`, on a `window` id or on `app`'s main window. The result has the frame the app accepted. |
| `window` on screenshot, zoom, clicks, drag, scroll, move | The frame is that one window: a screenshot shows only it, and coordinates are in its picture. |
| `scale` (screenshot) | 0.25 to 1 of the usual size. Later clicks in that frame use the same scale. |
| `park_pointer` (screenshot) | Moves the pointer off the frame first, because some apps show a password under the pointer. Needs control. |
| `save_to` (screenshot) | Also writes the PNG on the Mac. It must be an absolute `.png` path under the home folder, and outside every folder Bridge shares from that Mac. |
| `screenshot_after` (any control action) | Returns a screenshot in the same call: `{}` for the action's frame, or `{ settle, window, display, scale, park_pointer }`. |

Every result names the `frontmost` app and window and the `focused` element,
with `secure: true` for a password field. When a password field has focus,
`type` and `paste` wait on a card: the machine's owner or a co-owner allows it
once or for the rest of the chat, or denies it. **Revoke** clears the chat's
allowance too. An unknown argument is an error, never silently ignored.

Three switches decide the level; the lowest wins. The chat grant is off in
every chat until someone gives one:

| switch | who changes it | values |
| --- | --- | --- |
| **Computer use** in Settings > Server (`org_settings` key `computer_use.allowed`) | an owner or admin | Allowed (default), Off |
| Chat grant (the setup card, or **Computer use** in the prompt box's workspace menu) | the owner or a co-owner of the chat's Mac only | see or control, for 15 min, 1 h, 3 h or 6 h; any editor can turn it off |
| **Computer use** in the Mac's Bridge menu | the person at the Mac | Off, See the screen, See and control |

There is no workspace setting. Until November 2026 a workspace could allow a
level in every chat (`workspaces.computer_use`); that column is no longer read,
and a PATCH that sends `computerUse` is refused.

A grant always has an end (`chats.computer_use_expires_at`). When it ends
while a turn runs, that turn keeps it until it finishes, but never past 6
hours from when it was given; the next turn asks again. A grant from before
this change with no end counts as ended. A grant is tied to the machine it was
given on, so a chat that moves asks again. `GET /api/chats/:id/computer-use`
returns the grant and the time left; `PUT` with `{ level, minutes }` turns it
on or extends it (from now), for the machine's owner or a co-owner; `DELETE`
turns it off.

When a call has to ask, the model can add `access_minutes` (15 to 360) and
`access_reason` (at most 200 characters). The card shows both and selects
that time; the owner can choose another. Every successful result carries
`access: { level, endsAt, minutesLeft, heldForTurn }`, so the model knows how
long it has.

The tool is offered in every chat on a Mac that may use it. A call with any
switch off shows a setup card in the chat: the three steps, who can change each,
inline buttons for the people who can, **Ask** (an Activity row, push and
desktop notification, type `computer_use_request`) for everyone else, and
steps for the person at the Mac. The call waits, up to 10 minutes, and runs as
soon as the last switch is on; the model is told not to explain the switches
itself. The server re-checks every call, so a revoke or a change applies to
the next one. The helper enforces the Mac's own switch whatever the server sends, and
accepts connections only from the Bridge agent binary. Plan and ask modes only
look; brainstorm, guests and subagents never get the tool. While an agent
controls the Mac, a notice with **Stop** shows on screen; Stop drops the Mac
to See the screen. Input the person makes pauses agent input for 1.5 s, and
those calls fail with "paused". Bridge Vault windows are left out of every
screenshot. Screenshots are stored like generated images; they are not
masked. Without the tool, the prompt on a Mac tells the model not to capture
the screen or drive apps through `Shell`.

### Filling a saved login (`VaultCredential`, macOS)

`VaultCredential` fills a saved username, password or one-time code from the
person's Bridge Vault into an app on their own Mac, without the model, the
server or the agent ever holding the value. The model first uses `Desktop` to
bring the app forward and click the field, then calls `VaultCredential` with
the site, the field (`username`, `password` or `totp`), the frontmost app and a
one-sentence purpose. Bridge Vault on that Mac shows the request with the
chat's name; the person picks the login and confirms with Touch ID, and Bridge
Vault brings the named app forward and pastes the value itself (a concealed
clipboard entry, put back at once). The tool result says only whether it was
filled.

- **Offered** only in agent mode, in a chat whose workspace is on a Mac that
  the person running the turn owns, with the Vault flag on for them and an
  agent that declares `vaultFill`.
- **`sensitive`** marks a step that moves money, deletes something or changes
  account security. It is never filled without Touch ID, and in a shared vault
  the person confirms it a second time.
- **Allow for 15 minutes** lets the same chat fill the same login again
  without asking (never a sensitive step). Bridge Vault keeps these in memory
  only; **Settings > Agent access** lists and revokes them.
- **Records.** Each fill is logged in the account's encrypted settings (chat,
  site, field, app, item, device; never the value) and, in a shared vault, in
  the device's audit record that every member sees.
- Bridge Vault needs macOS Accessibility permission to paste into other apps.
  The request waits about three minutes for the person.

#### In the browser (Bridge for Chrome 1.6)

With `target: "browser"`, Bridge Vault works in one of the chat's own Chrome
tabs on the same Mac, through the agent and Bridge for Chrome. The model gives
element refs from `read_page` or `find`; Bridge Vault asks Chrome for the tab's
real address (never the site the model named), acts only on https, and only
with an entry whose websites match that address. The extension refuses if the
tab moved to another host first. The result never holds a value.

| `action` | What Bridge Vault does |
| --- | --- |
| `fill` | Fills a saved login into `usernameRef` / `passwordRef` (or `ref` + `field`). |
| `generate` | Makes a password, saves the login (with `username`) **before** filling `passwordRef`, `confirmRef` and `usernameRef`. |
| `save_login` | Reads what is typed in `usernameRef` / `passwordRef` and saves or updates the login. |
| `save_key` | Reads the key shown in `ref` and saves it as a named key (`keyName`, `keyVar`) on the provider's entry. Use it instead of `save_secret` on a provider site. |
| `fill_card` | Fills one part of the card for this site (`cardPart`) into `ref`, or into the focused field, which must be the page's site or a known payment provider's frame. |
| `new_card` | Makes a Ramp virtual card for the provider with a spending limit (`limitCents`, `interval`) and saves it to the Wallet vault. One per provider. |
| `session` | Asks once for a session: `sites` (registered domains), `actions` (`fill`, `create`, `keys`, `cards`, `new_cards`) and `hours` (1-24, or 0 for until revoked). |

- **Approval.** Each request waits in Bridge Vault for the person: Touch ID
  for anything that puts a secret or a card on a page, spends money, or opens
  a session. A session approval answers covered requests by itself, at most
  60 a minute, never a `sensitive` step, and only for that chat. Approvals are
  in memory: quitting Bridge Vault ends them, a screen lock or sleep pauses
  them, and **Settings > Bridge Vault in the browser** revokes them.
- **Logins typed in Chrome.** When a login form is sent in a chat's tab,
  Bridge for Chrome hands it to Bridge Vault, which offers **Save** or
  **Update** (or saves it under a session that allows `create`).
- **Who may move values.** The agent's local socket answers these routes only
  for Bridge Vault (checked by code signature, team and identifier) and sends
  values only to a native host started by a browser signed by Google, Brave or
  Microsoft. A chat's Shell, which runs as the same OS user, is refused.
- **Needs** an agent that declares `vaultBrowser` and Bridge for Chrome 1.6 or
  later. Ramp needs a developer app connected in Bridge Vault Settings (scopes
  `cards:read_vault`, `limits:write`, `funds:read`, `funds:write`,
  `users:read`); full card numbers in production need Ramp's approval.

### Agent worktrees

`Worktree` lets a chat branch off, work and test in isolation, and bring the
work home, with or without a person reviewing the merge. Each workspace's card
on the project's Workspaces tab has a three-way setting. A new workspace starts
with the project's **Workspace default settings** (top of the same tab), which
are "Ask before merging" until a project admin changes them:

| setting | effect |
| --- | --- |
| Off | the tool is not offered |
| Ask before merging (default) | `start` and `status` run freely. `finish` commits what is left and ends the turn; the chat shows "Branch awaiting review" with a card listing the commits and diffstat. There is no timeout. Merge records an approval for that exact head commit and starts a turn whose `finish` runs the checks and merges; a branch that moved since is asked about again. Discard removes the worktree (uncommitted changes included) and keeps the branch. Both are for workspace owners, project admins and editors on the workspace |
| Merge without asking | `finish` merges once the checks pass, with no card |

`start` runs `git worktree add` into `<repo>-worktrees/<branch>` beside the
repo. The worktree is a child of the workspace, as with **New worktree** in the
workspace menu. Then the chat is moved into it mid-turn, so relative paths,
the file tools and `Shell` all run there.

`finish` takes these steps in order:

1. Commit any uncommitted changes, which needs `commit_message`.
2. Run the project's checks.
3. Merge the branch.
4. Move the chat back to the workspace's folder.
5. Remove the worktree.

The built-in merge rebases the branch onto the main checkout's current branch
and fast-forwards that branch. It never makes a merge commit, never forces and
never pushes. Merges into one repository run one at a time.

If a check fails or the rebase conflicts, nothing is merged and the chat stays
in the worktree. The result names the problem, and the agent fixes it and
calls `finish` again. A chat with "Ask me before each command" still gets a
card for every command the tool runs.

Under any setting, a turn that ends while its chat is in a worktree whose
branch is ahead of its base, or has uncommitted changes, reports the chat as
"Branch awaiting review" rather than finished. It also skips the issue
close-out suggestion until the branch has landed. The status clears when the
branch is merged or discarded, the worktree is removed, or the chat is moved to
another folder. `abandon` with uncommitted changes under "Ask before merging"
still waits on a card mid-turn.

A project can describe setup, checks and its own land command in a committed
`.bridge/worktrees.json`. It is read from the workspace's own checkout, never
from the worktree being merged:

```json
{
  "version": 1,
  "setup": ["pnpm install --prefer-offline --frozen-lockfile"],
  "check": ["pnpm typecheck"],
  "land": "pnpm land",
  "deleteBranchAfterMerge": true
}
```

All keys are optional. `land` replaces the built-in merge with a command run in
the worktree, which must bring the branch home itself. `deleteBranchAfterMerge`
(default true) uses `git branch -d`, which keeps a branch that is not merged.

In coordinator mode, `StartChats` takes `worktree: "<branch>"` to start a child
directly in its own worktree, and the child merges its branch back with
`Worktree finish`.

The agent's `worktreeMerge` capability is required.

### Coordinator tools

A chat in **coordinator** mode also gets:

| tool | what it does |
| --- | --- |
| `CoordinatorSetup` | Ask a person how many children may run at once, which other machines children may use, and which models besides the coordinator's own (`models`), and optionally permission to rewrite children's system prompts (`systemPrompts`, a tick that starts unticked). Ends the turn on a card; nothing can be started until it is approved. Calling it again asks for more. |
| `StartChats` | Start child chats, each with its own mode (agent, plan, ask, brainstorm, debug), the coordinator's own model or one approved on the setup card (an id or a family), and an approved machine. `worktree` starts the child in its own git worktree (see [Agent worktrees](#agent-worktrees)). A model that was not approved is refused. Children past the parallel limit wait for a free slot. `systemPrompt` rewrites, disables or resets aspects of the child's system prompt; it needs the setup grant, and the child is held, uncreated, on a review card showing each change as a diff until a person approves. That call ends the turn. |
| `SendToChat` | Message a child: a follow-up, or the answer to its open question. If the question has already been answered, an answer sent as one is refused. Sending to an archived child un-archives it, and it continues with its context intact. `systemPrompt` works as on `StartChats`: the message is held on a review card until a person approves. |
| `ChildPrompt` | The system-prompt aspects an existing child has, or a new child in a mode would get: key, label, full text, whether it is on, whether the org locked it, and which layer the text comes from. |
| `ManageChildChat` | Approve a child's plan (it still goes through the build queue), accept or decline its mode switch, stop it, or archive it. Archiving releases the child's file claims but keeps it reusable. |
| `ChildStatus` | Every child's state, cost, archived flag and context size, or one child's full report and changed files. |

A chat a coordinator started gets `ReportToCoordinator`, which hands a
structured report back. Every action on a child runs as the person who approved
the setup card, with their access. Allow/Deny prompts, moving a child to another
machine, and named plan sign-offs always go to a person. The coordinator is
woken when a child finishes or needs something; it never waits inside a tool
call. When a child asks a question, the coordinator either answers it or
passes it to the user with `AskQuestion` and relays the answer. While it waits
on the user, updates about its children are held back and delivered after the
user answers.

## Modes

Each chat has a mode, and the mode decides which tools exist at all:

- **plan** and **ask**: only the read-only tools, plus `Shell` in a checked
  read-only form whose every command is reviewed before it runs. A write tool
  is refused when it executes, not merely left off the list. The check runs in
  four stages:
  - a strict parser refuses anything whose effect can't be read off the text;
  - an allowlist runs plain reads (`git log`, `rg`, `sqlite3 -readonly`)
    inside the project straight away;
  - Jev flags anything that might write, change state or send data;
  - a reviewer model (Settings → Providers & Models → **Command reviewer**)
    re-judges only what Jev flagged, against the user's request. It can allow
    a read of a remote service the user asked about, but never a change.

  Refusals go back to the agent and never to a person. Three in a row, or eight
  in a turn, pause `Shell` for the rest of that turn.
- **agent** and **debug**: everything above.
- **coordinator**: everything agent has, plus the coordinator tools above.

## Containment

**File tools stay inside the project.** They work in the project folder, in
a per-project scratch folder outside the repository, and in any other checkout
of the same git repository: its linked worktrees, or the main checkout when the
project folder is itself a worktree. A worktree counts only when the link holds
both ways (its `.git` file points into the repository, and the repository's
`.git/worktrees/<name>/gitdir` points back), so a planted `.git` file does not
make a folder part of the project. `.git` and `node_modules` stay off limits
in every checkout. A file tool that reaches a path outside all of these is
reviewed automatically first:

- Jev asks whether the path is risky and whether the access is unrelated to
  developing the project. If neither, the call runs.
- If Jev flags it (or isn't configured), the **Command reviewer** model
  decides. It allows only access it is confident serves the project's
  development (a sibling package, toolchain caches, SDK sources, build
  output). It is told whether the person driving the chat manages the
  machine, and that a request alone never justifies unrelated access.
- A verdict covers one call. It is reused for the same chat, tool and path for
  10 minutes.

The review can only skip the prompt. When it escalates, is unsure, or cannot
answer, the chat pauses and asks, showing the reviewer's reason. Only the owner
of that machine, or one of its co-owners, can answer:

- **Allow once** covers one call and one path.
- **Deny** refuses it, and the model carries on without it.
- **Always allow in this chat** stops asking for the rest of that chat. It
  takes two confirmations and shows a red banner while it is on.
- No answer within 10 minutes counts as Deny.

Paths are normalised before the check, so `..` cannot step outside. The
scratch folder and the worktree check also resolve symlinks; the project
folder check itself is lexical.

**The scratch folder** is `bridge/<project>-<hash>/` under the OS temp
directory, and `Shell` points `TMPDIR`, `TMP` and `TEMP` at it.

- **Linux:** when `/tmp` is a tmpfs (which is RAM-backed), the scratch folder
  goes under `/var/tmp` instead, so builds land on disk.
- **Cleanup:** the agent prunes it at startup and every six hours. It deletes
  anything inside that nothing has changed in for seven days. When the
  filesystem has under 10% or 1 GiB free, the limit drops to one day.

**`PATH` on macOS.** The tray is started by launchd, which gives it only
`/usr/bin:/bin:/usr/sbin:/sbin`. So when the agent starts, it asks your login
shell (`$SHELL -l -i`) what `PATH` it ends up with and uses that for every
command it runs. That brings in `/etc/paths`, `/etc/paths.d`, Homebrew and
anything your profile adds.

- **Fallback:** if the shell fails or takes over 5 seconds, the agent reads
  `/etc/paths` and `/etc/paths.d` instead.
- **Terminal pane:** on macOS it opens a login shell, as Terminal.app does.
- **Changing your profile:** the `PATH` is read once, when the agent starts.
  After you change your shell profile or install a tool into a new directory,
  quit and reopen the tray.
- **Turning it off:** set `BRIDGE_SKIP_LOGIN_ENV=1` in the agent's environment
  to keep the inherited `PATH`.
- **Your profile:** while the agent is asking, it sets
  `BRIDGE_RESOLVING_SHELL_ENV=1`, so your profile can skip slow steps.

**Four folders are always off limits** to file tools: `~/.ssh`, `~/.aws`,
`~/.gnupg` and `~/.kube`. No approval unlocks them, not even **Always allow**,
and none can be shared as a project folder.

**Inside the folder, files are ordinary files**, including a `.env`. Anything
that should never reach a model should not be in the folder you share.

**Shell commands are not contained.** A command runs with the full permissions
of the account the agent runs as, which on a Linux install is root. It can
reach anything that account can, including those four folders. Whether a
command waits for a person first is each person's own setting (**Settings →
Profile → Running commands**, also asked on a card the first time they send in
a chat on a machine):

- **Auto mode**: commands run without asking.
- **Ask before each command**: every agent-mode `Shell` call waits on an
  Allow / Deny card in the chat, answered by that person or the machine's
  owner. Ten minutes without an answer, or Stop, counts as Deny. The setting
  of whoever sent the message that started the turn applies, read again on
  every command.

The read-only `Shell` of plan and ask mode never asks; a command its check
can't verify is refused and the agent works from the code. An org admin can have
Bridge's security reviewer review the commands that did run, after the fact. Treat granting
someone the right to run commands on a machine as giving them a shell on it.

## Who may run tools

Two layers decide whether a person's message can make the agent act:

- **Project level**: `viewer`, `drafter`, `guest`, `editor`, `admin`, `owner`.
  Only `editor` and above can have the agent write files or run commands.
- **Whose machine**: on a machine you own you are at least an editor. On
  someone else's machine you are a drafter by default, so you can write prompts
  but its owner (or someone they allow) sends them.

Org admins are not given blanket access to every project's files; they need a
project membership like anyone else.

## Credentials

The model never sees an API key. Provider keys live on the Bridge server, every
model call is made from the server, and the agent on a machine never calls a
provider. The agent holds only an enroll secret for its own Bridge.

The one key that does reach a machine is a project key from
`CreateProjectApiKey`, and it is for the project's code, not for Bridge: the
server writes it into the project's env file through the agent, and the model
is given only a masked hint. It is capped, billed to the Bridge balance, and
revocable from the chat, the project's settings and Providers & Models.
