# Named Locks — Keep a Repo Private to One Session (Coach, Legal)
<!--
ref: @protocol/named-locks-keep-a-repo-private-to-one-session-coach-legal
version: 1
updated_at: 2026-11-27T21:33:06.089Z
-->

A private repo can carry a **lock** (`coach`, `legal`). Every request that does not hold that lock sees it as absent: ref, fetch, `/ls`, `/find`, `/search`, impulses, bootstrap and Related footers all answer 404 or skip it. That includes your own default token, admin rights and the claude.ai connector. A short-lived **lock code** opens it for whoever presents it.

## 1. Lock a repo (once)

Create a private repo, then set its lock. Do this before anything sensitive goes in, because after it the repo is gone for every session without a code.

```bash
curly protocol /repo -X POST -d '{"slug":"coach","name":"Coach","visibility":"private"}'
curly protocol /repo/coach -X PUT -d '{"lock":"coach"}'
```

A lock name is 1–32 characters (`a-z`, `0-9`, `-`). A locked repo cannot be made public. Changing or clearing a lock needs a request that already holds it.

## 2. Mint a lock code

Go to **Settings → API keys → Create**. Fill in **Lock** (`coach`) and an expiry, which defaults to 24h and can be at most 30 days. The code is shown once.

Only a signed-in browser session can mint, plus a request that already holds the lock. Any other token gets a 403, so an agent cannot unlock itself. To revoke a code, delete it on the same page.

## 3. Start a coach session in claude.ai

1. Create a claude.ai **project** with the Protocol connector enabled.
2. Put this in the project instructions:

```
Your Protocol lock code is <code>. Pass it as the `lock` argument on EVERY Protocol tool call (protocol_search, protocol_fetch, protocol_edit, protocol_call). Your memory lives in the @coach repo: read what we have and haven't covered before we start, and record it before we stop.
```

3. When the code expires, calls answer 403 `Lock code invalid or expired`. Mint a new code and replace it in the instructions.

A call that leaves out `lock` sees no coach repo. That is the failure mode, not a leak.

## From a terminal (sparingly)

Send the code as a header:

```bash
curly protocol "@coach/notes" -H "X-Protocol-Lock: <code>"
```

Claude Code and ticker transcripts land in `~/.claude/projects`, where every local session can read them. A terminal session is therefore not a private home for coach material. Use it only to set up or repair the repo.

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*