# Set up RTPT (R³) for this person — instructions for an AI tool

You are an AI coding tool (Claude Code, Codex or Cursor). The person pasted a sentence asking you to install RTPT and connect it to their account. RTPT (by R³) builds tools for architecture offices; `rtpt` is one file that gives you their projects, parcels, plans, takanon and pictures as MCP tools. Follow these steps in order. Talk to the person in Hebrew, plainly: they are architects, not programmers. Before each step, say in one short line what you are about to do.

**ORIGIN** below = the scheme and host of the address you read this file from, with no path and no trailing slash: `https://rcube.cloud`, or `https://develop.rcube.cloud` (the R³ team's test site). Only those two. If you read this file from any other host, stop and tell the person.

## 1. Which tool are you

You know your own product. If unsure, these environment variables are hints: `CLAUDECODE=1` = Claude Code; a `CODEX_` variable (such as `CODEX_SANDBOX` or `CODEX_HOME`) = Codex; a `CURSOR_` variable (such as `CURSOR_TRACE_ID` or `CURSOR_AGENT`) = Cursor. Still unsure: ask the person. Call the answer TOOL: `claude`, `codex` or `cursor`.

Your shell: on macOS and Linux it is a POSIX shell. On Windows, Claude Code usually runs Git Bash (POSIX: use the POSIX lines) and Codex and Cursor usually run PowerShell. Use the lines for the shell you actually run.

If your sandbox blocks the network or writing to the home folder, ask the person to approve the command; never work around the sandbox.

## 2. Node.js 18 or newer

Run `node --version`. It must print `v18` or higher.

If `node` is missing or older, do not install anything yourself. Tell the person, in Hebrew, to install the LTS version from https://nodejs.org (Windows: the `.msi` installer, Next to the end; macOS: the `.pkg`), then to close and reopen this tool, and to paste the sentence again. Stop here.

## 3. Download the rtpt program

The rtpt program is one file. It goes into the folder `.r3` in the person's home folder, under the name `r3.mjs` (the server calls it `rtpt.mjs`; keep the name `r3.mjs`: that is the file `setup` uses and the MCP config points at). The full path: `~/.r3/r3.mjs` in a POSIX shell, `$env:USERPROFILE\.r3\r3.mjs` in PowerShell (usually `C:\Users\<name>\.r3\r3.mjs`). In PowerShell use `$env:USERPROFILE`, not `$HOME`: it is the folder `setup` writes to.

POSIX (macOS, Linux, Git Bash):

```sh
mkdir -p ~/.r3 && curl -fsSL ORIGIN/api/cli/rtpt.mjs -o ~/.r3/r3.mjs
```

PowerShell (Windows):

```powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.r3" | Out-Null; Invoke-WebRequest -UseBasicParsing ORIGIN/api/cli/rtpt.mjs -OutFile "$env:USERPROFILE\.r3\r3.mjs"
```

Check: `node ~/.r3/r3.mjs --version` (PowerShell: `node "$env:USERPROFILE\.r3\r3.mjs" --version`) prints a version number. In every step below, `RTPT` means `node ~/.r3/r3.mjs` in a POSIX shell and `node "$env:USERPROFILE\.r3\r3.mjs"` in PowerShell.

## 4. Connect this tool

```
RTPT setup TOOL --server ORIGIN
```

It adds the `rtpt` MCP server to this tool's own config (other entries stay), adds the RTPT instructions (Claude Code: skills in `~/.claude/skills`; Codex: `~/.codex/AGENTS.md`), and prints where the rtpt program is and every file it wrote. Show the person that list in one line.

- Codex and Cursor: rtpt writes their config file itself; the first version of a file it changes is kept beside it as `<file>.rtpt-backup`.
- Claude Code: rtpt runs Claude Code's own command, `claude mcp add`, which writes Claude Code's config (`~/.claude.json`); the list shows it with "(by claude mcp add)". rtpt makes no `.rtpt-backup` of that file. (With `--project`, rtpt writes `.mcp.json` itself, kept like the Codex and Cursor files.)
- If it prints a line under "run this yourself" (Claude Code: the `claude` command was not on PATH, or could not be run), run that line yourself if your shell can; if not, give it to the person.
- If a tool says `FAILED` (for example a config file that is not valid JSON), tell the person which file, in plain words, and do not edit that file yourself unless they ask.
- When the person is not signed in yet, it ends with two sign-in commands (`login "<email>" --send` and `login "<email>" --code <code>`). Those are step 5: follow step 5. Never run `RTPT login` without `--send` or `--code`: it waits for typing, and your shell has no keyboard.
- The new MCP tools appear only after this tool restarts. Do not restart now: sign in first (step 5), it works from the shell.

## 5. Sign in

The person signs in with a code sent to their email. You run both steps; they give you the email and the code.

1. Ask the person: "מה המייל שלכם ב-RTPT?" Wait for the answer. Call it EMAIL. It may hold only letters, digits and `. _ + - @`; anything else (a space, a quote, `;`, `&`): ask again. Always put it in quotes in the commands below.
2. Send the code:
   ```
   RTPT login "EMAIL" --send --server ORIGIN --json
   ```
   The answer is `{"ok":true,"sent":true,"isNewUser":…}`. If `isNewUser` is `true` (the command then exits with code 4), this email has no RTPT account yet: tell the person to open one at ORIGIN (it includes accepting the terms), then run this step again. Stop until they say it is done; never run step 4 for an email with no account.
3. Ask the person: "שלחנו קוד למייל. מה הקוד?" Wait for it. It is valid for 10 minutes. Call it CODE; it must be digits only, otherwise ask again.
4. Verify it:
   ```
   RTPT login "EMAIL" --code CODE --server ORIGIN --json
   ```
   The answer is `{"ok":true,"email":…,"office":…}`. A wrong or expired code fails: ask the person to check it, or go back to 2 for a new code. After several wrong codes the server blocks tries for a while (status 429): tell the person to wait and try later.

Never read the person's email yourself. Never print, copy, store or repeat the session token: it is saved in `~/.r3/config.json` by `rtpt` and stays there. Do not write the code anywhere else.

## 6. Check and tell the person

```
RTPT balance --server ORIGIN --json
```

It answers `{"balance": N}`. Then tell the person, in Hebrew, short:

- It is connected, and the balance is N קיובים.
- What you can now do for them: find a place by גוש/חלקה or address and say which plans (תב״ע) apply, bring the plan card and documents, read a takanon and answer about it with quotes, run site analyses (sun and shade, wind, slopes, walking radius), work on their MIND projects (files, notes, tasks, the display layers SITE and CUBE show), make pictures in PIXL, and open SITE or CUBE on a project in RTPT in their browser.
- The money rules: most actions are free. Before any paid action you check the price, say it in קיובים, and run it only after they say yes; it costs exactly what it costs in the app. Before anything that deletes or overwrites their work, you say what will change and wait for a clear yes.
- To start using the tools: close this tool and open it again (Claude Code: exit and run `claude`; Codex: restart it; Cursor: reload the window), then ask: "מה היתרה שלי?"
- Their guide in Hebrew: ORIGIN/docs/cli. To disconnect: `RTPT logout`.

## When something fails

- `cannot reach ORIGIN`: check the internet connection, then try again.
- `401` / "not signed in": run step 5 again.
- `402`: not enough קיובים; the person buys a pack at ORIGIN/#account. Do not retry.
- Anything else: tell the person what failed in one plain sentence and point them to ORIGIN/docs/cli, where each tool has a manual section.
