Reference

Command line

Reference for the duscode command, its subcommands open, status, stop, restart, logs, service, chat, keys, doctor and proof, its options, how it picks a port, and what it prints.

duscode [folder] [--port N] [--no-open] [--foreground]
                                          open the folder (default: here) in the browser UI
duscode open <folder> [--port N] [--no-open]
                                          the same, for a folder you name
duscode status [--port N] [--json]        is it running: port, pids, uptime, restarts, last crash
duscode stop [--port N]                   stop it (running tasks are saved as interrupted)
duscode restart [--port N]                restart the engine; your sessions are kept
duscode logs [-f] [-n N] [--port N]       the engine's log; -f follows it
duscode service install|uninstall [--port N] [--print]
                                          start Duscode when you log in, or stop doing so
duscode chat [folder]                     work in the terminal instead
duscode keys                              add provider API keys from the terminal (.env in the config folder)
duscode doctor                            check Node, git, keys, port and permissions
duscode proof [task] [--html|--json]      a task's Proof of Work
duscode --version | --help

duscode [folder]

Starts Duscode for a folder (the current folder by default) and opens the workspace in your browser.

Option Effect
--port N Use port N instead of 4317. If something else holds that port, Duscode stops with an error instead of moving on.
--no-open Don't open a browser. Run duscode link when you want it (it prints and opens the link with Duscode's key).
--foreground Keep Duscode in this terminal (Ctrl+C stops it) instead of running it in the background. It still restarts the engine if it crashes.

It runs in the background and heals itself. duscode starts a small supervisor in its own session, detached from your terminal, and the engine under it. Closing the terminal, or the program that ran duscode, doesn't stop it. If the engine crashes, the supervisor starts it again after 1 s, 2 s, 5 s, 10 s, then every 30 s. After 8 crashes in a row, each within a minute of starting, it stops trying and says so; fix the cause (see duscode logs), then run duscode restart. Its output goes to the log, and duscode status says what happened.

One Duscode for all your projects. If Duscode is already running on the port, duscode other-folder opens that folder in it (in a new browser tab) and returns at once. Recent projects and the usage history stay in one place.

Busy port. If another program holds port 4317 and you didn't pass --port, Duscode takes the next free port (up to 4366) and says so: Port 4317 is busy; using 4318.

Opening the browser. Duscode uses open on macOS, xdg-open on Linux, and wslview (then explorer.exe) on WSL. If none works, it prints the address to open.

Stopping. Run duscode stop (or press Ctrl+C with --foreground). A task that is running stops cleanly and is marked Interrupted by a restart; Continue in its session picks it up later. Previews and services stop too, except services marked persistent.

When it starts, Duscode prints the project's own link, the same one Copy link gives (it keeps working after a restart):

Duscode is running (current project: /home/you/code/my-app)
  Duscode: http://localhost:4317/code
  Project link: http://localhost:4317/code?p=3f9a1c07be

duscode open <folder> does the same for the folder you name. It's handy in scripts. See Links to projects and sessions.

Duscode's key. Each time Duscode starts it makes a new random key, and only a browser or program that has it can use Duscode, so other programs on your computer can't. The browser gets it from the link Duscode opens (it ends in ?token=…, which Duscode swaps for a cookie and removes from the address). The key is kept in a file only you can read, next to the log. Opening http://localhost:4317/code/ without it shows a page that says what to do.

Opens Duscode in your browser with its key, and prints that link. Use it after --no-open, in another browser, or when Duscode was started some other way (a login service, pnpm dev:web); run it with the same DUSCODE_HOME as that Duscode. --port N picks the Duscode on another port; --no-open only prints the link.

$ duscode link
http://localhost:4317/code/?token=3q2-…

duscode status

Says whether Duscode runs on the port (default 4317, or every port it has run on): the address, the engine's and the supervisor's process ids, how long it has been up, restarts after crashes, and the last crash with its exit code and last log lines. It exits with 0 when Duscode answers and 3 when it doesn't, so scripts can test it. --json prints the same as JSON.

Duscode is running on port 4317: http://localhost:4317/code
  engine pid 48211, supervisor pid 48190, up 2 h 14 min, version 0.1.0
  restarts after crashes: 1
  last crash: 13/10/2026 17:31, exit code 1 after 4 s
    │ Error: listen EADDRINUSE
  log: ~/.local/share/duscode/logs/server-4317.log

duscode stop, duscode restart

stop ends the supervisor and the engine cleanly (within 30 s, then it is killed). restart restarts only the engine: the supervisor, the port and your sessions stay. Use it after fixing what made the engine crash. If no supervisor runs, restart stops whatever answers on the port and starts Duscode in the background.

duscode logs

Prints the last lines of the engine's log (-n 200 for more) and, with -f, keeps printing what it writes next. The log is logs/server-<port>.log in Duscode's data folder, rotated at 5 MB (three old files are kept).

duscode service install

Starts Duscode when you log in, and restarts its supervisor if it ever dies:

System What is installed
Linux, and WSL with systemd turned on A systemd user service, ~/.config/systemd/user/duscode.service, enabled with systemctl --user enable --now
WSL without systemd, other Linux A few marked lines in ~/.profile that start Duscode in the background when you open your first terminal
macOS A LaunchAgent, ~/Library/LaunchAgents/com.duscode.server.plist
Windows A Scheduled Task, “Duscode”, at sign-in

Nothing is installed unless you run the command. --print shows the file and the commands without changing anything. duscode service uninstall removes it; Duscode keeps running until duscode stop. With --port N, each port gets its own service.

duscode chat [folder]

Runs Dus in the terminal. See Terminal app.

duscode keys

Adds or replaces provider API keys from the terminal. In the workspace, Settings → Models & keys does the same, checks the key first and needs no restart (see Add a provider key). It shows which providers have a key (never the keys themselves), then asks for a provider and its key. Typing is hidden.

You can type a provider by name or by its variable, for example anthropic or ANTHROPIC_API_KEY. Keys go into ~/.duscode/.env with mode 600. Run it in a terminal; it can't read keys from a pipe. To remove a key, delete its line from that file. See Providers and models.

duscode doctor

Checks what a first run needs, and prints a fix: line for each problem:

Check If it fails
Node 22 or newer Install Node 22 LTS, for example nvm install 22
git is installed Install git
GitHub CLI (warning) Needed only for pull requests and creating GitHub repositories
At least one provider key Run duscode keys
Port 4317 Free, or already Duscode (it will be reused). A warning if another program has it.
Duscode's home folder is writable Check its owner, or set DUSCODE_HOME
The current folder is writable (warning) Run duscode from a folder you own
wslview on WSL (warning) sudo apt install wslu

It exits with code 0 when everything needed is there, and 1 otherwise. Warnings don't fail it.

duscode proof [task]

Prints a task's Proof of Work: what ran, what it proved, what is open, and the exact commands to reproduce the checks. It reads .duscode/proof/ in the project (it finds it from inside a session's worktree too), offline.

Option Effect
task A task id, or the start of one. Default: the newest task.
--md Markdown on standard output (the default)
--html A self-contained HTML report with the screenshots, written to proof-<task>.html (or --out FILE)
--json The record as JSON
--list Every proof in the project, newest first, with its status
--cwd FOLDER The project folder (default: the current folder)

It exits with 1 when there is no such proof.

duscode --version, --help

--version (or -v) prints the version. --help (or -h) prints the usage above.

Something missing or wrong? Email support@duscode.com.