Skip to content

Cozzle CLI

devxian edited this page Nov 30, 2026 · 17 revisions

English | 한국어

cozzle CLI

cozzle is the command that controls the cozzle app from inside a cozzle terminal. Agents use it most, but you can type it too. This page is the reference for every command.

cozzle guide      # the full agent guide
cozzle status     # all workspaces and tabs

Why only cozzle terminals

When the app starts, it picks a free port on 127.0.0.1 and a random token (48 hexadecimal characters). It passes both only to terminals that cozzle opens, through environment variables (COZZLE_ADDR, COZZLE_TOKEN). Other users cannot control cozzle.^ipc

Terminals stay alive when cozzle restarts (after an update or a crash), so their environment still holds the old port and token. cozzle therefore also writes the current address, token, process ID and start time to app.json in the terminal host folder ($XDG_RUNTIME_DIR/cozzle or ~/Library/Caches/cozzle/pty, mode 700; the file is mode 600) each time it starts, and deletes the file when it quits. When the old address does not answer or the token is refused, cozzle reads that file and sends the command once more to the running app. It uses the file only if the folder and file belong to you, only you can open them, neither is a link, the address is on this computer, and the app process is alive. On Windows, the file is not written.^cli

Each persistent terminal also gets COZZLE_TERM, its number in the terminal host. The app maps that number to the tab that shows the terminal now, so self still means the right tab after a restart. Tab IDs printed before a restart change; run cozzle tab list again.

The cozzle command is also only on the PATH of cozzle terminals (~/.cache/cozzle/bin-<process id>/, mode 700). Outside cozzle, it prints:

cozzle: Works only in a terminal opened in the cozzle app

(It can be used only in a terminal opened by the cozzle app.)

Output and exit codes

Result Output
A block of text (tab read, browser text and so on) Printed as is
A list or object Printed as TOON (Token-Oriented Object Notation): the same content as JSON, in a table form that uses fewer tokens
No value Nothing
Exit code Meaning
0 Success
1 Failure. The reason goes to stderr as cozzle: …
2 Run outside a cozzle terminal

Common rules

  • self is the terminal tab that ran the command. Get tab IDs with cozzle tab list.
  • Unquoted words are joined into one text (cozzle notify Build done all passed → title Build, body done all passed).
  • In free text (tab run, tab send, tab rename, notify, search), --options after its first word belong to the text: cozzle tab run self ls --color auto runs ls --color auto. -- ends options for any command. tab send still takes a trailing --enter.
  • Options that take a value: --tab --cwd --name --run --timeout --lines --max --limit --color --label --line --direction. Any other --option is an on/off switch.^commands
  • Commands that do not name a workspace use the workspace of the terminal that ran them.

Tabs

cozzle tab list
cozzle tab new [terminal|browser|graph] [--cwd path] [--name name] [--run command] [--split] [--new] [--focus]
cozzle tab split <id>                            # show that tab beside the user's view
cozzle tab unsplit                               # close the split (tabs stay open)
cozzle tab run <id|self> <command>     # type, then Enter
cozzle tab send <id|self> <text> [--enter]   # type without Enter (--enter adds Enter)
cozzle tab read <id|self> [--lines 40] # terminal screen text, last N lines
cozzle tab select <id>
cozzle tab close <id>
cozzle tab rename <id> <name>          # an empty name restores the default

tab new:

  • Without a type, it opens a terminal. It also accepts shell, git, 터미널, 브라우저 and 그래프.
  • Without --cwd, it opens in the workspace folder.
  • It only creates the tab and does not change what the user sees or where they type. The tab goes into the tab bar of another pane (or the agent's pane when there is none). A tab you do not view still starts running at once.
  • With --run, it reuses a terminal started with the same command in the same folder. If the command is still running (the terminal's foreground process group is not the shell), nothing is typed and reused is running; if it has returned to the prompt, the command runs again and reused is rerun.
  • With --name, it reuses a tab of the same name and type. A terminal is reused only when its shell is idle, and --run runs in that tab (rerun; idle without --run).
  • reused is false for a new tab.
  • --new creates a new tab even if one with the same name exists.
  • --split shows the tab beside the user's view. --focus switches to the tab.
  • Result: { id, kind, reused, visible, pane }, and listed: true when --split found no room and only added the tab to a tab bar.^commands

Where --split, tab split, browser open --split and open put a tab:

  • The pane of the agent's terminal and the pane the user types in are not changed: their visible tab and the keyboard stay.
  • The first time, that pane is cut once and keeps 60%. Later tabs go to the largest other pane, which is halved when there is room, else the tab is shown at the front of that pane.
  • No pane is cut below 440×280 points, except that a single pane always gets one side pane, even in a narrow window. Side by side comes first; --direction is ignored. At most 2 panes in a center narrower than 1600 points, 3 from 1600, 4 from 2400 (or 1800×1100).
  • When nothing fits, the tab is only added to a tab bar and the result says listed: true.
  • The user's workspace and active tab do not change.
cozzle tab new terminal --name dev --run "pnpm dev"
cozzle tab read 7 --lines 80

Tab fields in tab list and status: id, workspace (from 1), kind (terminal, browser, graph, editor, subagent), title, cwd, active, visible. visible is main (shown in the pane the user types in), split (shown in another pane) or hidden. pane is the pane number in reading order (from 1), or null when the view is not split.

Workspaces

cozzle workspace list
cozzle workspace open <path>
cozzle workspace select <number>   # from 1
cozzle workspace close <number>    # the last one is never closed

Worktrees

One git worktree per agent, so agents on one repository do not overwrite each other's files. The repository is the one of the calling terminal's workspace (or its original repository when called from a worktree).

cozzle worktree new [branch] [--run <command>] [--focus]  # new branch (default agent-N) in <repo>.worktrees/<branch>, opened as a workspace
cozzle worktree new [branch] --agent claude|codex [--prompt <text>|-] [--count N]  # start agents with a task
cozzle worktree list                    # branch, path, changes, workspace, base, fanout
cozzle worktree diff [branch] [--stat]  # changes since the base branch
cozzle worktree compare [branch...]     # one column per worktree in the repository workspace
cozzle worktree take <branch> <path>    # copy one file from that worktree into this checkout
cozzle worktree merge [branch] [--close-others [--yes]]  # merge into the repository's current branch, then remove the worktree and `branch -d`
cozzle worktree remove [branch] [--yes] # remove the worktree, keep the branch

Without a branch, merge, remove and diff act on the calling worktree. merge refuses uncommitted changes and stops on conflicts, opening the repository's Git graph for the user. remove refuses uncommitted changes unless --yes, which moves the folder to the Trash. Nothing is forced.

Several agents on one task (see Workspaces and tabs):

  • new --agent claude --count 3 --prompt "<task>" creates three worktrees (agent-N) from the repository's current branch and starts Claude Code in each with the task as its first message. --prompt - reads the task from standard input. A branch name works only with one agent. Without --prompt, --agent starts the agent with no task, like --run claude. The answer lists branch, path, workspace and the terminal tab of each.
  • Limits: 1 to 4 agents per call, and at most 8 worktrees from these runs per repository. Each call shows the user a notification with the count and the start of the task.
  • diff shows the changes since the worktree left the branch it was created from (git merge-base), committed and uncommitted, then untracked files as ?? <path>. --stat prints the summary.
  • compare with branches opens those worktrees side by side; without one, the calling worktree and the others from the same run.
  • take copies the file at <path> (relative to the repository root) from that worktree into the calling workspace's checkout. It refuses paths outside the worktree, .git, symbolic links, and a file that has uncommitted changes in the checkout.
  • merge --close-others merges like merge, then closes the other worktrees of the same run (their branches stay). Ones with uncommitted changes stay open and cozzle asks the user; --yes moves them to the Trash instead.

Browser

cozzle picks the target tab in this order:^commands

  1. The tab given with --tab <id> (only that tab; if it is not a browser tab, the command fails)
  2. The browser tab named with --name <name> in this workspace (the name you gave it, not the page title)
  3. The browser tab you are viewing in this workspace
  4. The last browser tab in this workspace

If there is no target, only open creates a new tab (with the --name name, if given). Other commands fail.

cozzle browser open <url> [--split] [--new] [--name name] [--focus]   # same as goto; waits for the load. url may be file:///… or an absolute path (reads only that file's folder)
cozzle browser info                     # tab, url (the page shown, not one still loading), title, device
cozzle browser snapshot [--limit 300]   # clickable and editable elements with refs (e1, e2...)
cozzle browser click <ref|css>
cozzle browser fill <ref|css> <text>    # input, textarea, select, contenteditable
cozzle browser press [key]              # Enter by default. Tab, Escape ...
cozzle browser scroll [up|down|top|bottom|ref]  # down by default
cozzle browser wait <css|text:words>
cozzle browser text [--max 8000]
cozzle browser html [css] [--max 20000]
cozzle browser back | forward | reload  # wait like open
cozzle browser device <fit|mobile|tablet|pc|tv>
cozzle browser extensions               # installed extensions and user scripts
  • open reuses the target tab. With --new, it opens a new tab. --split shows it beside the user's view (see Tabs); a new tab without --split only goes into a tab bar.
  • Commands that wait for the page take --timeout <ms> (15000 by default).
  • open, back, forward and reload answer tab, ok, url and title when the page has loaded, or with ok: false after the timeout. They fail with the reason (exit code 1) when the load is cancelled, for example by a later open on the same tab, when it fails, or when the page stays the same (a 204 answer, a download, or a page that blocks leaving). back and forward fail when there is no page in the history.
  • Typical order: open → snapshot → click or fill with a ref → snapshot or text again to check.
  • After the page changes, get new refs with snapshot.
  • Page commands fail on pages without the cozzle runtime, such as about: pages.
  • extensions only lists items: supported, and for extensions id, name, version, enabled and action, and for user scripts file, name, match and enabled. The user installs them in Settings.^extensions

Page tools (WebMCP)

cozzle browser tools                       # name, title, description, inputSchema, annotations, frame, origin
cozzle browser call <tool> [json-object] [--max 65536]   # runs the tool; returns content (or value)
  • Only https and localhost pages have tools. tools lists tools of the tab's origin, including same-origin frames (frame is the frame number from snapshot), up to 100.
  • call checks the input against inputSchema (type, required, enum, properties, items, additionalProperties: false) before it runs the tool. Input is one JSON object, 64 KB at most; without input the tool gets {}.
  • The result is the tool's content array, or its value as value. Results over 64 KB (or --max <bytes>, up to 8 MB) show their start with truncated: true, the full size in bytes and path, a JSON file with the whole result in ~/.cache/cozzle/tool-results (only you can read it; files go after a day or past the newest 50). Results over 8 MB are cut there too, and note says so. A thrown error exits with code 1.
  • call waits for --timeout (15000 ms by default) and then cancels the tool. While the tool waits for the user (requestUserInteraction), cozzle notifies the user and waits up to 10 minutes.
  • Every result has untrusted: names, descriptions and results come from the website.
  • After cozzle fills a saved login on the page, tools and call are blocked until the page navigates.^commands

Saved logins

cozzle browser logins                   # site and username only, matchesTab
cozzle browser login [--account name] [--submit]   # fill from the Keychain
cozzle browser otp [--submit]           # generate and fill the two-factor code
printf '%s' "$PASSWORD" | cozzle browser login save --site <origin> --username <name> --password-stdin [--totp-secret-stdin]
  • login --submit signs in with one call. It waits for the page to load, and on forms that ask for the username first it fills the username, goes to the next screen, waits for the password field on the same site, fills it and submits. result is submitted or needs-2fa (then run otp --submit); without --submit it is filled or username-only.
  • login and otp never return the password or code. They refuse pages where an agent ran eval; reload the page and call login before any eval or html.
  • After a fill, only snapshot (field values hidden), text, wait, click, hover, scroll, draw, press, type, select, check, uncheck, drag, upload, fill and perf run on that page until it navigates away, and they take only refs or text: targets, not CSS selectors. Everything else, including eval, html, storage, console, network, tools, call and screenshot, is refused.
  • login save stores a login the user gave the agent. The password comes only from standard input; --password and other secrets in arguments are refused, because other programs can see arguments. With --totp-secret-stdin, the second line is the two-factor secret. The site is stored as its origin, as in Settings.
  • login save only creates new entries. A site and username that already exist are refused, and agents cannot edit, delete or read saved logins. Each save appears in Notifications, and clicking it opens Settings → Browser → Logins. With Ask before agents use saved logins on, the save waits for your approval in the browser tab. Approving a save does not approve filling: the first login with that account asks again.^logins

Draw on the page

cozzle browser draw box <ref|css> [--label text]
cozzle browser draw highlight <ref|css> [--label text]
cozzle browser draw rect|ellipse|highlight|box <x> <y> <w> <h> [--label text]
cozzle browser draw arrow|line <x1> <y1> <x2> <y2> [--label text]
cozzle browser draw text <x> <y> <text>
cozzle browser draw clear
  Common: --color '#FF2D55'   Coordinates are CSS pixels relative to the document

Drawings do not block clicks and follow scrolling. box and highlight stay on their element as it moves, also inside scrolling boxes, same-origin iframes and fixed elements, and with page zoom or a device size. With a ref from snapshot are more accurate than guessed coordinates. When the element is gone, the drawing looks for it again about once a second and is removed after about 5 seconds.

Developer tools

cozzle browser console [--clear]   # console.* output and JS errors (latest 500)
cozzle browser network [--clear]   # fetch and XHR: method, url, status, ms (latest 300)
cozzle browser eval <js>           # value of the expression (JSON)
cozzle browser storage             # localStorage and sessionStorage
cozzle browser cookies             # cookies for the current address (including HttpOnly)
cozzle browser perf                # load time and resource count
cozzle browser devtools            # opens the web inspector for the user

Open a file

cozzle open <file> [--line N]

Relative paths start from the working folder of the shell that ran the command. Result: { id, kind: editor }. Details are in File editor.

Agents

cozzle agents [id|self]     # subagents started by that tab's Claude Code or Codex: id, name, kind, state, elapsed, parent
cozzle agent config         # Claude Code and Codex configuration of this workspace

Columns of agent config: tool (claude, codex), kind (instructions, settings, skill, command, prompt, agent, rule, mcp, plugin), scope (project, parent, user), name, detail, path. Settings and MCP entries show only names and counts, never secret values.^agent-config For the screen side, see AI agents.

Read settings

cozzle settings [list|get <key>] [--scope user|workspace]
  • Without a scope, it shows the values in effect (default ← user ← workspace).
  • --scope user shows the user file values. --scope workspace shows only the keys that .cozzle/settings.json overrides.
  • Keys are the names in settings.json, such as terminalFontSize and browser.zoom.
  • It only reads. It reads the settings files directly instead of asking the app, and finds the workspace from the terminal's COZZLE_WORKSPACE (or the current folder).^cli
cozzle settings get browser.zoom
cozzle settings --scope workspace

The agent guide tells agents not to edit settings files and to ask the user instead. The scope rules are in Settings.

Other commands

cozzle search <query>                  # git grep in this workspace (path, line, text)
cozzle git status                      # changed files (path, change)
cozzle git log [--limit 20]            # hash, subject, author, when, refs
cozzle panel <files|scm|search|agent|notifications|settings>
cozzle notify <title> [body]           # cozzle notification + operating system notification
cozzle guide                           # same as help, --help, -h
  • panel also accepts 파일, 소스, git, source-control, 검색, 에이전트, 알림 and 설정. sessions and 세션 open the Sessions tab of the Agent section.
  • notify also shows an operating system notification unless the user turned off system notifications in Settings.

Example: check a screen

cozzle browser open localhost:3000 --name preview --split
cozzle browser device mobile
cozzle browser snapshot
cozzle browser click e4
cozzle browser text --max 2000
cozzle browser draw box e9 --label "Button is cut off"
cozzle notify "Please check" "The pay button is cut off on mobile"

Clone this wiki locally