
# Latch
**Latch onto your real Chrome. Every agent gets its own tab group.**
Latch lets any local coding agent drive the Chrome you are already signed into — your sessions,
your cookies, your logged-in tabs. Several agents can work in that one profile at the same time
without stepping on each other, because each one's tabs are grouped and labelled with its name.
[](LICENSE)
[](https://nodejs.org)
[](https://developer.chrome.com/docs/extensions/mv3/intro/)
[](https://modelcontextprotocol.io)
---
## Why Latch
Most browser automation hands your agent a fresh, empty, logged-out browser. That is useless for the
things you actually want done — reading your analytics, checking a dashboard, finishing a form on a
site you are signed into.
Latch takes the opposite approach: **no new browser, no new profile, no re-authentication.** It
attaches to the Chrome window in front of you.
The problem with sharing one real browser is that agents collide. Latch solves that with Chrome tab
groups: every request carries the name of the agent that made it, and that name becomes the title of
a coloured tab group. Claude Code's tabs sit in a purple **Claude Code** group. Codex's sit in a cyan
**Codex** group. Yours stay where you left them, untouched.
```text
any agent (MCP or latch CLI) ──▶ Unix socket ──▶ native host ◀──▶ Chrome extension
```
Everything is local. No cloud service, no remote browser, no account.
## Features
- **Runs in your signed-in Chrome** — real sessions, real cookies, no login dance.
- **One tab group per agent, per window**, titled with the agent's name and given a stable colour.
- **Live status in the tab strip** — the group title reads `Codex · ⏳ Working`, then `Codex · ✅ Done`,
so you can see what each agent is doing without opening anything.
- **Strict ownership** — an agent only ever reuses or adopts its *own* tabs, never another agent's
and never your personal groups.
- **No duplicate names** — open a second Claude Code and it becomes **Claude Nova**, not a second
**Claude Code** sharing the first one's group.
- **Reuse before opening** — `browser_open` finds a matching tab before creating a new one, so your
window does not fill up with duplicates.
- **Scrolling that works on real apps** — when the window does not scroll, the largest scrollable
container on screen is scrolled instead, so "scroll down" means the same thing on a blog and in a
mail client.
- **Shadow DOM support** — snapshots, refs, selectors, scrolling, waits and typing cross open shadow
roots, so app controls such as LinkedIn's post composer do not disappear after a click.
- **Background-first** — task tabs never steal focus unless the agent is explicitly asked to show you.
- **A visible cursor** on the page, labelled with the acting agent's name, so you can see what is
happening and who is doing it.
- **Works with anything that speaks MCP** — Claude Code, Codex, Gemini, Cursor — plus a plain CLI for
agents and shells that do not.
- **A small toolbar popup**: connection status, attached tab count, per-agent tab counts and live
status, attach and detach. That is the whole UI.
## Requirements
- macOS or Linux
- Node.js 20 or newer
- Google Chrome, Chrome Beta, or Chromium
- At least one local agent (anything that speaks MCP, or any shell)
## Install
**1. Clone and install dependencies**
```bash
git clone https://github.com/freezetheworld/latch.git
cd latch
npm install
```
**2. Load the extension**
1. Open `chrome://extensions`
2. Enable **Developer mode**
3. Select **Load unpacked**
4. Choose this project's `extension/` directory
The bundled manifest key pins a stable extension ID, so the installer below needs no arguments:
`negoahcokogjggjcccibffdnognlfbkm`
**3. Install the native host**
```bash
npm run install-host
```
This writes a native-messaging manifest into Chrome's user-level config and stages the host runtime
under `~/.latch/runtime`. No administrator privileges are needed. **Restart Chrome afterwards.**
For other browsers pass `--browser chrome-beta` or `--browser chromium`. If you removed the manifest
key or repackaged the extension, pass `--extension-id YOUR_ID`.
> **macOS note:** the runtime is staged outside your checkout on purpose. Chrome's sandbox cannot
> launch a host that lives in a privacy-protected folder such as `Documents` or `Desktop`.
**4. Register the MCP server with your agents**
Use the absolute path the installer prints:
```bash
claude mcp add latch -- node /absolute/path/to/latch/server/mcp-server.js
codex mcp add latch -- node /absolute/path/to/latch/server/mcp-server.js
gemini mcp add latch -- node /absolute/path/to/latch/server/mcp-server.js
```
Start a fresh session and run `/mcp` to confirm `latch` is active.
**5. Check it**
Click the Latch toolbar icon. It should say **Connected**. Then ask your agent something like:
```text
Open my YouTube Studio tab, check my upload defaults, and tell me what is missing.
```
## Agents and tab groups
Every request carries an agent name. That name titles the Chrome tab group holding the agent's tabs.
Resolution order:
1. an explicit `--agent NAME` flag (CLI) or `agent` parameter (MCP tool)
2. the `LATCH_AGENT` environment variable
3. auto-detection from the environment (`CLAUDECODE`, `CODEX_HOME`, `CURSOR_AGENT`, ...)
4. the neutral fallback `Agent`
```bash
# two agents driving the same Chrome profile at once
latch --agent "Claude Code" open https://example.com # → purple "Claude Code" group
latch --agent "Codex" open https://example.org # → cyan "Codex" group
LATCH_AGENT="Research" latch open https://example.net
```
Known agents keep a fixed colour — Claude Code purple, Codex cyan, Gemini blue, Cursor orange,
DeepSeek green, Hermes yellow. Any other name hashes deterministically into Chrome's palette, so the
same agent always lands on the same colour.
### Two of the same agent
Two Claude Code windows both call themselves "Claude Code". Rather than pile their tabs into one
group, Latch gives the second one a callsign:
```text
Claude Code · ⏳ Working first session
Claude Nova · ✅ Done second session, same agent
```
The first word of the name is kept as the brand and a callsign replaces the rest, so `Codex` becomes
`Codex Vega`, `Gemini` becomes `Gemini Atlas`, and so on for any agent. Latch also steers each
variant towards a tab group colour that is not already on screen, so sessions are distinguishable by
colour as well as by name — until you have more live agents than Chrome has colours, which is nine.
This works because every request carries an opaque session id alongside the name, derived from
`$LATCH_SESSION`, then the agent's own session variable (`CLAUDE_SESSION_ID`, `CODEX_SESSION_ID`,
`CURSOR_TRACE_ID`, ...), then the terminal (`ITERM_SESSION_ID`, `TMUX_PANE`), and finally the parent
process id. It is stable across CLI invocations from the same shell, so a session keeps its name for
as long as it is in use.
### Agents are locked to their group
Separate names are not enough on their own, because attached tabs are shared state. So the tab group
is not just a label — it is the boundary an agent works inside, and Latch enforces it:
- A command with no `tabId` resolves only to an attached tab in the caller's own group. It never
falls through to whichever tab happens to be in the foreground.
- Naming a `tabId` outside your group fails with `TAB_NOT_IN_YOUR_GROUP`, which names the owning
agent when there is one.
- `browser_open` reuses only tabs you already own. A matching URL in the user's tabs or another
agent's group is left alone and you get your own tab instead, so it is always safe to call.
- `browser_attach` brings a tab of the user's into your group, but is refused for a tab another live
agent is driving. `browser_detach` and `browser_close_tab` reach only your own group.
**The group is the record of ownership**, not a map kept beside it. That has two useful
consequences. Ownership survives a service-worker restart, because it is read back off the group
title. And the user stays in charge: drag a tab from one agent's group into another's and it changes
hands; drag it out of every agent group and it is detached, because it has left every workspace.
Attaching from the toolbar popup is a person acting directly, so it takes a tab over regardless. A
tab whose owning session has been quiet for 30 minutes can be adopted by another agent through an
explicit `browser_attach` — which moves it into the new group — so an abandoned session never
strands its tabs, but no agent ever silently starts driving another's.
A name is released once its session has been quiet for 30 minutes **and** holds no attached tabs, so
the plain name comes back for the next agent instead of being locked away. `browser_status` reports
the name a caller is actually using.
### Live status
The group title is `