--- 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. 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 | a verified MCP integration, or device login, returns the selected Space | | 2 | 🏗️ **Initialize if required** | Step 1 + Step 2 | version-0 Space gets starter data | | 3 | ✅ **Verify** | Step 2 | starter writes confirmed and completion returns version 1 | | 4 | 🎓 **Skills installed** | Step 3 | 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 Cloud ### 0a. MCP first Ask the Harness to discover and use an existing Busabase MCP integration before CLI. Call "list_integration_tools" with "providerKey: busabase-cloud-mcp" to find the Busabase integration, if the tool exists. Verify it with a read-only identity and Space check; reconnect it first if configured but disconnected, and do not assume tool names. With no preselected Space, honor a user-named or verified configured target; otherwise use the only result or ask when there are several. Accept a new personal Space when the identity has no memberships. If verification succeeds, skip **0b** and keep MCP for this run. Otherwise use the CLI fallback. **No terminal:** use the integration's advertised setup prompt or onboarding guide for its shell-free workflow. Without an integration, guide them to their client's connector settings; ask which AI app only if unknown. Do not send CLI commands or claim permanent skills were installed when the client has no persistent skill store. ### 0b. CLI fallback Sign in, then confirm the Space. #### Sign in Before signing in, list saved accounts (no key is sent): `npx --yes busabase-cli@latest auth status --output json`. Try only a profile whose `baseUrl` is exactly `https://busabase.com` and `credential` is not `none`: `npx --yes busabase-cli@latest whoami --output json --profile ` — never `--base-url`, which would send that key to another host. If valid for the target, reuse its summary below; skip login. Its `spaces` is login's `availableSpaces`; use `space.id` and `space.name` for the selected target. Sign-in is two commands, one per conversational turn. The first returns immediately, so the user actually receives the link even if your harness only delivers a turn's final message: ```bash npx --yes busabase-cli@latest login --no-wait --output json --base-url https://busabase.com ``` It returns `verification_url`, `user_code` and `resume_code` right away, and writes no credential yet. Show `verification_url` to the user exactly as returned — it is an opaque string, so never re-encode, trim, or re-wrap it — then **end your turn** so they can approve it on any device. To let them approve from a phone, render it as a QR code with `npx --yes busabase-cli@latest qrcode "" --out-file qr.png` and include the image in your reply. After the user confirms they approved, finish the sign-in in a later turn: ```bash npx --yes busabase-cli@latest login --resume-code --output json --base-url https://busabase.com ``` Continue from its safe summary: selected Space, `availableSpaces`, `createdSpace` and `bootstrapRequired`. Never ask the user to paste a secret, print `~/.busabase/.env`, or start a second login while one is pending — a fresh login invalidates the link the user is about to approve. If `resume_code` has expired or authorization failed, explain what happened; if the user still wants to continue, start over from the `--no-wait` command above once. Branch on the summary's `bootstrapRequired` alone, never on whether a Space happens to be empty: - **`bootstrapRequired: false`** → existing user/Space, including a preselected empty Space with no bootstrap marker. Connect only and jump to Step 3 with zero structure or record writes. - **`bootstrapRequired: true`** → the selected Space was auto-created for this user and still carries the persistent version-0 bootstrap marker. Ask the Step 1 scenario question, then initialize this Space even when the dashboard preselected it. An interrupted version-0 setup safely resumes Step 2. ### 0c. Confirm the target Space Login never asks which Space to use: it takes the server default (the Space the user was most recently active in). Show its name, keep ids in tool calls. Use a named or verified configured target without asking again. Otherwise check `availableSpaces`: - **One** → nothing to choose. Continue with the `bootstrapRequired` branch from 0b. - **More than one** → ask once, a lettered choice in the user's language: `A` keeps the current Space (recommended: used most recently), then one per remaining entry. Offer Spaces, never commands — switching is your job, so never tell the user to run anything. > **A.** Keep **{space.name}** (recommended: used most recently) **B.** {otherSpace1.name} … On a switch, run both; re-decide the 0b branch from the new `bootstrapRequired`: ```bash npx --yes busabase-cli@latest space use npx --yes busabase-cli@latest whoami --output json ``` On MCP, resolve the target Space from the verification result: honor the named or configured target; otherwise use one result; ask the user when there are several. Then follow `bootstrapRequired`: `false` goes to Step 3 with no writes; `true` goes to Step 1. Before the first write, require write access plus capabilities to inspect, propose, check results, and complete bootstrap. If anything is missing, stop before writing; ask the user to reconnect with more access or approve CLI fallback. Keep the same transport for the rest of the run. ## Step 1 — 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 2 — 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. **MCP path:** skip the shell examples and have the Harness run the same sequence: inspect, create missing structure/views, seed with stable idempotency keys, check the write responses, then complete bootstrap. Require merged structure/records and `materialized: true` views; otherwise stop for approval and resume only after the approval result or a targeted View read confirms materialization. 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 "$BUSABASE_BASE_URL/api/v1/nodes/change-requests" \ -H "Authorization: Bearer $BUSABASE_API_KEY" \ -H "x-busabase-space: $BUSABASE_SPACE_ID" \ -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 "$BUSABASE_BASE_URL/api/v1/bases" \ -H "Authorization: Bearer $BUSABASE_API_KEY" \ -H "x-busabase-space: $BUSABASE_SPACE_ID" \ -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 "$BUSABASE_BASE_URL/api/v1/views/change-requests" \ -H "Authorization: Bearer $BUSABASE_API_KEY" \ -H "x-busabase-space: $BUSABASE_SPACE_ID" \ -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 "$BUSABASE_BASE_URL/api/v1/bases//change-requests" \ -H "Authorization: Bearer $BUSABASE_API_KEY" \ -H "x-busabase-space: $BUSABASE_SPACE_ID" \ -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 }' ``` (Keep `x-busabase-space: $BUSABASE_SPACE_ID` — the Step 0 space — on every call; the key is user-scoped.) 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 "$BUSABASE_BASE_URL/api/v1/onboarding/bootstrap-complete" \ -H "Authorization: Bearer $BUSABASE_API_KEY" \ -H "x-busabase-space: $BUSABASE_SPACE_ID" ``` Completion is idempotent and preserves other onboarding state. Its response confirms `completed: true` and `agentBootstrapVersion: 1`; no follow-up `whoami` is needed. ### 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 3 — The last setup step: install the permanent skills Have the Harness install both skills into its persistent skill store when supported. Prefer its native installer; otherwise run: ```bash npx skills add busabase/skills --skill busabase busabase-app-creator --global --agent --yes ``` MCP remains the transport when it connected successfully; installing skills does not require CLI credentials. With a persistent store, finish only after both skills are available in future sessions. Otherwise use Step 0a's shell-free setup; report connection success, not permanent installation, and skip the full installation-success reply below. **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. List C only if `npx --yes busabase-cli@latest whoami --output json` shows `member.role` owner/admin; else omit it. > **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. > **C. Bring a friend** — get a link to invite them into this space. > **D. Join a space I was invited to** — use an invitation someone sent me. **A:** Offer research → draft as an example; use real existing content or agree a small goal. Each assistant signs in separately. Use this document's or configured MCP's origin plus /SETUP_SKILL.md?edition=cloud&editionConfirmed=1&space=. If hidden, ask for Dashboard's Connect-agent prompt. Never share keys, promise automatic spawning/scheduling, or grant membership by syncing. **B:** Build one small result from the user's idea. **C:** "发我邀请链接" is enough: run `npx --yes busabase-cli@latest members create-invite-link`; return its exact URL. By email: confirm each address and role (member unless asked), then run `npx --yes busabase-cli@latest members invite --email
` once per address. 403: not owner/admin, or admin needs a manage key — say which, offer member. 404: this server cannot invite by API — point to https://busabase.com/dashboard?settings=space&tab=people. Inviting people differs from connecting your own assistant. **D:** Use the exact member invitation or SETUP_SKILL.md?invite=… guide. Preserve tokens; wait for authorization, never create a replacement space, silently switch or initialize it. Finish the congratulations with a clickable Markdown link labeled **Open Busabase Dashboard**. Replace `{space_id}` with the real selected Space ID — whichever path you connected through resolved and confirmed it — before replying. Never show `$BUSABASE_SPACE_ID`, `{space_id}`, `YOUR_SPACE_ID`, or any other placeholder literally to the user. The user's final line must be: > 🔗 [Open Busabase Dashboard](https://busabase.com/dashboard/{space_id}/home) Later writes omit `autoMerge`: merged where the user can write, reviewed elsewhere. Only the onboarding initializer passes `autoMerge: true`, for starter data.