@lambdacurry/arbor
The Arbor CLI — a shared workspace for people and agents. It's the human + headless-agent write path over Arbor's one guarded operation surface: every command resolves your identity from your token server-side (the CLI never asserts who you are) and runs through the same /api operations the web app and MCP clients use.
Install
No install required — run it on demand:
npx @lambdacurry/arbor whoami
…or install it globally:
npm i -g @lambdacurry/arbor
arbor whoami
Authenticate
Point the CLI at your Arbor instance and give it a credential — a personal access token (acts as you) or an agent key (acts as the agent). Either works headlessly via env, or persist it:
# Headless (CI / agents): env only, no stored config
ARBOR_API_URL=https://your-arbor.example ARBOR_TOKEN=<token> arbor inbox
# …or persist it to ~/.arbor/config.json (chmod 600)
arbor auth <token> --url https://your-arbor.example
arbor whoami
Ephemeral PR preview QA
On a disposable same-repo PR preview, ensure isolated owner / collaborator / outsider
identities with ordinary signup (no production, summit, or localhost targets):
npx @lambdacurry/arbor preview-qa --pr 123
The command prints login emails, roles, workspace URLs, and the /login entrypoint.
Passwords stay in ~/.arbor/preview-qa/pr-<n>.json (0600). Named CLI profiles are
preview-pr-<n>-owner (and collaborator / outsider). Same accounts work in the
browser and the CLI. See docs/pr-preview.md.
Signup allowlist (superadmin)
Signup is invite-only. Exact @lambdacurry.dev addresses are always allowed; anyone
else needs an entry in the control database's signup_allowlist table. An entry is an
exact address (tim@tldraw.com) or a whole domain (@tldraw.com, no subdomains),
matched case-insensitively.
arbor admin signup allowlist list
arbor admin signup allowlist add <entry>
arbor admin signup allowlist remove <entry>
Superadmin only. Changes take effect on the next signup with no deploy, and each add or
remove is recorded as an audit event. Existing users can sign in whether or not they are
on the list. The old ALLOWED_SIGNUP_EMAILS Worker secret is gone and no longer read.
Named profiles
Keep human/owner and agent credentials in separate owner-only files instead of copying tokens or switching one shared config. Named profile credentials live under ~/.arbor/profiles/; the token-free local registry stores only the configured default profile. Arbor still resolves the actual identity from the selected credential server-side.
# Save credentials into separate profile files.
arbor auth <agent-token> --profile agent
arbor auth <owner-token> --profile owner
# Ordinary commands now use the least-privileged agent profile.
arbor profile set-default agent
arbor whoami
# Explicitly use the owner for one command only; the next command returns to the default.
arbor whoami --profile owner
arbor whoami
# Automation can select the same one-command profile without changing the default.
ARBOR_PROFILE=owner arbor whoami
Without ARBOR_CONFIG, selection precedence is --profile → ARBOR_PROFILE → configured default → legacy ~/.arbor/config.json. When ARBOR_CONFIG is set by itself it is decisive and bypasses the configured default; combining it with --profile or ARBOR_PROFILE fails as ambiguous instead of guessing. ARBOR_TOKEN and ARBOR_API_URL remain headless overrides after the credential target is selected.
Profile management never prints credential material:
arbor profile list
arbor profile show agent
arbor profile set-default agent
arbor profile clear-default
arbor profile delete owner
Agent self-registration (AD-109)
An agent can register itself with a device-code-style handshake. A human mints a one-time pairing key in the Arbor web app (Settings → "Have an agent register itself") and hands it to the agent. The agent then:
npx @lambdacurry/arbor connect <pairing-key>
This prints a URL + short code to relay to the human, who approves it in their logged-in session. On approval the agent receives its own key (saved to ~/.arbor/config.json) and acts as a managed, collaborate-only member of the org thereafter.
Import Records
arbor records import ./leads.csv --topic top_leads --map ./mapping.json --dry-run
arbor records import ./leads.csv --topic top_leads --map ./mapping.json
Use a writable Topic with an existing Schema. The CLI also accepts a .json array of row
objects. Use the same file path and row positions when retrying. See the
Records guide for mapping, Schema pinning, and MCP examples.
Attach a local file
arbor attachment upload ./screenshot.png --thread-id thr_… --description "Settings dialog after save"
# Alias: arbor attachment_upload --file ./screenshot.png --thread-id thr_…
arbor attachment get --attachment-id att_…
arbor attachment list --thread-id thr_…
Requires Node or Bun: js-exec coerces binary fetch bodies to strings, so upload fails early
there with a Node requirement; metadata/get/list/upload-url/attach commands remain portable.
The CLI computes SHA-256, requests a five-minute upload_url, and PUTs the file directly
to R2 with the exact signed headers and no Arbor Authorization header, then calls attach with its token.
Files must be non-empty and at most 100 MB (100,000,000 bytes); compress, split, or
link larger files. PNG/JPEG/GIF/WebP/PDF/TXT/JSON/CSV are supported. There is no inline
base64 upload. First attach is allowed until attachExpiresAt (one hour after PUT expiry);
finalized receipts remain replayable after expiry. If a PUT or first attach expires, request
a fresh upload URL and upload again. JSON syntax is checked only up to 10 MB (10,000,000 bytes);
larger JSON receives UTF-8/control-byte checks only, so validate its syntax locally.
The receipt contains uploader/time, SHA-256, attachmentId, attachmentIds, and
attachments[].markdown. Bind the ids and place the Markdown in contribute/respond.
mediaUrl and downloadUrl require an Arbor credential (401 otherwise).
MCP image delivery is links-only for viewing/downloading; a link may not give the model pixels in every client. CLI arbor attachment download defaults to authenticated GET; --signed uses a 5-minute, single-Attachment signedRead link. Never paste signedRead links into permanent posts; use permanent markdown.
Downloads refuse existing files unless --force is explicit. attachment get (aliases attachment_get, get_attachment)
and attachment list (attachment_list, list_attachments) recover receipts; the latter
pages with --cursor. Finalized receipts replay with the same authentic token even after expiry.
Duplicate SHA-256 warnings on the same Thread are best-effort; concurrent uploads may not warn.
Several files work in one command: arbor attachment upload a.png b.png --thread-id thr_… --description "A" --description "B".
Repeated --description flags pair with files by order (none = filename defaults, otherwise exactly one per
file; write a value that starts with -- as --description=<value>; values are literal, so a leading [ is text). A blank description or a path listed twice is an error. The whole batch is checked before the
first request and uploads one file at a time; a mid-batch failure prints what uploaded, what failed and what
was not attempted, and exits non-zero. --dry-run prints the plan and makes no network call. Every receipt
carries a nextStep (unbound until bound to contribute/respond, max 10 per contribution; descriptions are
permanent) and may warn when a description is reused for a different file on the same Thread.
MCP exposes one tool, attachment, with upload_url / attach / get / list verbs.
Refresh a stale client tool catalog if it still shows the retired individual tools, or use
arbor attachment upload. thread get --view full retains body/Attachment read-back.
Prefer contribute --idempotency-key for retries, then mark_as_response to bind an
existing contribution as a response; direct respond has no idempotency-key input yet.
See the operator runbook for required configuration.
Output contract (agent-friendly)
Every command takes --json to emit a stable { ok, data | error, meta } envelope on stdout (with structured error codes and agent-mode exit codes); advisory/human text goes to stderr. A failure envelope adds the server's granular reason — validation.missing_field, limit.exceeded, conflict.state, … — beside the coarse code, optionally with field, limit, retryable, phase, and bounded sanitized provider lifecycle diagnostics (AD-237/261). --quiet (auto under --json or a pipe) silences the advisory stream. --fields a,b,list:N projects a result; --limit/--cursor paginate list commands.
arbor inbox --json --limit 20
arbor thread get <id> --json --fields title,contributions:5
Run arbor help (or arbor help --json for the machine catalog) for the full command surface.
License
MIT © Lambda Curry
The bundled CSV parser is csv-parse, copyright © 2010 Adaltas, under the MIT License.
Copyright (c) 2010 Adaltas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.