CLI
Install the Cohub CLI, sign in, choose a target Space, and run Space work from a terminal.
This page is for running Cohub work from a terminal instead of the web app: asking a Chat to do something, moving files in and out of a Space, publishing an App, reading a Board, or generating media. It covers installation, sign-in, how the CLI decides which Space a command acts on, every top-level command group, and the errors you are most likely to hit. For a worked example, see drive an AI agent in a Space from your terminal.
Package: @neta-art/cohub-cli (Node.js 24 or newer).
Install
npm install -g @neta-art/cohub-cli
cohub --help
To give a local coding agent the Cohub skills (Antigravity, Claude Code, Codex, Cursor and others):
npx skills add netaart/cohub
Sign in
cohub auth login
cohub auth whoami
cohub auth login uses Logto device authorization: open the printed page, enter the code, and the session is stored under ~/.config/cohub. The CLI refreshes the access token automatically; cohub auth token prints a valid one, cohub auth refresh forces a refresh, and cohub auth logout clears the stored session.
In a sandbox, CI job or other ephemeral run, COHUB_EXECUTION_TOKEN replaces the stored session. When it is set, the CLI never falls back to a local login.
Auto-update
The CLI checks for a newer release in the background and installs it with npm; the running command is never blocked, and the new version takes effect on the next invocation. Set COHUB_CLI_AUTO_UPDATE=0 to turn this off. This matters in CI, where a surprise global install is unwelcome.
Environments and endpoints
Production is the default. ENV=dev selects the development environment:
ENV=dev cohub auth login
ENV=dev cohub spaces ls
Point the CLI at a self-hosted deployment or a proxy:
cohub --base-url https://api.example.com spaces ls
COHUB_BASE_URL=https://api.example.com cohub spaces ls
--base-url wins over COHUB_BASE_URL. Without either, the selected environment's default API address is used. Individual endpoints are configured separately:
| Variable | Endpoint |
|---|---|
COHUB_BASE_URL |
API base URL |
COHUB_WS_URL |
Realtime gateway URL (http(s) or ws(s)) |
COHUB_WEB_URL |
Web base URL used in links |
Changing the API address does not change the gateway or the authentication provider. For self-hosted authentication set COHUB_AUTH_ISSUER and COHUB_AUTH_CLIENT_ID, and COHUB_AUTH_RESOURCE / COHUB_AUTH_SCOPE when your provider needs them. Stored sessions, the Home Space cache and Runtime directory bindings are scoped to the API base URL, so each custom server needs its own sign-in or an execution token.
Other environment variables the CLI reads: COHUB_SPACE_ID (default target Space), COHUB_NO_DIRECT=1 (send files and screens through the API even when this machine serves the Space), and HTTPS_PROXY / HTTP_PROXY / NO_PROXY for API calls and uploads.
Global flags
| Flag | Purpose |
|---|---|
-s, --space <space> |
Target Space for space-scoped commands |
--base-url <url> |
Override the API base URL |
--json |
Machine-readable output where supported |
-v, --version |
Print the CLI version |
-h, --help |
Command help |
Which Space a command acts on
Most commands need a Space. The CLI resolves it in this order:
-s, --space <space>COHUB_SPACE_ID- the Space bound to the current directory (or its nearest bound parent) by
cohub runtime up - for commands that start new work only —
prompt,completion,decision,generate,apps,public— your Home Space
Every other Space command reads or changes existing Space state, so with no target it stops with an error instead of guessing. <space> is a Space ID, a slug you own such as home, or username/slug.
cohub -s <spaceId> spaces get
cohub -s home spaces files ls
COHUB_SPACE_ID=<spaceId> cohub spaces get
cohub run is the exception: it never falls back to Home, and without -s or COHUB_SPACE_ID it uses the current directory's Runtime binding.
Terminology
| UI | CLI |
|---|---|
| Chat | Session |
| Save | Checkpoint |
| Tasks | Task runs |
| Scheduled prompt | cohub prompt --cron / cohub cron-jobs |
Command groups
Every top-level command from cohub --help:
| Group | What it does |
|---|---|
cohub auth |
Sign in, print a token, refresh, sign out |
cohub profile |
Read a public profile, update yours, upload an avatar |
cohub me |
Sessions, billing, wallet activity and usage across all your Spaces |
cohub spaces |
Spaces, files, sessions and turns, members, access, invites, checkpoints, labels, displays, webhooks, commerce, wallet, usage |
cohub labels |
Personal labels: list, create, rename, delete, reorder |
cohub prompt |
Send or schedule a prompt in a Space |
cohub completion |
Raw LLM completion with full message control |
cohub decision |
Yes/no, choice and score questions about text or images |
cohub run |
Run a shell command in the Space workspace |
cohub generate |
Generate images, video, audio, music and 3D |
cohub models |
List LLM and multimodal models and their prices |
cohub byok |
Connect and share your own model subscription |
cohub apps |
Publish and manage Apps, versions, domains, grants and App Actions |
cohub boards |
Read, write, animate, present and export Boards |
cohub rooms |
Join an App's realtime room, read and publish events, RTC media |
cohub displays |
View and act on screens a Space's machine shares (cohub spaces displays) |
cohub desktop |
Open a file or App window in the Cohub desktop that started the Chat |
cohub runtime |
Connect a local folder as the Space Runtime |
cohub public |
Upload and manage public Space files |
cohub tasks |
List task runs and read one |
cohub cron-jobs |
List, update, pause, resume and delete scheduled jobs |
cohub search |
Search Spaces, Chats and label items |
cohub references |
Inspect forks, mentions, tool calls and file access |
cohub inbox |
Read notifications kept for later |
cohub notifications |
Choose which channel each notification kind uses |
cohub referrals |
View and rotate your referral link |
cohub skills |
List skills available for slash commands |
cohub prompts |
List prompt templates |
cohub feedback |
Send feedback or a bug report to the Cohub team |
cohub version |
This CLI, the cohub on PATH, and each running Runtime |
cohub help |
Help for any command |
Prompt a Chat
cohub -s <spaceId> prompt "Fix the failing tests" --json
cohub -s <spaceId> prompt "Fix the failing tests" --wait --json
cohub -s <spaceId> prompt "Fix the failing tests" --stream --timeout 10m
cohub -s <spaceId> prompt --title "Planning" "Draft a launch plan" --json
cohub -s <spaceId> prompt --session <sessionId> "Continue from the diff" --json
cohub -s <spaceId> spaces sessions turns wait <sessionId> <turnId> --json
--wait (and --stream, which implies it) listens on the realtime connection with HTTP reconciliation until the Turn settles, following merged turns automatically. --timeout and Ctrl-C only stop waiting; the cloud Turn keeps running, and spaces sessions turns wait re-attaches. Add --abort-on-timeout to stop the Turn at the timeout; Ctrl-C never stops it. Without --timeout it waits until the Turn settles.
Other useful flags on cohub prompt: -m/--model, -p/--provider, --harness (cohub, pi, codex, claude, workbuddy, cursor, antigravity), --thinking-level, --context-window, --compact-first, --read-only, --steer, --image, --note (record without a reply), --reply (send the result back to the calling Chat), --env key=value and --label.
Schedule one run or a repeat:
cohub -s <spaceId> prompt --at "2026-07-20T09:00:00+08:00" "Weekly review" --json
cohub -s <spaceId> prompt --cron "0 9 * * 1" --timezone Asia/Shanghai "Weekly review" --json
cohub cron-jobs then manages those schedules: ls, get <id>, update <id>, toggle <id> on|off, runs <id>, delete <id>.
Other model calls
cohub completion sends your own message list and returns a raw LLM response. It accepts -m/--model, -p/--provider, --system-prompt <path> (a Space file), --stream, --temperature, --max-tokens and --thinking-level.
cohub decision answers structured questions about text or images. Questions are inline JSON or a JSON file; local images are uploaded as WebP first.
cohub decision "I was charged twice" -q questions.json
cat ticket.txt | cohub decision -q questions.json --json
cohub decision "Duplicate charge?" --image receipt.png -q questions.json
cohub decision --input request.json
Text and --image append to a text or array state from --input without replacing it. A JSON object state cannot be combined with extra text or images; express the whole state as an array instead.
cohub -s <spaceId> generate "A calm lake at sunrise" -m <model> -o lake.png
cohub -s <spaceId> generate -m song2 --text "prompt=upbeat synthwave" --text "lyrics=[Verse] Neon lights" --param seed=42
cohub -s <spaceId> generate "Restyle this image" -m <model> --image input.png
cohub generate takes -m/--model, repeatable --text <role>=<text>, --image/--video/--audio/--3d, repeatable --param key=value, --parameters <json>, -o/--output, --inline, --async and --json. Local input files are uploaded to an unlisted public URL unless you pass --inline. Use cohub models ls --model-type multimodal to find a model and cohub models show <model> for its text input roles.
cohub models ls prints each LLM's per-million-token price and hides hidden models; --model-type multimodal lists generation models by category (image, video, audio, 3d, decision), with --json for the raw pricing object.
cohub byok connects your own subscription with a device code and shares it with others; cohub byok list, show <name>, share, unshare, leave and rm manage it. See BYOK for the credential and sharing model.
Files
cohub -s <spaceId> spaces files ls
cohub -s <spaceId> spaces files cat README.md
cohub -s <spaceId> spaces files cat logo.png > logo.png
cohub -s <spaceId> spaces files write notes.md < notes.md
cohub -s <spaceId> spaces files write notes.md -c "hello"
cohub -s <spaceId> spaces files upload ./src
cohub -s <spaceId> spaces files cp -r <otherSpaceId>:assets assets
cohub -s <spaceId> spaces files diff
spaces files write takes the content from -c/--content. Without -c, when stdin is not a terminal, it reads stdin, so < file and pipes work; there is no --stdin flag. -e base64 writes binary content.
cp works like scp: the last path is the destination, and <space>:<path> names a Space by id, username/slug, or the slug of a Space you own. Bare paths address the current Space when -s or COHUB_SPACE_ID declares one, and local files otherwise, so one command uploads, downloads, or copies between Spaces. Copies between Spaces run server-side, so file content never passes through the CLI.
upload places each file under the target directory; a directory argument contributes its contents directly, so upload dist --dir apps/demo lands at apps/demo/index.html, not apps/demo/dist/index.html. mkdir, rm -r and mv cover the rest. diff shows pending workspace changes against the last checkpoint.
Paths are relative to the current directory when it is inside the Space workspace (/workspace in its sandbox, or a Runtime directory); an omitted path is the Space root. Paths printed by ls --json are from the Space root.
Run a command in the Space
cohub -s <spaceId> run -- git status
cohub -s <spaceId> run --command "pnpm test"
cohub -s <spaceId> run --async --command "pnpm build"
The command runs in /workspace in the Space's sandbox. Use --command when the command starts with a flag, or -- before the shell command. --async queues the run and returns its task ID.
Spaces, Chats and Saves
cohub spaces ls --json
cohub spaces create --name "Demo" --json
cohub spaces get <spaceId> --json
cohub -s <spaceId> spaces sessions ls --json
cohub -s <spaceId> spaces sessions create "Planning"
cohub -s <spaceId> spaces checkpoints create "Before refactor"
cohub -s <spaceId> spaces checkpoints ls
Invites and access:
cohub -s <spaceId> spaces invites create --role builder --days 7
cohub -s <spaceId> spaces invites create --role guest --never-expires
cohub -s <spaceId> spaces invites ls --all
cohub -s <spaceId> spaces invites revoke <code> --yes
cohub -s <spaceId> spaces access set --anonymous guest
cohub spaces config <spaceId> --guest-app welcome
Links last 1–30 days, or never expire with --never-expires; host links always expire. invites ls shows active links, and --all adds revoked, used-up and expired ones. access set only changes the options you pass. config --guest-app names a published public App that visitors without access see, including on invite links; none restores the default page.
spaces members ls, spaces members update <userId> <role> and spaces members remove <userId> manage roles (host, builder, guest). spaces labels attaches labels to Spaces, Chats and other resources; cohub labels manages your personal labels.
Apps
cohub apps publish detects the source from the runtime by default: a local CLI run uses local filesystem paths, a Cohub Sandbox run uses Space workspace paths. --source workspace or --source local overrides that.
cohub -s <spaceId> apps publish demo --file ./dist/index.html
cohub -s <spaceId> apps publish site --dir ./dist
cohub -s <spaceId> apps publish site --source workspace --dir dist
cohub -s <spaceId> apps ls --json
cohub apps ls --all --filter mine --json
cohub apps stats <appId|url|username/space/app>
cohub apps publish-version <appId>
cohub apps versions <appId>
cohub apps domains add <appId|url|username/space/app> app.example.com --yes
cohub apps domains check <appId|url|username/space/app> app.example.com
Publishing accepts --visibility public|space, --app-scope for scopes granted to the App runtime, and --hide-cohub-bar / --show-cohub-bar. apps authorize <app> --scope <scope> grants scopes as the current user; --offline also lets the App's Actions use the Space while you are away. apps actions run <app> <action> calls a published App Action. apps resolve looks an App up by owner, Space slug and App slug.
Boards
A Board is one JSON document with board settings, an items map and an animations map (see Boards for authoring, animations, and scripts). Every command accepts a Board ID or a .board path.
cohub -s <spaceId> boards get boards/plan.board --json
cohub -s <spaceId> boards get <boardId> --only items --items title,note
cohub -s <spaceId> boards apply <boardId> '{"items":{"title":{"props":{"text":"New title"}}}}'
cohub -s <spaceId> boards apply <boardId> -i patch.json --dry-run
cohub -s <spaceId> boards schema
cohub -s <spaceId> boards examples slides > slides.json
cohub -s <spaceId> boards history <boardId>
cohub -s <spaceId> boards export demo.board --animation intro --at 0:6s -o intro.mp4
apply is the only write: a JSON Merge Patch where fields merge, null deletes and anything unmentioned stays. --replace makes the document equal to the patch and needs --base-version on a Board with items. --dry-run validates without writing; --base-version and --mutation-id control retries.
play, pause, resume, seek, next and stop move playback for everyone viewing the Board; viewers shows each screen, watch streams changes, and export renders an image, a frame sequence or a video with --theme.
Rooms and RTC
Rooms are per-App realtime channels (see Realtime Rooms & RTC). Join with an invite the App gives you, or create one for an App you manage.
cohub rooms create --app <appId|url|username/space/app>
cohub rooms join <invite> --presence '{"name":"Guide"}'
cohub rooms get <room>
cohub rooms events <room> --after 42 --type 'chat.*'
cohub rooms events <room> --wait 10m
cohub rooms publish <room> chat.message '{"text":"Hello"}'
cohub rooms presence <room> '{"status":"away"}'
cohub rooms leave <room>
A seat needs no open connection: each call renews it, and it lapses after --idle (30 minutes by default) without one. Events are kept in room history (the latest 1,000 published, up to 512 KB), so --after resumes where you left off. cohub rooms connect <room> --input --json keeps a connection open for bidirectional events and streams NDJSON; rtc does the same for WebRTC media through the cohub-rtc helper, which the CLI downloads and verifies on first use.
Displays, desktop and Runtime
Screens a Space's machine shares — a phone from the Android app, a computer from cohub runtime up --display, or a sandbox's virtual screen (see Displays & Screens):
cohub spaces displays ls
cohub spaces displays capture
cohub spaces displays tree
cohub spaces displays tap --name Send
cohub spaces displays type "hello" --into e3.4
cohub spaces displays act --actions actions.json
cohub spaces displays record start
Coordinates are pixels of your latest capture. Where a display has an element tree, names and refs from tree are more precise. On macOS the terminal running the Runtime needs Screen Recording, and Accessibility to control the screen; Linux needs an X11 session.
cohub desktop open shows a file or App in the Cohub desktop that started the current Chat, and can call a method the App exposes:
cohub desktop open app://alice/studio/launch
cohub desktop open <appId|url|username/space/app> --as overlay
cohub desktop open <app-or-file> --call selection.get
Commands reach only the frontend instance that originated the work, resolved from request provenance; there is no DOM access or script evaluation.
cohub runtime up binds a local folder to a Space so its files and local harnesses are served from this machine (see Local Runtime):
cd ./my-project
cohub runtime up
cohub runtime up -d
cohub runtime status
cohub runtime logs --level warn --follow
cohub runtime down
Bindings are scoped by local directory, account and environment and stored in ~/.config/cohub/runtime-spaces.json. -d returns the Space link, process ID and log location, then runs in the background; if it is not ready within 30 seconds it exits with code 2 and keeps connecting. down retains all data and asks for --yes when work is unconfirmed. attach, detach, import and refresh-models <harness> manage local harness sync and model catalogs.
Search, tasks and notifications
cohub search "release notes"
cohub search "bug" --types chat --space-id <spaceId>
cohub tasks ls --status failed
cohub tasks get <taskRunId>
cohub inbox list --unread
cohub inbox read --all
cohub notifications prefs --set turn.finished.inbox=on
cohub me sessions --limit 20
cohub me billing
search finds Spaces, Chats (by title or by the messages in them) and label items; --types chat,space,label narrows the result types and --space-id limits it to one Space. tasks ls filters by --cron-job, --space, --session, --type and --status (see Tasks & Scheduled prompts). inbox keeps notifications for later; notifications prefs sets the channel for each kind (mention, turn.finished) per channel (inbox, push, email) — see Inbox & Notifications.
cohub me covers account-level data across Spaces: sessions, billing, billing-activity and activity --days 7. cohub profile get <username>, cohub profile update and cohub profile avatar <path> handle your public profile. cohub referrals ls and cohub referrals rotate handle your referral link (see Profile, Labels & Referrals). cohub references query <turn:|session:|space:|checkpoint:...> inspects forks, mentions, tool calls and file access.
Public files, skills and feedback
cohub -s <spaceId> public upload ./dist demo
cohub -s <spaceId> public ls demo
cohub -s <spaceId> public url demo/index.html
cohub skills ls
cohub prompts ls
cohub feedback "runtime up hangs after sign-in"
cohub feedback "Board export is blurry" -f board.png -f export.log
public upload puts files on the Space's public CDN path without publishing an App; public url prints the direct link (see Public files). skills ls and prompts ls list the skills and prompt templates available as slash commands (see Mods, Skills & Prompts). feedback sends a message with CLI version, OS, environment, account and COHUB_* context attached; -f attaches files and --runtime-logs adds recent Runtime diagnostics.
Output discipline
cohub spaces ls --json
cohub -s <spaceId> spaces sessions ls --json
Use --json whenever a script or Agent chains commands; human-readable output is fine interactively. A non-zero exit and a message on stderr mean the command failed.
Boundaries and common errors
| Symptom or error | Cause and fix |
|---|---|
No target space |
The command needs a Space. Pass -s, set COHUB_SPACE_ID, run in a directory bound with cohub runtime up, or use a command that starts new work and falls back to Home. |
Space '<ref>' not found |
The ID or slug does not exist, or you do not own that slug. Use username/slug for someone else's Space. |
Not authenticated |
Run cohub auth login, or set COHUB_EXECUTION_TOKEN for an ephemeral run. An execution token never falls back to the stored session. |
| 401 after switching servers | Sessions are scoped to the API base URL. Sign in once per custom server, or pass an execution token. |
| Commands hang in CI | The background self-update may try npm. Set COHUB_CLI_AUTO_UPDATE=0. |
spaces files write produces an empty file |
Content came from neither -c nor stdin. Pass -c, or pipe content in; stdin is only read when it is not a terminal. |
cp copies to the wrong side |
Bare paths are local unless -s or COHUB_SPACE_ID declares the current Space. Use <space>:<path> to be explicit. |
run fails immediately without -s |
cohub run never falls back to Home; run inside a bound directory or pass -s / COHUB_SPACE_ID. |
apps publish reads the wrong directory |
Source detection follows the runtime. Pass --source local or --source workspace. |
apps domains add refuses without confirmation |
Adding a custom domain charges once when it goes live; pass --yes after checking the hostname. |
Next steps
- Spaces — what a Space is and how targeting works
- Chats — Sessions, turns and how a prompt runs
- Files & Sandbox — the workspace, uploads and checkpoints
- Saves — publish Space configuration with a checkpoint
- Apps — what publishing produces and how visitors reach it
- SDK — the same APIs from TypeScript
- BYOK — connect your own model subscription