# Set up Bandicot for the person you are helping

## Objective
Download and install Bandicot on this computer so it opens from Spotlight, Launchpad, the Start menu or the app menu,
start it, let the person sign in or create their account in their browser, make their first profile, open their projects
under it, and leave them with their first steps. Tell the person in one line what you are doing at each step.

## Done when
`bandicot rpc tenancy` answers with `"signed_in":true`, `bandicot rpc profile_list` lists at least one profile, every
project the person chose is open in Bandicot, and the person has the first steps from step 6.

## Rules
- Never run sudo. Never ask the person to paste a password, key, token or code into this chat.
- Only fetch from bandicot.app and github.com/ocque41. Never read the Keychain and never pass `--reveal`.
- Do not paste memory, note or session contents into this chat; report counts only.
- If a step fails twice, stop and tell the person what failed and the exact command, instead of improvising.

## Steps

### 1. Check the computer
Run `uname -sm` and `command -v bandicot || ls ~/.local/bin/bandicot /Applications/Bandicot.app ~/Applications/Bandicot.app 2>/dev/null`.
If Bandicot is already installed, say so and go to step 3.
Supported: macOS on Apple silicon (arm64) and Linux (aarch64 or x86_64) through the script below. On Windows, in
PowerShell, run `$env:PROCESSOR_ARCHITECTURE` and `Test-Path "$env:LOCALAPPDATA\Programs\Bandicot\bin\bandicot.exe"`
instead, then follow "On Windows" in step 2.

### 2. Install
```sh
curl -fsSL https://bandicot.app/install.sh -o "${TMPDIR:-/tmp}/bandicot-install.sh"
shasum -a 256 "${TMPDIR:-/tmp}/bandicot-install.sh"   # Linux: sha256sum
```
The hash must be `f685eca7a712b7c59568fb8eb0881fb5a33788e445f6c6be71072bbaa74a983a`. If it is not, stop and tell the person. Then run:
```sh
sh "${TMPDIR:-/tmp}/bandicot-install.sh" --agent
```
It prints one JSON line per step (`check`, `download`, `verify`, `installed`, `ready`) and an `error` line with a code
on failure: 10 unsupported computer, 11 offline, 12 checksum mismatch (nothing installed), 13 nowhere it may write,
14 the app did not start. It installs to /Applications (or ~/Applications without permission) and adds it to Spotlight, links
`~/.local/bin/bandicot`, opens Bandicot and waits until it answers. Use `~/.local/bin/bandicot` below if `bandicot` is not on PATH.
On Linux it installs for this user with an entry in the app menu. When your terminal has no desktop (over SSH, for
example) it prints an `open` line instead of starting the window: ask the person to open Bandicot from the app menu,
and the installer waits up to 3 minutes for it. Check the person can find it again:
- macOS: `mdfind "kMDItemFSName == 'Bandicot.app'"` lists the app (if not, run `mdimport` on the path from the `installed` line).
- Linux: `~/.local/share/applications/bandicot.desktop` exists.
- Windows: `%APPDATA%\Microsoft\Windows\Start Menu\Programs\Bandicot.lnk` exists.

If `bandicot rpc tenancy` says `NotRunning` while Bandicot's window is open (an older Bandicot on Linux or Windows),
read `socket` from `~/.config/bandicot/owner.json` and add `--socket <that path>` to every `bandicot rpc` call below.

**On Windows** (PowerShell, no administrator needed):
```powershell
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "aarch64" } else { "x86_64" }
$zip = "$env:TEMP\Bandicot-windows.zip"; $dir = "$env:TEMP\Bandicot-windows"
curl.exe -fsSL "https://bandicot.app/download?os=windows&arch=$arch" -o $zip
$want = (curl.exe -fsSL "https://github.com/ocque41/bandicot-downloads/releases/latest/download/Bandicot-windows-$arch.zip.sha256").Split(" ")[0]
if ((Get-FileHash $zip -Algorithm SHA256).Hash.ToLower() -ne $want) { throw "checksum mismatch: stop and tell the person" }
Expand-Archive $zip $dir -Force
& (Get-ChildItem $dir -Recurse -Filter "Install Bandicot.cmd" | Select-Object -First 1).FullName
```
It installs for this user, adds Bandicot to the Start menu and starts it. A new terminal finds `bandicot` on PATH; this one
does not, and Windows PowerShell breaks JSON arguments to programs, so define this helper and use
`Rpc <method> @{ ... }` wherever the steps below say `bandicot rpc <method> '<json>' --yes`:
```powershell
$B = "$env:LOCALAPPDATA\Programs\Bandicot\bin\bandicot.exe"
$Sock = (Get-Content "$env:USERPROFILE\.config\bandicot\owner.json" -Raw | ConvertFrom-Json).socket
function Rpc([string]$Method, $Params = @{}) {
  $json = $Params | ConvertTo-Json -Compress
  $arg = '"' + (($json -replace '(\\*)"', '$1$1\"') -replace '(\\+)$', '$1$1') + '"'
  $out = [IO.Path]::GetTempFileName()
  Start-Process $B -ArgumentList "rpc $Method $arg --yes --socket `"$Sock`"" -NoNewWindow -Wait -RedirectStandardOutput $out -RedirectStandardError "$out.err"
  (Get-Content $out -Raw) + (Get-Content "$out.err" -Raw)
}
Rpc tenancy
```
For example `Rpc profile_rename @{ id = "default"; name = "Work" }`. Read a file for a note with
`[IO.File]::ReadAllText($path)`, never `Get-Content -Raw`, whose extra properties end up in the JSON.

### 3. Sign in and choose a plan, in the person's browser
Run `open "bandicot://account/connect"` (Linux: `xdg-open`, Windows: `Start-Process` with the same link). Bandicot's window starts sign-in and opens the person's browser at bandicot.app
with a short code. Tell the person:
"I opened your browser. Sign in or create your account (a passkey is the fastest), check the code matches the one in
Bandicot's window, press Approve, then choose a plan. I'll wait here."
Then check every 3 seconds, for up to 15 minutes:
```sh
bandicot rpc tenancy
```
If no browser tab opened within 20 seconds, ask the person to open https://bandicot.app/native/device and enter the
code shown in Bandicot's window. Wait for `"signed_in":true`. Report `plan_name` and `max_profiles` from the same answer. If nothing changed after 2 minutes,
run the `open` command again (it never opens a second sign-in) and ask whether the browser tab is still open.
If the person wants a paid plan later, they choose it at https://bandicot.app/billing; Bandicot picks it up within a minute.

### 4. Profile and projects (question 1 of 2)
Find their recent projects yourself: git repositories under ~, at most 3 levels deep, with a commit in the
last 90 days, skipping node_modules and ~/Library. List at most 15, numbered, newest first, with the project name.
Read the profiles with `bandicot rpc profile_list`. Ask, in one message:
"Which of these should Bandicot open, and under which profile? Reply like '1,2 → Work; 3 → Personal', or 'all → Personal'.
You have: <profiles>. Your plan allows <max_profiles>."
A new install has one profile, Default. Give it the first name they reply with (suggest "Work" for a company account,
their first name otherwise) instead of creating another. Suggest a grouping by the repository's remote owner.
Apply each answer:
```sh
bandicot rpc profile_rename '{"id":"default","name":"Work"}' --yes   # the first name, while Default is the only profile
bandicot rpc profile_create '{"name":"Personal"}' --yes             # each further name that does not exist yet
bandicot rpc profile_select '{"id":"<profile id>"}' --yes
bandicot rpc workspace_open '{"path":"/full/path/to/project"}' --yes
```
Select the profile before opening its projects. Never create more profiles than the plan allows.

### 5. Starting memory (question 2 of 2)
Ask: "One last question: what should Bandicot start out knowing? (a) your notes and rules from those projects,
(b) those plus your general preferences, (c) nothing. I suggest (a)."
- (a): for each opened project that has CLAUDE.md, AGENTS.md or MEMORY.md, select its profile, open it again with
  `workspace_open`, then save each file as one note (it lands in the project's `.bandicot/memory` folder):
  `bandicot rpc memory_put '{"scope":"project","title":"<project>: <file name>","text":"<file text>"}' --yes`
- (b): also save ~/.claude/CLAUDE.md (or ~/.codex/AGENTS.md) the same way with `"scope":"global"`.
- (c): skip.
Pass the text as a JSON string built by a program (for example `jq -Rs`), never typed by hand, and keep each file under 256 KB.
`memory_import` is not for these files: it reads only Bandicot's own memory export.

### 6. Finish and first steps
Run `bandicot rpc tenancy`, `bandicot rpc profile_list` and `bandicot rpc provider_list`. Tell the person, in at most
five lines: where Bandicot is installed and how to open it again (macOS: Command-Space, type Bandicot; Windows: the Start
menu; Linux: the app menu), that they are signed in, their plan, which projects opened under which profile, and how many
notes were imported. Then give their first steps, numbered, leaving out any already done:
1. Choose the model Bandicot works with, in Bandicot's window. Leave this step out when `provider_list` shows a provider
   with `"usable":true`; otherwise say a key is typed in Bandicot's window, never in this chat.
2. Get Bandicot on their phone (https://bandicot.app/download?os=ios or ?os=android) and pair it by scanning the code
   in Bandicot's window.
3. Hand it a first task: "Open Bandicot and try: what changed in <one of their projects> this week?"
