# User Manual — CLR · CCR · GMR

**Audience:** humans who install these relays and run batches from Cursor (or with a teammate).  
**Scope:** Engine **B** (CLR V2), Engine **D** (CCR V1), Engine **G** (GMR V1).  
**Not included:** OCF, CWR.

---

## 1. What this is

These are **file-based coding relays**. Cursor (or you) writes a short prompt under `.handoff/`, a local CLI does the edits, then you review the diff and commit when ready.

| Engine | Who writes code | Invoke phrases | Artifacts |
| --- | --- | --- | --- |
| **CLR V2** | Codex (`codex.exe`) | CLR, Luna, Codex Luna Relay, Engine B | `CLR_*` / `LUNA_*` |
| **CCR V1** | Claude Code (`claude`) | CCR, Claude Code Relay, Engine D | `CCR_*` |
| **GMR V1** | Gemini (CLI or web paste) | GMR, Gemini Multi-batch Relay, Engine G | `GMR_*`, `gmr-drop/` |

**Rule:** never merge engines. One allowlist → one engine. Do not auto-failover a failed CLR slice to CCR/GMR (or vice versa) unless a human explicitly says so.

---

## 2. Download & unpack

1. Download [`relay-kits-clr-ccr-gmr.zip`](../downloads/relay-kits-clr-ccr-gmr.zip).
2. Unzip somewhere durable, e.g. `Documents/engines/`.
3. You should see three folders: `CLR-V2/`, `CCR-V1/`, `GMR-V1/`.

---

## 3. One-time install (any repo)

### 3.1 CLR → Cursor + Codex

```powershell
cd <unzip>\CLR-V2
.\scripts\install-skill.ps1
.\scripts\install-into-repo.ps1 -RepoRoot "C:\path\to\your\repo"
.\scripts\repair-codex-host.ps1   # ensures codex.exe + host under %USERPROFILE%\.codex\.sandbox-bin\
```

Write `.handoff/CLR_HOST_HEALTH.md` with `Status: green` when Codex is usable.

### 3.2 CCR → Cursor + Claude

```powershell
npm install -g @anthropic-ai/claude-code
claude auth login
cd <unzip>\CCR-V1
.\scripts\install-skill.ps1
.\scripts\install-into-repo.ps1 -RepoRoot "C:\path\to\your\repo"
```

### 3.3 GMR → Cursor + Gemini

```powershell
cd <unzip>\GMR-V1
.\scripts\install-into-repo.ps1 -RepoRoot "C:\path\to\your\repo"
.\scripts\install-skill.ps1
.\scripts\handoff\gmr-host-health.ps1 -RepoRoot "C:\path\to\your\repo"
# or after install-into-repo:
# .\scripts\handoff\gmr-host-health.ps1
```

**Default mode is C (web paste)** until `gemini` auth is proven green. You do **not** need Gemini CLI to start.

---

## 4. Run your first batch (happy path)

### CLR

1. Copy `.handoff/LUNA_BATCH_PROMPT.template.md` → `.handoff/CLR_MYTASK_PROMPT.md`.
2. Fill **Allowed**, **Forbidden**, verification, STOP.
3. In Cursor say: `Use CLR on CLR_MYTASK` (or run):

```powershell
.\scripts\handoff\clr-exec.ps1 -Id MYTASK -RepoRoot "C:\path\to\your\repo"
```

4. Review `git diff` + `.handoff/CLR_MYTASK_RESULT.md` → commit only if you want.

### CCR

1. Copy template → `.handoff/CCR_MYTASK_PROMPT.md`.
2. Run:

```powershell
.\scripts\handoff\ccr-exec.ps1 -Id MYTASK -RepoRoot "C:\path\to\your\repo"
```

3. Review RESULT Metering + diff.

### GMR (Mode C — easiest)

1. Author `.handoff/GMR_<Id>_PLAN.md` + `GMR_<Id>_B1_PROMPT.md` + `GMR_QUEUE.md` (see templates).
2. `.\scripts\handoff\gmr-next.ps1`
3. Paste the prompt into Gemini web → save reply as `.handoff/gmr-drop/<Id>/B1/drop.md` (format in `GMR-V1/PASTE.md`).
4. `.\scripts\handoff\gmr-ingest.ps1 -Id <Id> -Batch B1`
5. On pass, next batch unlocks. Review branch `gmr/<Id>`, then commit on request.

---

## 5. Integration cheat sheet

| Tool | How it plugs in |
| --- | --- |
| **Cursor** | Skills under `~/.cursor/skills/` + always-on rules in `.cursor/rules/*-relay.mdc`. Cursor **orchestrates** (prompt, exec, review). |
| **Codex** | CLR only. `codex.exe exec` via `clr-exec.ps1`. Skill also mirrored to `~/.codex/skills/codex-luna-relay/`. |
| **Claude** | CCR only. Claude Code CLI via `ccr-exec.ps1`. Skill mirrored to `~/.claude/skills/claude-code-relay/`. |
| **Gemini** | GMR only. Mode A `gemini`, Mode B `agy`, Mode C web paste + `gmr-ingest`. |

---

## 6. Safety defaults you should keep

- **Allowlists** — every prompt lists Allowed paths; engines must not wander.
- **No silent main commits** — GMR writes on `gmr/<id>`; CLR/CCR commit only when you ask Cursor.
- **Hard stop** — if RESULT is waiting / failed / skipped / stopped, **do not** finish the Allowed files by hand in Cursor “just to ship.”
- **Metering** — every RESULT has `## Metering`. Honest savings only if Cursor did not rewrite the same slice.
- **GMR** — never `yolo`; Mode A uses `auto_edit`; correction cap = 2.

---

## 7. Troubleshooting

| Symptom | Fix |
| --- | --- |
| CLR skipped / red health | Run `repair-codex-host.ps1`; confirm sandbox binaries; rewrite HOST_HEALTH green |
| CCR auth fail | `claude auth login` then `claude auth status` |
| CCR usage limit | Default waits for reset; do not Cursor-implement the same allowlist |
| GMR ingest fail with violations | Drop touched Forbidden paths — fix prompt/drop; do not force |
| GMR slot busy (exit 3) | Another GMR run holds `.handoff/gmr.lock` — wait |
| Doubled `GMR_GMR_*` names | Use Id **without** a leading `GMR_` (scripts already prefix) |

---

## 8. What’s in the zip

- `CLR-V2/` — skill, rules, `clr-exec`, templates, INSTALL, Codex teammate notes  
- `CCR-V1/` — skill, rules, `ccr-exec`, usage probe, templates, INSTALL  
- `GMR-V1/` — skill, rules, host-health/exec/ingest/status/next, PASTE sheet, templates  

Full agent behavior contract: [AGENT_MANUAL.md](AGENT_MANUAL.md).
