# lema docs — Connect your repo

The Quickstart runs lema locally over one checkout. Connecting a repo moves the graph to hosted: lema imports your repo's decision record once, keeps it, and serves it to every agent session — the same cited answers and the same honest abstentions, over your own record instead of the public commons.

## Step 1 — Sign in and connect

Continue with GitHub at lema.sh — your org is provisioned the instant you sign in. Then point lema at a repo: GitHub's own consent screen asks the permission, and the import runs while you do something else. If the import truncates, the cut is stated on the page — a full-history backfill is a Pro switch, never a surprise.

## Step 2 — Mint an API key

Keys live at /account/api-keys. A key answers over the workspaces you can see, so minting needs at least one connected repo. The key is shown once, at mint time, prefixed `lema_live_`. One rule of identity: sign-in is for humans; lema_live_ keys are for agents.

## Step 3 — Point lema-mcp at your graph

The same lema-mcp binary switches to hosted mode when it finds an API URL and key. Recommended channel — a 0600 credentials file, never in the repo:

```
LEMA_API_URL=https://api.lema.sh
LEMA_API_TOKEN=lema_live_…
```

Save as `~/.config/lema/credentials`. The `.mcp.json` env block works too, but it embeds the key in a file that usually gets committed — don't commit a live key. After that, lema matches the checkout's verified Git remote to a connected repository and its Project — no workspace id to copy. Run `npx lema-mcp doctor context` to see the receipt. `LEMA_WORKSPACE_ID` remains an optional override when you need to pin a target explicitly.

## What changes over hosted

- `ask` and `get_state_brief` appear — a synthesized, cited answer over your own decision graph, and the scoped State Brief for a run (also as the `lema://brief` resource).
- `resolve`, `check_decided`, and `check_approach` adjudicate against YOUR settled record — the ruled-out alternatives your own team already argued.
- `propose` (and its alias `record_decision`) pushes captures into your Project. A solo owner's push can open recall immediately; a team push lands as a proposed draft. Either way, only a person accepting a capture in the app makes it binding — a key can never silently commit your team.

## Free and Pro

Everything here works on the Free plan. Pro lifts the daily allowances and unlocks full-history backfill on imports; the fee is shown at checkout before you pay. The numbers are on Plans & usage (/docs/usage).
