--- name: busabase description: Connect or install Busabase, including 帮我连接 Busabase / 安装 Busabase, with recommended choices, sign-in links, and ongoing agent skills. --- # Busabase — first-run setup Connect the user, initialize only a new workspace, then install `busabase` and `busabase-app-creator` for ongoing use. Run only on the user's actual computer (see Step 0). The user already confirmed this edition in the preceding dispatcher (or entered through an authoritative Dashboard/local-app link). Work top to bottom, **in the user's language**, starting with connection. If not introduced yet, say: Busabase is an open-source database and workspace for AI agents: turn agent output into data, docs, skills, and apps you can actually use. Like a shared space station: one agent researches, another drafts. Do not repeat a welcome or ask them to choose an edition again. ## The journey at a glance — and how to run it Existing users skip initialization entirely: | # | Milestone | Covered by | Done when | | - | --------- | ---------- | --------- | | 1 | 🔌 **Connect** | Step 0 + Step 1 | the local API responds and the connection is saved | | 2 | 🏗️ **Initialize if required** | Step 2 + Step 3 | version-0 Space gets starter data | | 3 | ✅ **Verify** | Step 3 | starter writes and completion confirmed | | 4 | 🎓 **Skills installed** | Step 4 | both skills persist for this agent | **Conduct rules:** - Show a one-line progress tracker at milestone boundaries, e.g. `✅ Connect · ▶ Initialize · ○ Verify · ○ Skills`. - Ask one question per message with lettered options. Recommend one with a short reason based on their goal; otherwise favor the simplest start. "按推荐来" accepts it; silence does not. Respect prior answers. Never silently broaden access or enable start-on-boot. - Say workspace, table, and sign-in link; keep ids and installer details in tool work. - Announce the next action briefly, run it yourself, then confirm the outcome in plain words. Show commands only when the user must run them. Explain a multi-part step as a short plan first. Here is the first move. ## Step 0 — Connect to Busabase Personal Desktop Before any local probe or install, establish that this runtime is the user's actual computer. An SSH session, container, or hosted AI may run elsewhere. If unknown or remote, ask one plain question: "Can you open an assistant or the Busabase app on the computer where you want your data?" Wait until setup runs on that computer; do not start Busabase on the AI host or promise local privacy. Once on their computer, check whether the local app is running (no account or API key needed): ```bash curl -fsS http://localhost:15419/api/v1/bases # the tables in the workspace ``` That one call tells you where things stand: - **Connection refused** → nothing running yet. Go to **Step 1** to install or start it. - **Responds with `[]`** → installed but empty. Skip to **Step 2** to set it up. - **Responds with Bases already** → installed and in use. Jump to **Step 4 (ongoing use)**. Once it answers, **persist this connection** — the installed `busabase` skill and every future session read it from `~/.busabase/.env`. Local needs only the base URL (no key): ```bash npx --yes busabase-cli@latest login --base-url "http://localhost:15419" ``` Prefer that over writing the file yourself — it verifies the server is reachable and open before saving anything. **If this machine already has a Busabase account signed in**, that command replaces it: it is "connect to this instead". Keep both by giving the local one its own account instead: ```bash npx --yes busabase-cli@latest login --profile local --base-url "http://localhost:15419" # adds an account, switches to it npx --yes busabase-cli@latest auth status # see them all (* = active) ``` Never write `~/.busabase/.env` by hand once more than one account exists. That file is a copy of whichever account is active, so a raw `>` blanks that account's credentials — first for `curl`/SDK readers, then permanently, because the next write mirrors the truncated file back into the account's own `profiles/*.env`. Hand-writing is only for a machine with no CLI and a single account: ```bash mkdir -p ~/.busabase printf 'BUSABASE_BASE_URL=%s\n' "http://localhost:15419" > ~/.busabase/.env ``` ## Step 1 — Install & start (pick the execution mode that fits this machine) Don't default to the GUI download — **first detect the environment**, because a headless / SSH / container box can't open a `.dmg`, but it can run the terminal server directly: ```bash uname -s # Darwin = macOS, Linux = Linux; Windows agents check $OS echo "DISPLAY=$DISPLAY SSH=$SSH_CONNECTION" # empty DISPLAY + an SSH value ⇒ no desktop [ -f /.dockerenv ] && echo "in-container" ``` Decide: **desktop-capable** = macOS or Windows (not over SSH), or Linux with a non-empty `$DISPLAY`. Otherwise treat it as **headless** (SSH session, empty `$DISPLAY`, or in a container) and take Path A. ### Path A — Headless / terminal / container: run the server yourself No download, no GUI. Start the local server for the user and probe until it answers (a fresh start returns `[]`, which sends you to Step 2): ```bash npx -y busabase@latest server & # boots on http://localhost:15419; or: docker run -d -p 15419:15419 busabase/busabase until curl -fsS http://localhost:15419/api/v1/bases >/dev/null 2>&1; do sleep 2; done && echo "Busabase is up." ``` Then **offer start-on-boot — ask first, and only set it up if the user agrees** (this writes a system service). Recommend "Not now" for a first try; they can enable it later. On a yes: ```bash # macOS (launchd, per-user) mkdir -p ~/Library/LaunchAgents cat > ~/Library/LaunchAgents/com.busabase.server.plist <<'PLIST' Labelcom.busabase.server ProgramArguments/bin/sh-lcnpx -y busabase@latest server RunAtLoadKeepAlive PLIST launchctl load ~/Library/LaunchAgents/com.busabase.server.plist ``` ```bash # Linux (systemd --user) mkdir -p ~/.config/systemd/user cat > ~/.config/systemd/user/busabase.service <<'UNIT' [Unit] Description=Busabase local server [Service] ExecStart=/usr/bin/env npx -y busabase@latest server Restart=on-failure [Install] WantedBy=default.target UNIT systemctl --user enable --now busabase.service loginctl enable-linger "$USER" # keep it running without an active login session ``` ```bash # Windows (run at logon) schtasks /create /tn Busabase /sc onlogon /tr "npx -y busabase@latest server" ``` To undo later: `launchctl unload …plist` / `systemctl --user disable --now busabase.service` / `schtasks /delete /tn Busabase`. ### Path B — Desktop-capable: native app (recommended), or the terminal server On a machine with a desktop, **recommend the native app** — but offer the choice as one lettered question, since some users would rather not install anything: > How would you like to run Busabase? > **A.** 🖥️ **Desktop app** (recommended) — a native app, nothing to run in a terminal > **B.** ⌨️ **Terminal server** — I start `npx -y busabase@latest server` for you, no install If they say "use your recommendation", go with **A (Desktop)**. Wait for an answer before installing; silence is not consent. If they pick **B**, follow **Path A** above instead. **Desktop:** send the user to `https://busabase.com/download` — **macOS** `.dmg` (Apple Silicon / Intel), **Windows** `.msi`, **Linux** `.AppImage`. In plain words: download, install, and launch **Busabase** — it starts a local workspace automatically, no account. (You launch it yourself; to keep it always on, flip **Launch at login** in the app's title bar.) Then re-probe until it answers (it boots in a few seconds); a fresh install returns `[]`, which sends you to Step 2: ```bash until curl -fsS http://localhost:15419/api/v1/bases >/dev/null 2>&1; do sleep 2; done && echo "Busabase is up." ``` ## Step 2 — Choose a starter only for a new Space Enter this step when Cloud Step 0 returned `bootstrapRequired: true` (including a dashboard- preselected Space), or when Personal Desktop Step 0 returned an empty Base list. Existing users never see this question and receive zero data writes. Use a starter matching their stated goal without asking again. If none is clear, offer this question, recommend notes because it is easy to try, and let "按推荐来" accept it: > What would you like to try first? > **A. Save useful notes** (recommended if you're unsure) — an easy way to see how we share information. > **B. Track customers** · **C. Plan content** · **D. Track compliance** · **E. Something else** Map choices to field maps: A → 3, B → 4, C → 1, D → 2, E → 5. "Just go ahead" uses the recommendation. Keep the technical field maps in tool work: | # | Blueprint | Good for | | - | --------- | -------- | | 1 | **Content Pipeline** (+ CMS Pages) | publishing | | 2 | **Compliance Checklists** | audits | | 3 | **Knowledge Base** (recommended when unsure) | notes and FAQs | | 4 | **CRM Contacts** | customers | | 5 | **Something else** | design a custom starter | A starter is a **Base** (table) built from the field maps below. ### Blueprint field maps - **1 · Content Pipeline** (`content-pipeline`): `title` (text, required), `brief` (markdown), `channel` (select: blog/youtube/social), `status` (select: idea/draft/ready), `seo_title` (text), `asset` (attachment). Pair it with a CMS **Pages** base (`pages`) for AI-written HTML: `slug` (text, required), `title` (text, required), `meta_description` (text), `category` (select), `locale` (select: en/zh-CN), `html_body` (**html**, required), `status` (select: draft/in-review/live). The AI writes the HTML; the `status` field is what says it is live. - **2 · Compliance Checklists** (`compliance-checklists`): `item` (text, required), `owner` (email), `due_date` (date), `evidence` (attachment), `status` (select: missing/review/ complete), `notes` (longtext). - **3 · Knowledge Base** (`private-knowledge`): `title` (text, required), `body` (markdown), `source_url` (url), `sensitivity` (select: private/team/public), `tags` (multiselect), `attachments` (attachment). - **4 · CRM Contacts** (`crm-contacts`): `name` (text, required), `company` (text), `email` (email), `stage` (select: lead/qualified/customer/churned), `notes` (longtext), `last_touch` (date). ## Step 3 — Initialize automatically and idempotently This is the everyday write loop, not an exception to it: the user has write access to their own new Space, so structure and sample rows land immediately. They already chose this starter — do not ask them to approve it, and do not force a review by passing `autoMerge: false`. Every write carries system provenance and stable identity so retries cannot duplicate data. Briefly show what is being built: ```txt 📁 CRM └── 📊 Contacts name· company· email· stage(lead→customer)· notes· last_touch └─ relates to ─► 📊 Companies name· domain· tier· owner ``` Build folder-first so the user never lands in a flat root full of tables: - Folder / node-tree edits use an audited Node ChangeRequest with `"autoMerge": true`. One CR can hold MANY operations — a create op can declare a temp `ref` that a later op targets via `parentNodeRef`, so **you can create the folder AND the Bases/Docs inside it in a single CR** (no need to merge the folder first to learn its id). - `POST /api/v1/bases` carries `"autoMerge": true`; its stable slug makes retries idempotent. Pass `parentNodeId` when placing the Base under an already-merged folder (omit it for a root-level Base node). Worked example for blueprint #1: First list nodes and Bases. Skip any stable slug already present; create only missing pieces. ```bash curl -X POST "http://localhost:15419/api/v1/nodes/change-requests" \ -H 'content-type: application/json' \ --data '{ "message": "Create Content workspace folder", "autoMerge": true, "operations": [ { "kind": "create", "nodeType": "folder", "slug": "content", "name": "Content" } ], "submittedBy": "system-onboarding" }' # Use the folder node id from the merged response as parentNodeId below. # Fetch that folder only if the response does not supply the required id. ``` ```bash curl -X POST "http://localhost:15419/api/v1/bases" \ -H 'content-type: application/json' \ --data '{ "slug": "content-pipeline", "name": "Content Pipeline", "description": "Briefs, drafts, and SEO metadata reviewed before publishing.", "parentNodeId": "", "autoMerge": true, "fields": [ { "slug": "title", "name": "Title", "type": "text", "required": true }, { "slug": "brief", "name": "Brief", "type": "markdown" }, { "slug": "channel", "name": "Channel", "type": "select", "options": { "choices": [ { "id": "blog", "name": "Blog", "color": "slate" }, { "id": "youtube", "name": "YouTube", "color": "rose" }, { "id": "social", "name": "Social", "color": "violet" } ] } }, { "slug": "status", "name": "Status", "type": "select", "options": { "choices": [ { "id": "idea", "name": "Idea", "color": "slate" }, { "id": "draft", "name": "Draft", "color": "amber" }, { "id": "ready", "name": "Ready", "color": "emerald" } ] } }, { "slug": "seo_title", "name": "SEO Title", "type": "text" } ] }' ``` The response carries the new Base's `id` (e.g. `bse_...`) — use it below; create the Pages base the same way. Views are structure too, so they carry `"autoMerge": true` like everything above — a starter Base whose views are stuck in the review queue looks half-built to the user: ```bash curl -X POST "http://localhost:15419/api/v1/views/change-requests" \ -H 'content-type: application/json' \ --data '{ "operation": "create", "baseId": "", "name": "Ready to publish", "type": "table", "autoMerge": true, "config": { "filters": [{ "fieldSlug": "status", "operator": "equals", "value": "ready" }], "sorts": [] } }' ``` > **Always leave the workspace with more than one node.** A brand-new space holding a single empty > Base renders as an empty screen — there's nothing for the user to see. So before seeding, give it > structure: create a containing **folder** node and put the Base inside it, or create a second related Base > (e.g. CRM Contacts **+** Companies, or Content Pipeline **+** Pages). Combined with the seeded + > merged record in 3c, the user opens a populated tree, never a blank one. **3b. Seed 3–5 canonical sample records without review prompts.** Use one record call per sample because the single-record endpoint supports both `autoMerge` and `idempotencyKey`; the bulk endpoint does not auto-merge. Use a short human-readable PRIMARY field and stable versioned keys: ```bash curl -X POST "http://localhost:15419/api/v1/bases//change-requests" \ -H 'content-type: application/json' \ --data '{ "fields": { "title": "Launch announcement blog post", "brief": "What changed and why it matters to existing users.", "channel": "blog", "status": "draft" }, "message": "Initialize starter content draft", "submittedBy": "system-onboarding", "idempotencyKey": "system-onboarding:v1:content:launch-announcement", "autoMerge": true }' ``` (No `spaceId` in local mode.) Repeat with distinct stable keys for the other sample rows; confirm each write landed. **3c. Check responses, then mark bootstrap complete.** Require every expected node, Base, View and sample record/batch to have landed; pending CRs are incomplete. Fetch only missing required data or uncertain outcomes, not all records after success: ```bash curl -X POST "http://localhost:15419/api/v1/onboarding/bootstrap-complete" ``` Use the Desktop completion response; fetch completion status only if required information is missing. ### Custom blueprint (any scenario — this is what keeps it general) If the user picks *Something else*, don't hunt for a matching template — **design one**: 1. Ask what they manage and the few attributes that matter. 2. Build a Base with **4–6 fields**, using supported types (`select` for fixed choices, `markdown`/`html` for bodies, `attachment` for files, `embed` for YouTube/Google Drive previews, `email`/`url`/`date` for typed values), following the same shape as the starter blueprints. 3. Run the same idempotent **structure → sample records → check responses → mark complete** sequence. Starters are examples. Later writes follow the user's permissions; never approve a pending change unless asked. ## Step 4 — The last setup step: install the permanent skills One step left before everyday use. Install both permanent skills so the current agent can drive this workspace with **busabase** and create complete workspace apps with **busabase-app-creator** every session — no re-pasting this onboarding doc: ```bash npx skills add busabase/skills --skill busabase busabase-app-creator --global --agent --yes ``` `busabase` reads `~/.busabase/.env` for ongoing use; `busabase-app-creator` handles workspace apps. **Resolve installer choices for the user.** Say "I'll make Busabase available in future chats with this assistant." Use this Harness's id for `` (e.g. `codex`, `claude-code`); ask only if unknown, and keep a scope the user chose. Keep `--yes` or the installer waits on prompts you cannot answer. Verify both skills were installed for that agent; explain any reload. Reading this document is not installation. ## 🎉 You're set up — congratulations! Don't claim "you're connected / all set" before this point. Congratulate the user in their language only after all three outcomes are true: - ✅ **connected** — the host responds (you proved it in Step 0) - ✅ **workspace ready** — existing Spaces were left untouched; a new Space was initialized once - ✅ **skills installed** — `busabase` and `busabase-app-creator` are permanent, so everyday workspace work and app creation are available in future sessions > ✅ Connected · ✅ Workspace ready · ✅ Skills installed > 🎉 You're all set! I'm connected; you can bring another assistant here. ## What would you like to do next? After success in a new or existing space, offer these in the user's language. Recommend their goal or A for personal use. Await a choice; read space instructions and a matching playbook first. > **A. Try two assistants together** — save research, let another assistant draft. > **B. Make something** — notes, a to-do list, a collection, or an app. Templates are optional. **A:** Offer research → draft as an example; use real existing content or agree a small goal. Both assistants must run on this actual computer; give the next one http://localhost:15419/SETUP_SKILL.md. Never share keys, promise automatic spawning/scheduling, or grant membership by syncing. **B:** Build one small result from the user's idea. If asked to share remotely, explain Cloud; do not call member invitation APIs on Desktop. Later writes omit `autoMerge`: merged where the user can write, reviewed elsewhere. Only the onboarding initializer passes `autoMerge: true`, for starter data.