2025-12-14 03:59:24 +00:00
---
2025-12-20 15:54:40 +00:00
summary: "Planned first-run onboarding flow for Clawdis (local vs remote, Anthropic OAuth, workspace bootstrap ritual)"
2025-12-14 03:59:24 +00:00
read_when:
- Designing the macOS onboarding assistant
2025-12-22 21:02:48 +00:00
- Implementing Anthropic auth or identity setup
2025-12-14 03:59:24 +00:00
---
<!-- {% raw %} -->
# Onboarding (macOS app)
2025-12-22 21:02:48 +00:00
This doc describes the intended **first-run onboarding** for Clawdis. The goal is a good “day 0” experience: pick where the Gateway runs, bind Claude (Anthropic) auth for the embedded agent runtime, and then let the **agent bootstrap itself** via a first-run ritual in the workspace.
2025-12-14 03:59:24 +00:00
## Page order (high level)
1) **Local vs Remote**
2) ** (Local only)** Connect Claude (Anthropic OAuth) — optional, but recommended
2025-12-20 16:51:53 +00:00
3) **Onboarding chat** — dedicated session where the agent introduces itself and guides setup
2025-12-14 03:59:24 +00:00
## 1) Local vs Remote
First question: where does the **Gateway** run?
2025-12-22 21:02:48 +00:00
- **Local (this Mac):** onboarding can run the Anthropic OAuth flow and write the Clawdis token store locally.
2025-12-14 03:59:24 +00:00
- **Remote (over SSH/tailnet):** onboarding must not run OAuth locally, because credentials must exist on the **gateway host** .
2025-12-19 19:20:57 +01:00
Implementation note (2025-12-19): in local mode, the macOS app bundles the Gateway and enables it via a per-user launchd LaunchAgent (no global npm install/Node requirement for the user).
2025-12-14 03:59:24 +00:00
## 2) Local-only: Connect Claude (Anthropic OAuth)
2025-12-22 21:02:48 +00:00
This is the “bind Clawdis to Anthropic” step. It is explicitly the **Anthropic (Claude Pro/Max) OAuth flow** , not a generic “login”.
2025-12-14 03:59:24 +00:00
### Recommended: OAuth
The macOS app should:
- Start the Anthropic OAuth (PKCE) flow in the user’ s browser.
- Ask the user to paste the `code#state` value.
2025-12-22 21:02:48 +00:00
- Exchange it for tokens and write credentials to:
- `~/.clawdis/credentials/oauth.json` (file mode `0600` , directory mode `0700` )
2025-12-14 03:59:24 +00:00
2025-12-22 21:02:48 +00:00
Why this location matters: it’ s the Clawdis-owned OAuth store.
On first run, Clawdis can import existing OAuth tokens from legacy p/Claude locations if present.
2025-12-14 03:59:24 +00:00
### Alternative: API key (instructions only)
Offer an “API key” option, but for now it is **instructions only** :
- Get an Anthropic API key.
2025-12-22 21:02:48 +00:00
- Provide it to Clawdis via your preferred mechanism (env/config).
2025-12-14 03:59:24 +00:00
Note: environment variables are often confusing when the Gateway is launched by a GUI app (launchd environment != your shell).
2025-12-26 00:43:44 +01:00
### Model safety rule
2025-12-14 03:59:24 +00:00
2025-12-26 00:43:44 +01:00
Clawdis should **always pass** `--model` when invoking the embedded agent (don’ t rely on defaults).
2025-12-22 21:02:48 +00:00
Example (CLI):
```bash
2025-12-26 00:43:44 +01:00
clawdis agent --mode rpc --model anthropic/claude-opus-4-5 "< message > "
2025-12-14 03:59:24 +00:00
```
If the user skips auth, onboarding should be clear: the agent likely won’ t respond until auth is configured.
2025-12-20 16:51:53 +00:00
## 3) Onboarding chat (dedicated session)
The onboarding flow now embeds the SwiftUI chat view directly. It uses a **special session key**
(`onboarding` ) so the “newborn agent” ritual stays separate from the main chat.
This onboarding chat is where the agent:
- does the BOOTSTRAP.md identity ritual (one question at a time)
2025-12-20 17:38:54 +00:00
- visits **soul.md** with the user and writes `SOUL.md` (values, tone, boundaries)
2025-12-20 16:51:53 +00:00
- asks how the user wants to talk (web-only / WhatsApp / Telegram)
- guides linking steps (including showing a QR inline for WhatsApp via the `whatsapp_login` tool)
2025-12-21 01:39:50 +00:00
If the workspace bootstrap is already complete (BOOTSTRAP.md removed), the onboarding chat step is skipped.
2025-12-20 16:51:53 +00:00
Once setup is complete, the user can switch to the normal chat (`main` ) via the menu bar panel.
## 4) Agent bootstrap ritual (outside onboarding)
2025-12-14 03:59:24 +00:00
2025-12-20 15:54:40 +00:00
We no longer collect identity in the onboarding wizard. Instead, the **first agent run** performs a playful bootstrap ritual using files in the workspace:
2025-12-14 03:59:24 +00:00
2025-12-21 01:31:31 +00:00
- Workspace is created implicitly (default `~/.clawdis/workspace` ) when local is selected,
but only if the folder is empty or already contains `AGENTS.md` .
2025-12-20 15:54:40 +00:00
- Files are seeded: `AGENTS.md` , `BOOTSTRAP.md` , `IDENTITY.md` , `USER.md` .
- `BOOTSTRAP.md` tells the agent to keep it conversational:
- open with a cute hello
- ask **one question at a time** (no multi-question bombardment)
- offer a small set of suggestions where helpful (name, creature, emoji)
- wait for the user’ s reply before asking the next question
- The agent writes results to:
- `IDENTITY.md` (agent name, vibe/creature, emoji)
- `USER.md` (who the user is + how they want to be addressed)
2025-12-20 17:38:54 +00:00
- `SOUL.md` (identity, tone, boundaries — crafted from the soul.md prompt)
2025-12-20 15:54:40 +00:00
- `~/.clawdis/clawdis.json` (structured identity defaults)
- After the ritual, the agent **deletes `BOOTSTRAP.md`** so it only runs once.
2025-12-14 03:59:24 +00:00
2025-12-20 15:54:40 +00:00
Identity data still feeds the same defaults as before:
2025-12-14 03:59:24 +00:00
2025-12-24 00:22:57 +00:00
- outbound prefix emoji (`messages.responsePrefix` )
2025-12-14 03:59:24 +00:00
- group mention patterns / wake words
- default session intro (“You are Samantha…”)
- macOS UI labels
2025-12-20 16:51:53 +00:00
## 5) Workspace notes (no explicit onboarding step)
2025-12-14 03:59:24 +00:00
2025-12-20 15:54:40 +00:00
The workspace is created automatically as part of agent bootstrap (no dedicated onboarding screen).
2025-12-14 03:59:24 +00:00
Recommendation: treat the workspace as the agent’ s “memory” and make it a git repo (ideally private) so identity + memories are backed up:
```bash
cd ~/.clawdis/workspace
git init
git add AGENTS.md
git commit -m "Add agent workspace"
```
2025-12-19 18:12:01 +00:00
Daily memory lives under `memory/` in the workspace:
- one file per day: `memory/YYYY-MM-DD.md`
- read today + yesterday on session start
- keep it short (durable facts, preferences, decisions; avoid secrets)
2025-12-14 03:59:24 +00:00
## Remote mode note (why OAuth is hidden)
2025-12-22 21:02:48 +00:00
If the Gateway runs on another machine, the Anthropic OAuth credentials must be created/stored on that host (where the agent runtime runs).
2025-12-14 03:59:24 +00:00
For now, remote onboarding should:
2026-01-01 14:21:22 +00:00
- explain why OAuth isn't shown
2025-12-22 21:02:48 +00:00
- point the user at the credential location (`~/.clawdis/credentials/oauth.json` ) and the workspace location on the gateway host
2025-12-20 15:54:40 +00:00
- mention that the **bootstrap ritual happens on the gateway host** (same BOOTSTRAP/IDENTITY/USER files)
2026-01-01 14:21:22 +00:00
### Manual credential setup
On the gateway host, create `~/.clawdis/credentials/oauth.json` with this exact format:
```json
{
"anthropic": {
"access": "sk-ant-oat01-...",
"refresh": "sk-ant-ort01-...",
"expires": 1767304352803
}
}
```
Set permissions: `chmod 600 ~/.clawdis/credentials/oauth.json`
**Note:** Clawdis can auto-import from legacy pi-coding-agent paths (`~/.pi/agent/oauth.json` , etc.) but this does NOT work with Claude Code credentials — different file and format.
### Using Claude Code credentials
If Claude Code is installed on the gateway host, convert its credentials:
```bash
cat ~/.claude/.credentials.json | jq '{
anthropic: {
access: .claudeAiOauth.accessToken,
refresh: .claudeAiOauth.refreshToken,
expires: .claudeAiOauth.expiresAt
}
}' > ~/.clawdis/credentials/oauth.json
chmod 600 ~/.clawdis/credentials/oauth.json
```
| Claude Code field | Clawdis field |
|-------------------|---------------|
| `accessToken` | `access` |
| `refreshToken` | `refresh` |
| `expiresAt` | `expires` |
2025-12-14 03:59:24 +00:00
<!-- {% endraw %} -->