---
name: leangate-setup
description: Install, update or check LeanGate for the user. LeanGate checks the code a coding agent writes against the whole repo (existing helpers, failures production won't survive, security holes) through an MCP server and Claude Code hooks.
user-invocable: true
metadata:
  author: leangate
---

# Set up LeanGate

If you are reading this, your job is to install LeanGate for the user, or update it, and check that it works.
It's in private beta: the user needs an approved account on https://leangates.com (they sign in with GitHub and request access
under "Get started").

## Step 1: Check what's there

```bash
leangate status
```

- "Signed in" and "Licensed to ...": it's installed and working. Run the install command anyway to update it.
- Command not found: install it (step 2).

## Step 2: Install or update

Run the one command for this machine's OS in the user's terminal. It can take up to ten minutes because it waits
for the user, so run it with a long timeout or in the background.

- Windows (PowerShell): `irm https://leangates.com/install.ps1 | iex`
- macOS / Linux: `curl -fsSL https://leangates.com/install.sh | sh`

On a machine that isn't signed in yet, it prints a short code and opens https://leangates.com/activate in the browser.
**Tell the user to check that the code in the browser matches the one printed, and to click Approve.** You can't
approve it for them, and you never need or see an API key. Then it installs LeanGate into ~/.leangate/app, puts
`leangate` on the PATH, and connects every AI coding tool it finds (Claude Code, Codex, Cursor, VS Code with Copilot, Gemini CLI,
Windsurf, Cline, Zed, Kiro, ...): the MCP server, plus instructions to call `verify_lean`. Running it again later
updates LeanGate without asking again.

## If it stops

- "isn't approved yet": the user requests access on https://leangates.com (Get started), then you run the command again.
- "needs Python 3.11 or newer": the user installs Python 3.11+, then you run the command again.
- "no LeanGate build for ...": that OS / Python version isn't available yet; the message lists what is.
- "already registered as ..." for the MCP server: an older LeanGate setup exists; tell the user, it's left alone.
- "LeanGate is running" (Windows, updating an install from before 0.1.10, once): an AI tool (maybe you) has
  LeanGate's MCP server open, so its files can't be moved; nothing was changed. Ask the user whether to stop it. If
  they agree, run `$env:LEANGATE_STOP_RUNNING=1; irm https://leangates.com/install.ps1 | iex`; LeanGate's tools disconnect until
  the user starts a new session (or reconnects it from Claude Code's /mcp). Later updates don't need this.

## Step 3: Check it works

```bash
leangate status
```

Then tell the user to restart their AI tools (or start a new session) so they load the LeanGate MCP server.
If a tool was installed after LeanGate, run `leangate connect` to add it.

## Using it

- Call the `verify_lean` tool when you finish a change, and fix what it reports. Call `check_dependency` before
  adding a package. Call `check_reuse` before writing a general-purpose helper your own search didn't find.
- In another repo, run `leangate connect` there (Claude Code hooks and Cursor rules are per repo).
- During the beta the models run on https://leangates.com: 1,000 model decisions a month, free. Past that, LeanGate keeps
  checking with its own rules until the 1st. Usage: https://leangates.com/app/account
- What leaves the machine, and where it goes: https://leangates.com/privacy
- Updates install themselves: once a day LeanGate checks for a newer version and installs it beside the current
  one; new sessions use it, running ones carry on. `leangate update` does it now; `LEANGATE_AUTO_UPDATE=0` turns
  the automatic part off. If an update misbehaves: `python ~/.leangate/_cloud/install.py --rollback`.
