# Update cbrain and its skill

When cbrain or its skill needs an update—for example, when a command returns `UPGRADE_REQUIRED`, or when the CLI soft-notifies that a newer version is available—follow these steps.
You must update **both** the CLI and the skill. Updating **does not affect existing authorization credentials**. Afterward, retry the original command directly.

**Step 1 — Update the CLI**

```bash
npm install -g cbrain
```

**Step 2 — Update the skill** (required; do not skip)

```bash
npx skills add https://cbrain.intelli-spectrum.com --skill cbrain -g -y
```

Origin scheme: production-style (**HTTPS**). Do **not** rewrite the skill URL to `http://`—HTTPS-only redirects break `npx skills add` discovery. Use the skill URL exactly as written in this document. Step 2 is **mandatory** and must exit 0. Updating the CLI alone is not enough. If `npx skills add` fails (for example, "No skills found"), **stop and report the error**. Do **not** continue with an already-installed older local skill.

**Step 3 — Verify**

```bash
cbrain me
```

Important:
- Update **both** the CLI and the skill. A newer CLI with an old skill is incomplete.
- **Do not** run `cbrain auth login` again. Credentials are stored locally and are not cleared by an update.
- Reauthorize only if `cbrain me` explicitly reports an authorization error (NOT_AUTHENTICATED / AUTH).

**Step 4 — Retry the original command**

Return to the command that triggered the update and retry it once without changes.
