CLI
openbelt is one small binary (about 2 MB, cli/ in this repo). It does two jobs:
- Setup.
openbelt install <workspace url>signs you in (below; or--tokenwith an API token from/agents), then adds OpenBelt to the agents it finds on this machine: Claude Code, Codex, OpenCode, Cursor, VS Code, Claude Desktop, Windsurf, Gemini CLI, Zed, Amp, Antigravity, Cline, GitHub Copilot CLI and pi. Each gets an MCP server entry that startsopenbelt mcp, which passes MCP through with your sign-in, so no agent's config holds a token. Edits keep comments, formatting, symlinks and user keys in existing entries, and leave a different server namedopenbeltuntouched. Runinstallagain to add agents (-a codex cursor,-a '*'for all,-a noneto print the MCP entry only);-yskips the picker.openbelt uninstallsigns out, removes OpenBelt from every agent config, and cleans up its local files and installed binary. - Using the workspace. Every other command is one of the workspace's MCP tools, such as
openbelt search,openbelt app deploy <folder>,openbelt fn run <app>.<function> '<input>',openbelt data list <app>/<collection>andopenbelt data update.openbeltalone lists them;openbelt <command> --helpgives a command's flags, from the tool's input schema.
curl -fsSL https://openbelt.com/install | sh # the CLI, then openbelt install (it asks for your workspace)
openbelt search expense claims
openbelt fn run expenses.file '{"amount": 42, "what": "lunch"}' --key lunch-1108
openbelt data list expenses/claims --limit 50 | jq '.docs[].data'
openbelt app deploy ./standup
Arguments and output
- Commands and help come from the tools your sign-in may use. Workspace admins get people, groups, workspace settings and connection management; members get their own settings and app tools. Each invocation reads the current tool list, so a role change applies to the next command.
- Personal connection settings and tokens are the default.
--workspaceselects a separate workspace operation where offered, such asconnection accessortoken list. It requires an admin and never falls back to changing your own settings. Commands only admins use, such aspeople inviteandconnection add, need no scope flag. - Words in a command line are the tool's arguments:
<app>/<collection>and<app>.<function>are two in one word. Everything else is a--flag, named as in the tool's input schema (--kebab-case,--snake_caseand--camelCaseall match;--no-<flag>turns a boolean off). - A value is text, a number, or JSON (
'{"a": 1}',@file.json, or-for stdin). A JSON array todata addadds several documents; todata update, an array of{ "id", "data" }changes them all in one call (up to 500, all or none), as a word or on stdin. data list --allfollows the cursor and prints every document as one list, so a whole collection goes throughjqand back:openbelt data list shop/orders --all | jq '[.docs[] | select(.data.status == "open") | {id, data: {status: "late"}}]' | openbelt data update shop/orders.data changes <app>/<collection> --followprints each change as one JSON line as it happens, until stopped (from now, or from--since <cursor>), so a shell loop reacts to a collection:openbelt data changes board/tasks --follow | while read -r change; do …; done. Without--follow,--wait <seconds>holds one call until something changes.- In a terminal, results print as YAML-like text; piped (or with
--json), as JSON. --agent <name>on any command (orOPENBELT_AGENT, whichopenbelt mcpreads too) names the agent acting for you: what it writes carriesagent: "<name>", so several agents on one sign-in stay apart. 1-40 lowercase letters, digits,.,_and-.- A result with an image (a check's screenshot, an app's picture) saves it to a file in the
temp folder (or the path given to
--output <path>) and names its path:screenshotforapp check --screenshot,imagefor others. - Exit codes: 0 done, 1 OpenBelt refused (the message says why and what to run next), 2 a usage mistake (it names the flags there are).
app deploy <folder>sends every file in the folder but dotfiles andnode_modules, as the app named after the folder (or--app).app pull <app> [folder]writes an app's files out.- A tool with no command of its own is reached with
openbelt call <tool> '<json>':execute(Code) has none, since a shell already chains commands.
Getting it, and keeping it current
The platform hands out the CLI it was built with, so it always matches the server, from its own
address (https://openbelt.com, OPENBELT_HOST) and from each workspace's host:
curl -fsSL https://openbelt.com/install | shputsopenbeltin~/.local/bin(OPENBELT_INSTALL_DIR, or$XDG_BIN_HOME, picks another folder), checks it against its sha256, and runsopenbelt install, which signs in to the OpenBelt the script came from without asking (under email sign-in, signing in there picks or creates your workspace; from a workspace's host,curl -fsSL https://acme.openbelt.app/install | sh, it's that workspace). The agents found on this machine are listed first, already ticked;-ytakes them (or only the agent running the command) without asking, as an agent's shell needs. With-y(or with no terminal), a sign-in only starts:installprints the code the page shows and ends at once, so the agent running it can tell the person that code, thenopenbelt login --waitwaits for them and sets up asinstalldoes. Arguments aftersh -s --go on toopenbelt install(a workspace,--token,-y,-a codex), except--dry-run:curl -fsSL https://openbelt.com/install | sh -s -- --dry-rundownloads and checks the CLI and installs nothing. In a terminal the script draws OpenBelt's logo while it downloads; piped or withNO_COLORit prints plain lines. On Windows, download/_cli/openbelt-x86_64-pc-windows-gnu.exe.openbelt updateasks the workspace you're signed in to for its build (/_cli/openbelt-<target>.sha256) and, when it differs from yours, downloads it, checks the sha256, and puts it in place of this one.--checkonly says;openbelt --versionprints this binary's 12-character build hash. Once a day on an interactive terminal (skipped whenCIorOPENBELT_NO_UPDATE_CHECK=1is set), another command checks too and says on stderr when there's a newer one.- The image builds the CLI for macOS (Apple silicon and Intel), Linux (x86-64 and arm64, static)
and Windows (x86-64) in its own stage (the
Dockerfile), cached apart from the platform: a change elsewhere doesn't rebuild it, and a change tocli/srcrebuilds only the CLI, not its dependencies. A checkout serves its own machine's build afterbun run cli:dist(OPENBELT_CLI_DIR, defaultcli/dist).
Signing in
openbelt login [workspace url] (and install) prints a link and a short code, like BCDF-GHJK,
and opens the link in your browser. Check that the page shows the same code, then Continue and
Allow. The link works in any browser, so on a server or over SSH (where no browser opens, nor with
--no-open) open it on your laptop or phone, or go to <workspace>/_oauth/device and type the code.
The CLI waits up to 10 minutes and saves the sign-in once you allow it. openbelt install -y
doesn't wait: it keeps the started sign-in in pending.json beside the credentials (yours alone)
until openbelt login --wait finishes it. Under the hood this is
OAuth's device sign-in (RFC 8628), described in MCP.
Where it keeps things
The sign-in is ~/.config/openbelt/credentials.json (or under $XDG_CONFIG_HOME), readable by you
alone: an API token, or OAuth tokens it renews by itself. openbelt logout signs out and revokes
them; openbelt status [--json] says which workspace you're in, as whom, your CLI build, and which
agents have OpenBelt (and still works offline); openbelt uninstall removes OpenBelt from your
agents and deletes its local files.
For OpenBelt's own code
Commands come from each tool's _meta["openbelt/cli"] in packages/platform/src/mcp.ts (cli(...)):
a usage line and a one-line summary. A new tool gets its command there; one with none is reached
with openbelt call <tool> '<json>'. The server's hints name MCP calls (function_runs({ app }));
the CLI says them as the commands that make them.
The CLI lists every operation as a command (its session says it is openbelt-cli); an agent's
tools/list gives only search and call (MCP).
Source: docs/cli.md on GitHub