Skip to content

ManualReference

Commands

Every chan command and subcommand, the chan serve flags no other page covers, and the other names of the chan binary.

chan

chan serves workspaces, runs devservers and changes chan's settings, from any shell. Add --help to any command for its flags and examples.

A prefix that names one command is enough, at every level: chan w ls is chan workspace ls, and chan de status is chan devserver status. A prefix that fits two commands, such as s for serve and shell, is refused.

Serve a workspace

CommandWhat it doesMore
chan serve PATH, chan open PATHRegisters PATH as a workspace and serves it: in Chan Desktop or a devserver when one runs, otherwise on its own for a browser.Workspaces
chan close PATHStops serving a workspace and keeps it registered. --forget also forgets it.Workspaces
chan psLists the registered workspaces and what serves each. --json prints it for scripts.Workspaces

chan workspace

chan workspaceWhat it doesMore
add PATHRegisters a directory without serving it. --semantic-search turns on semantic search for it.Workspaces
lsLists the registered workspaces, most recent first, with each one's key. Takes --json.Workspaces
serve, closeThe same as chan serve and chan close.
forget PATHStops serving a workspace, unregisters it, and deletes chan's data for it. Your files stay.Workspaces
index rebuild PATHBuilds the search index and graph again.Index
index download-model, list-models, set-model, enable-semantic, disable-semantic, statusFetch, list and choose the embedding model, turn a workspace's semantic search on or off, and report it.Semantic search
reports enable, reports disableTurn a workspace's code reports on or off, named with --path PATH. Off deletes the report and asks first; -y skips the question.Code reports
search QUERYSearches and walks the workspace you are in, the one --workspace names, or all with --all-workspaces, as cs search does.Search
graph --from TYPE:VALUEWalks the graph's relationships from a node, such as file:notes/a.md.Search
status PATHReports a workspace's index, graph and code report. Takes --json.
metadata export PATH ARCHIVE, import, inspectSave chan's data for a workspace to a .tar.zst archive, restore it, or list what an archive holds.Settings
contacts import csv FILEWrites one contact note per row of a Google Contacts CSV, into --into DIR of --workspace PATH. --dry-run writes nothing.Contacts

chan devserver

The first commands run the devserver of the machine you type them on. The rest manage the devservers on Chan Desktop's Computers screen, so they need Chan Desktop running; NAME is the name or URL chan devserver ls shows.

chan devserverWhat it doesMore
runRuns the devserver in this terminal until Ctrl+C.Run a devserver
start, stop, restartStart the background service and enable it at login or boot, stop and disable it, or restart it on the current binary.Run a devserver
statusPrints the service's state and, in a terminal or with --url, its URL with the token.The token
joinStarts the service if it is down and stays attached until Ctrl+C. Connect scripts run it.The token
rotate-tokenReplaces the token and prints the new URL.The token
register URLAdds a devserver to the Computers screen without connecting. --name and --script fill the form's Name and Connect script.Connect
lsLists the devservers on the Computers screen with their state. Takes --json.Connect
connect NAME, disconnect NAMEConnect to a devserver, or drop the connection; it keeps running.Connect
forget NAMERemoves a devserver and its stored token. A connected one is refused unless you add --force.Connect

The commands for a machine's own devserver share --bind, --port and --service, and the tunnel flags that publish a devserver through a gateway.

Other commands

CommandWhat it doesMore
chan metricsPrints the running devserver's readings: CPU, memory, traffic and disk. --watch repeats them, and --url reads another chan server.Metrics
chan config get [KEY], chan config set KEY VALUERead and write the settings that live outside a workspace, as Settings does, with nothing running.Settings
chan completions SHELLPrints a completion script for bash, elvish, fish, powershell or zsh.
chan dump-skillPrints chan's manual for agents, built from its own help: --list for its topics, --topic SLUG for one, --full for all of it.Agent teams
chan upgradeReplaces this chan with the latest release after asking. --check only reports, --version V picks a release, and -y skips the question.
chan shellThe same command as cs.Below

chan serve flags

Workspaces explains --standalone, --desktop, --devserver and --on. Chan in a browser explains --port, --host, --no-browser, --here, --timeout, --no-settings and --no-token. The rest:

FlagWhat it does
-4, --ipv4Listens on IPv4 only, on 127.0.0.1 unless --host names another IPv4 address.
-6, --ipv6Listens on IPv6 only, on ::1 unless --host names another IPv6 address.
--search-aggression LEVELSets how hard the indexer works for this run: conservative, balanced or aggressive. It overrides Settings → Search → Search indexing.
--prefix /team/aliceServes under a URL path, so a reverse proxy can put several servers on one host. Each segment takes letters, digits and -.
Details and limits
  • Only a server the command binds itself can enforce --no-settings, so a serve that would hand the workspace to Chan Desktop or a devserver is refused. Add --standalone.
  • --timeout takes a whole number with s, m or h, such as 30s; zero is refused.
  • --devserver=PORT also takes a URL on the same machine, such as --devserver=http://127.0.0.1:9999, always with =. A URL of another host is refused.
  • --on NAME takes no other serve flag, and its PATH is a path on that devserver.
  • -4 or -6 with a --host of the other kind is refused.
  • chan serve takes a path only; a URL is refused with a pointer to chan devserver register.
  • A path inside a Git, Mercurial or Subversion working tree exits with status 70. See Troubleshooting.
  • chan close and chan workspace forget exit with status 75 while a workspace is still releasing; run them again.
  • -v, -vv and -vvv raise logging on every command. chan --version prints the release and the build.

cs

cs runs inside a chan terminal and drives the window it runs in: it opens files, terminals and panes, writes to and reads other terminals, and reports a program's status on its tab. chan shell is the same command, and prefixes work the same way: cs te l is cs terminal list.

Other names of chan

The chan program also answers to four other names, and does what the name it runs under says.

NameWhat it doesMore
csDrives the chan window a terminal runs in.cs
chan-termOpens a Chan Desktop terminal window: your shell, or a command in a window of its own.Standalone
chan-files PATHOpens a directory in a standalone terminal window's file browser.Standalone
chan-edit PATHOpens a file in a standalone terminal window's editor.Standalone
Installed byNames
The CLI installer for macOS, Linux and FreeBSD, and Homebrew's chanchan, cs
The Windows CLI installerchan, and cs as cs.cmd and a Git Bash cs
Chan DesktopAll five, in ~/.local/bin. On Windows, only chan and cs.
The Arch, Ubuntu, Fedora and Nix packages of chan and of Chan DesktopAll five

If command -v cs finds nothing, link it once:

$ln -s "$(command -v chan)" ~/.local/bin/cs
Details and limits
  • Chan Desktop repairs the names it wrote in ~/.local/bin when they go stale, and leaves alone a name you put there yourself.
  • The chan that Chan Desktop installs hands a workspace to Chan Desktop, and its chan upgrade updates Chan Desktop.
  • The chan-term, chan-files and chan-edit of the chan packages cannot start Chan Desktop; see Standalone.