This page describes dx 0.15.1.

dx from scripts: the read and action contract

This page is for anyone who drives dx from a program: a script, an editor extension, a dashboard. It covers two things:

For the commands themselves, see the docs or dx help <command>.

What you can rely on

From dx 0.13.0, three things are stable:

These stay dx's own, and may change in any release:

What counts as a change. Adding a field or a value raises the contract's minor version (1.0 to 1.1), and can come in any dx release. Renaming, removing or retyping a field, or changing what one means, raises the major (2.0). An exit code keeps its cases: giving a case another code, or a code another meaning, is a breaking change, and a new code is only for a case that didn't exist before, such as a new verb or flag. The no-question rule never weakens: no release adds a question without a terminal. A fix that makes dx do what this page says is not a change, even when a script relied on the bug. Nor is a change to anything this page calls dx's own.

Notice. A breaking change is announced in the Notes of an earlier release's changelog entry, at least one minor release and at least 30 days before the release that makes it. This page then marks the part that will change with one quoted line right under it, always of the form > **Changes in 0.N.0:** …, naming that release. A security fix may come without notice. Its changelog entry says why.

Conventions

Reading: dx sessions --json

dx sessions --json [--here <folder>] [--scan] [--transcripts]
dx sessions                       # a list for people; its format may change
FlagEffect
--jsonPrint the document on stdout, and nothing else there. Needs Node.js.
--here <folder>Add current to every session: whether it belongs to that folder (see the session table). A missing folder argument is exit 2; a folder that doesn't exist is exit 3.
--scanCheck which sessions are open on this device before printing, instead of using the last check. Slower: on Windows it runs tasklist.exe. When dx can't read the list of processes, or any Claude home, the answer is the last check's, with a note on stderr.
--transcriptsRead each transcript to fill in transcript.messages and transcript.started_at. Results are cached, so later runs are cheaper. Without the flag both are null.

What's on stdout. With --json, stdout carries exactly one JSON object: the document, or an error result (see Results). The exit code follows the table under Exit codes. A store with no sessions is still a valid document ("sessions": []) and exit 0. Without Node.js, dx sessions --json exits 1 with a hint on how to install it.

Is this dx new enough? The promise above starts with dx 0.13.0. A 0.12 dx prints the same contract 1.0 document, without the promise. A dx older than 0.12.0 answers dx sessions --json with its help text and exit 0. So don't trust exit 0 alone: check that stdout starts with {, or that contract is present. dx version tells you which dx you're talking to.

It reads, nothing else. dx sessions --json never changes your sessions. Its caches live under ~/.dx/run/, never in the synced ~/.dx/data/.

The document

{
  "contract": "1.0",
  "dx": { "version": "0.13.0", "build_ref": "abc1234" },
  "generated_at": 1760000000,
  "self": { "device_id": null, "name": "mini", "os": "macos", "boot_epoch": 1759990000 },
  "constants": { "wake_since_default": 259200, "connect_online_window": 420,
                 "ledger_scanned_at": 1759999000, "ledger_retain": 2592000 },
  "palette": { "red": "#e06c75", "green": "#98c379", "yellow": "#e5c07b", "blue": "#61afef",
               "purple": "#c678dd", "cyan": "#56b6c2", "orange": "#d19a66", "pink": "#e88fb2",
               "tan": "#c2a678", "gray": "#7f848e" },
  "ui": { "page_path": "C:/Users/me/.dx/data/ui.html", "built_at": 1759998000, "listed": ["..."] },
  "devices": [ ... ],
  "contacts": [ ... ],
  "groups": [ ... ],
  "sessions": [ ... ]
}
FieldTypeMeaning
contractstringThe document's version, "<major>.<minor>", separate from dx's own version. "1.0" since dx 0.12.0.
dx.versionstringThe dx that printed it.
dx.build_refstring or nullThe commit the release was built from; null in a source checkout.
generated_atintWhen the document was printed.
self.device_idstring or nullThis device's id when dx connect is set up, else null. Find this device by devices[].self, not by id.
self.namestringThis device's name: the one set with dx connect name, else one made from the host name.
self.osstringwindows, macos, linux, wsl or other.
self.boot_epochint or nullWhen this device last booted; null when dx can't tell.
constants.wake_since_defaultintHow far back dx wake looks: 259200 (72 hours).
constants.connect_online_windowintHow recently a device must have been heard from to count as online: 420 seconds.
constants.ledger_scanned_atint or nullWhen dx last checked which sessions are open here. null when it never has: then treat open.here and wakeable.ok as unknown, not as false. To get a fresh answer, pass --scan.
constants.ledger_retainintHow long dx remembers that a session was open: 2592000 (30 days).
paletteobjectThe ten color names dx color accepts, each as a lowercase #rrggbb.
ui.page_pathstring or nullThe page dx ui builds, when it exists.
ui.built_atint or nullWhen that page was last built.
ui.listed[]array or nullThe ids of the sessions that page lists; null when there is no page.
devices[]arrayThis device first, then paired devices by name. See Devices.
contacts[]arrayPeople you shared sessions with. See Contacts.
groups[]arraySorted by id. See Groups.
sessions[]arrayNewest first (by ts). See Sessions.

Never in the document: pairing and share codes, connection tickets, keys, host addresses and transcript content. Device ids are addresses that dx connect already prints, not secrets.

Sessions

{
  "id": "3f2a9c1e-7b4d-4e8f-9a2b-1c3d5e7f9a0b",
  "ts": 1759900000, "type": "snap", "claimed": true, "agent": "claude",
  "repo": { "path": "C:/Users/me/proj", "name": "proj", "remote": "github.com/me/proj", "git": true },
  "commit": "a1b2c3d", "branch": "feature/x",
  "name": "viewer fixes", "named": true, "explicit": true, "title": "viewer fixes",
  "group": { "id": "proj", "label": null },
  "origin": { "kind": "self", "device_id": null, "name": "mini", "shared_from": null },
  "color": { "hex": "#c2a678", "name": "tan" },
  "open": { "here": false, "devices": [ { "device_id": "<hex64>", "seen": 1759999900 } ] },
  "wakeable": { "ok": true, "last_seen": 1759990000, "before_reboot": false, "cwd": "C:/Users/me/proj",
                "folder_missing": false, "spawned_recently": false },
  "transcript": { "path": "C:/Users/me/.claude/projects/C--Users-me-proj/3f2a9c1e-….jsonl", "size": 48213,
                  "mtime": 1759995000, "started_at": null, "blob_mtime": null, "messages": null },
  "last_active": 1759995000,
  "holders": [],
  "current": true
}
FieldTypeMeaning
idstringThe session's id, a lowercase uuid. It's the id Claude Code uses: claude --resume <id> opens it.
tsintWhen dx last recorded the session (a snap, a commit, an arrival from another device).
typestringsnap: you snapped it, or claimed an auto session by naming, coloring or grouping it. auto: the commit hook started it, or it's a clone that hasn't run yet (below). live: it is open on another device that never snapped it; opened here, it opens as a clone unless you take it over (see One place at a time). A clone that dx fork starts is auto until it has run. The next time dx records anything (a commit, dx snap, dx wake, dx tidy, an auto-sync tick) it becomes a snap. Until then dx sessions --json can show it as auto with a transcript.
claimedboolTrue for a session you snapped or named (coloring or grouping an auto session makes it a snap); false for an auto nobody touched: one the commit hook started, or a clone that hasn't become a snap yet. dx log, dx tidy and the picker use the same rule.
agentstring or nullThe coding tool that ran the session (claude today).
repo.pathstringThe folder the session belongs to: the repo's top level, or a plain folder.
repo.namestringThe repo's name, from its remote, else the folder's name. Also the default group.
repo.remotestring or nullThe remote without its scheme, user and .git, e.g. github.com/me/proj.
repo.gitboolTrue when the session has a commit, a branch or a remote. A live session is always false here, which says nothing about its folder.
commitstring or nullThe commit the session was recorded at, as stored: the 40 hex digits dx snap and a fork's clone keep (a SHA-256 repository's 64 are cut to 40), or the shorter form the commit hook and older versions wrote. dx shows 7 characters of a whole hash, and a shorter one as it is.
branchstring or nullThe branch; null on a detached HEAD.
namestring or nullThe session's name (at most 120 characters).
namedboolname is not null.
explicitboolA person gave the name: dx name, the picker, or a /rename in Claude Code. An explicit name sticks: a re-snap or an older /rename never replaces it; a newer /rename does (the latest choice wins). False for names dx took from the first message or the commit.
titlestringWhat to show: name, else branch, else repo.name.
group.idstringThe group: its label, else repo.name. dx log --group and dx color -g match it ignoring the case of A to Z.
group.labelstring or nullThe label someone set with dx group; null for the default group.
origin.kindstringself: made here. device: came from one of your devices (even one you later unpaired). contact: someone shared it with you.
origin.device_idstring or nullThe device it came from, for device. That device may no longer be in devices[]; use origin.name then.
origin.namestringThis device's name, the source device's name, or the name of the person who shared it.
origin.shared_fromstring or nullWho shared it with you, whenever it arrived as a share.
color.hexstring or nullThe color set with dx color, lowercase #rrggbb.
color.namestring or nullIts palette name, or null for a custom color.
open.hereboolOpen on this device at the last check (constants.ledger_scanned_at), or now with --scan. Any run of it counts: in a terminal, in the background (claude --bg or claude -p), in an IDE or in the desktop app, under any Claude home dx knows (see Claude's home). A session recorded in a home dx can't read says false here, as this field has no word for "can't tell".
open.devices[]array{device_id, seen} for each online device where it is open, by the same rule.
wakeable.okbooldx wake would reopen it: it was open in a terminal within the last 72 hours, isn't open now, and dx didn't just open it in a tab (spawned_recently). A session that only ran in the background, an IDE or the desktop app isn't wakeable. Being open on another device doesn't change this.
wakeable.last_seenint or nullWhen it was last seen open here.
wakeable.before_rebootboolIt was last seen open before this device last booted.
wakeable.cwdstring or nullThe folder it was open in.
wakeable.folder_missingboolThat folder no longer exists.
wakeable.spawned_recentlybooldx opened it in a new tab within the last minute: dx wake, dx open, or for a clone dx fork --open. So a clone that is still starting already shows here.
transcript.pathstring or nullThe transcript dx would use: the newest copy under ~/.claude/projects/ ($CLAUDE_CONFIG_DIR/projects/ when that's set, see Claude's home), else the copy dx keeps for a session from another device, else null (there is none in this run's home or in dx's copies on this device).
transcript.size, transcript.mtimeint or nullIts size in bytes and when it last changed.
transcript.started_atint or nullWith --transcripts: when the conversation started.
transcript.blob_mtimeint or nullWhen dx's own copy (from another device) last changed.
transcript.messagesint or nullWith --transcripts: how many user and assistant messages it holds. null means "not counted"; it never means zero.
last_activeintThe latest of ts, transcript.mtime and transcript.blob_mtime.
holders[]arrayIds of your other devices that hold a copy of this session or have one on its way: the device it came from, and every device dx has queued it for (the whole session or only its details). Queued isn't delivered. Never this device, never a contact. To count copies including this device, add one.
currentboolOnly with --here: the session belongs to that folder. That's when the folder's remote matches the session's; or, for a folder with no remote, the same path or (in a git repo) the same folder name; or when the folder's Claude project directory has a copy of the transcript.

Groups

{ "id": "proj", "label": null, "folder": false, "members": [ "<id>", "..." ] }
FieldMeaning
idThe same string as sessions[].group.id. A group with no sessions isn't listed.
labelThe label someone set, or null for a default group.
folderTrue when none of its sessions (other than live ones) is in a git repo.
members[]Its session ids, in sessions[] order.

Devices

{ "id": "<hex64>", "name": "mini", "self": false, "os": { "raw": "Darwin", "kind": "macos" },
  "state": "online", "last_seen": 1759999900, "version": "0.13.0", "sessions": 12,
  "open": [ { "id": "<uuid>", "name": "viewer fixes", "cwd": "/Users/me/proj", "seen": 1759999900 } ] }
FieldMeaning
idThe device's id from dx connect. null for this device when dx connect was never set up. Join sessions and devices by id, never by name.
nameIts name, or the first 8 characters of its id followed by ….
selfTrue for this device, which always comes first and is always online.
os.raw, os.kindWhat the device reports (Darwin, Linux, MINGW64_NT…), and the same five kinds as self.os.
stateonline (heard from within connect_online_window), seen (heard from before that), or pending (paired, never heard from).
last_seenWhen it was last heard from; null for pending.
versionThe dx version it last reported, or null.
sessionsHow many sessions came from it (for this device: the ones made here or shared with you). dx connect prints the same numbers.
open[]What it reports as open: {id, name, cwd, seen}, whatever its state, so you can apply the online rule yourself. sessions[].open.devices already does.

Contacts

{ "id", "name", "last_seen" } for each person you shared with or received from. name and last_seen may be null.

Values you don't know

A newer dx may print values an older script hasn't seen. Read them as the nearest known one: an unknown origin.kind as device (with no devices[] record), state as seen, type as auto, os.kind as other, and an error code as error. Ignore fields you don't know.

Versions

contract is "<major>.<minor>". Adding a field or a value raises the minor; renaming, removing or retyping a field, or changing what one means, raises the major (see What you can rely on). So a script checks the major: one it doesn't know is a document it can't read. A newer minor only adds, so a script reads it and ignores what it doesn't know.

Acting: verbs from a script

The exit codes and the no-question rule below are stable. The --json results are dx's own: read them, but expect them to change in any release.

Which session a target names

resume, fork, open, drop, name, color, group, send and share take a session the same way. dx tries, in order:

  1. In resume, fork and wake only: a number of up to 9 digits is a position in the list. A number past the end of the list falls through to the next rules.
  2. A full id, in any case.
  3. An exact name.
  4. The first 4 or more characters of an id, when only one session starts with them.
  5. A name in any case, when only one session has it.

When more than one session matches, dx exits 4 and lists them. A name never loses to an ambiguous prefix. A script passes the full id: it always matches exactly one session, and it can never be read as a list number.

The order above is dx's own and may change. What stays is what the codes mean: no match is exit 3, more than one is exit 4.

snap is the exception: it finds a Claude Code session that dx hasn't saved yet, so it also takes any part of an id or of its /rename title. send and share also take a session that is open here but was never snapped. Groups match ignoring the case of A to Z alone, as dx log does: CAFÉ and café are two groups. color and wake take a group too: a target that names no session is read as a group's name, and --group reads it as one straight away. In wake, a number is always a position in the list, and wake <group> <n> is position n in that group's list. A wake target like an id (four or more hex digits and dashes, nothing else) is never read as a group: when no session has it, it is exit 3, and --group reaches a group of that name.

A device (send, connect forget) or a friend (share, share forget) is named by its full id, 64 hex characters in any case; else by its name in any case; else by the first 4 or more characters of its id, when only one has them. Two with that name, or a prefix two share, is exit 4 with each listed, and nothing is done. A trailing …, as dx shows a device with no name, is ignored, so what dx connect prints can be pasted back.

No questions without a terminal

When stdin isn't a terminal, dx never asks. Where it would have asked, it exits 5 and names the flag that answers the question (run: dx resume -y <id>), and nothing is changed.

The session picker needs a console. Without one, dx exits 5 with a hint: pass a target instead.

Exit codes

CodeMeaning
0Done, including when there was nothing to change (setting a color a session already has). wake: at least one tab opened, or nothing needed reopening (for wake --from, also when everything open on that device is already open here).
1Any other error. wake, open and fork --open: no terminal tab could be opened. fork --open: Claude Code is older than 2.0.73, or dx can't read its version. send: nothing could be queued for any device. resume and open: the session is already open on this device; it is open on another device and open-elsewhere is refuse; the copy here is behind and couldn't be brought up to date, or its newer lines haven't arrived; the copies have gone separate ways (see One place at a time). open: a clone in a new tab needs Claude Code 2.0.73. resume, open, fork and fork --open: the session is in another Claude home, or --copy-in can't copy it. resume and open: the session is recorded in a Claude home dx can't read. wake, with --list or --scan too: dx can't read any Claude home (see Claude's home). With --worktree, the refusals marked 1 in its table.
2Usage: an unknown flag or command, a missing argument, a value that isn't allowed.
3Not found: no session, device, friend or group matched; for open and fork --open, the session's folder is gone; with --worktree, no folder on this device holds the session's repo, or the commit isn't in it (rebased away, or never pushed); for wake --from, a session named that isn't open on that device, or whose repo isn't on this device.
4Ambiguous: more than one session, device or friend matched. The candidates are listed. With --worktree, a short hash that now matches more than one commit.
5Needs a person: dx would have asked (stdin isn't a terminal, or --no-input) and -y wasn't given; or the picker had no console. Nothing was changed. Among the questions: a clone under open-elsewhere ask, and a take-over of a copy known to be behind.
6Cancelled: someone answered no, or pressed Esc in the picker.
128+NStopped by signal N (130 after Ctrl-C).

Errors also print error: … on stderr. An unknown command prints the help on stderr and exits 2. dx help, -h and --help print to stdout and exit 0, and so does dx <command> --help.

Results: --json

snap, drop, name, color, group, wake, tidy, send, receive, config, ui, open, fork and doctor take --json. Each then prints one JSON object on stdout and nothing else there. Progress lines still go to stderr. --json also means --no-input. These results are dx's own and may change in any release (see What you can rely on).

{ "ok": true, "verb": "color", "id": "3f2a9c1e-7b4d-4e8f-9a2b-1c3d5e7f9a0b", "name": "viewer fixes",
  "color": "#61afef", "changed": true, "message": "Color for 3f2a9c1e set to #61afef — dx wake will reopen it colored" }
{ "ok": false, "verb": "open", "exit": 4, "error": "ambiguous", "changed": false, "spawned": false,
  "candidates": [ { "id": "3f2a9c1e-…", "title": "viewer fixes" }, { "id": "3f2a7777-…", "title": "feature/x" } ],
  "message": "'3f2a' matches 2 sessions — pick one by its id:" }
FieldMeaning
oktrue exactly when the exit code is 0.
verbThe verb as you typed it.
id, nameThe session acted on. null for verbs that act on several (tidy, color -g, wake), which carry ids[] and count instead.
changedWhether anything changed. Doing what was already done is ok: true, changed: false.
messageThe text dx would have printed for a person.
exit, errorOn failure: the exit code and a short word for it: usage, not_found, ambiguous, needs_confirmation, cancelled or error.
candidates[]{id, title} for each match when the target was ambiguous; for a device or a friend, title is the name as dx connect shows it. For tidy --dry-run, the sessions it would remove.
spawnedopen and fork: a terminal tab was opened. wake: at least one was. No process id is given: dx never learns one.
commandopen: the (cd '<folder>' && claude --resume <id>) line to run, whenever dx printed it instead of opening a tab (--terminal print, VS Code, --dry-run, a tab that failed to open, or a path a tab can't carry); else null, and null too when the path of its folder or of its Claude home holds bytes dx does not print (skipped says which). fork gives the line that starts the clone, which ends in --fork-session --session-id <clone_id>. wake gives the same per session in results[]. Each carries CLAUDE_CONFIG_DIR='<home>' before claude only when that variable is set to an absolute path (see Claude's home).
ids[], count, spawned_count, skipped_count, results[]wake: the sessions it chose, how many tabs it opened and how many sessions it skipped, and per session {id, spawned, terminal, command} with the fields below (clone_id to skipped). skipped at the top level is the same count as skipped_count, kept for scripts written for 0.13.
groupwake: the group it took the sessions from (dx wake <group> or --group), as dx group --json gives it: the label cleaned as dx group stores one (no control character, no byte that isn't UTF-8, at most 40 characters), else the repo's name. It may differ in case from what was typed. A label synced from elsewhere can hold a byte that isn't UTF-8, which dx log --group and dx wake --group still match on, so to name that group again, use the name as typed. null when no group was named.
clone_idfork: the id the clone has, which dx makes before Claude Code starts. id and name are the session it was forked from. open and wake give one too when they open a clone because the session is open on another device. null when no clone was made.
reason, deviceopen, fork and each wake result: reason is open_elsewhere when it opens, or would open, as a clone because the session is open on another device, and device is that device: {id, name, online, last_seen, version}, with last_seen on this device's clock and version its dx. device is null when dx can't tell which device (it then opens a clone all the same). With --worktree, reason says why dx couldn't make the worktree (see At its commit, in its own worktree).
took_overopen and each wake result, with --take-over: {id, name, online, last_seen, behind_bytes, behind_from}. id to last_seen are the device the take-over is from, the one its line names first: the device dx heard from last for resume, open and the local wake, or the device named with wake --from. The others follow in the order they were paired. A session open on several devices is taken over from all of them, and behind_bytes is how many bytes the copy here was missing against the one furthest ahead (null when none reported a size). behind_from is that device, {id, name}, or null when behind_bytes is 0 or null, so a gap is never read as another device's. id and name are null when dx couldn't tell which device. A printed command's result has it too, saying what running the command does. Else null.
copy, behind_bytes, copy_mtimeopen, fork and each wake result: what dx knows of the session's copy on this device, against the newest size another device reported for it. current: nothing that report holds is missing here (the copy here may hold more), and behind_bytes is 0. behind: it is missing the last behind_bytes bytes of that report, or behind_bytes is null when the two don't line up or have gone separate ways. unknown: dx can't tell (no device reported a size, or the newest report came from a dx before 0.14), and behind_bytes is null. none: there is no copy here. copy_mtime is when the copy here last changed, or null.
skippedopen, fork --open and each wake result: why nothing opened, or null: open_here (open on this device), open_elsewhere (open on another device, and open-elsewhere is refuse), behind (the copy here is behind), diverged (the copies have gone separate ways), folder_missing (the session's folder is gone), folder_unusable (the path of the session's folder holds a control character, so dx can't use it), claude_too_old (a clone in a new tab needs Claude Code 2.0.73), other_home (it's recorded in another Claude home and this one has no copy; open and fork take --copy-in, see Claude's home) open_unknown (it's recorded in a Claude home whose sessions folder dx can't read, so dx can't tell whether it's open there, see Claude's home), folder_unprintable (the path of the session's folder holds bytes dx does not print, so dx printed no command for it, and command is null) or home_unprintable (the same for the path of the Claude home it would carry). wake --from adds no_copy (no copy of it on this device yet) and no_repo (no folder here holds its repo). Read a word you don't know as "not opened".
worktree, reasonopen and fork: with --worktree, {path, branch, commit, created, repo}: the worktree the tab starts in; the branch it is on now (null when its HEAD is detached); the full hash its HEAD is at now (for a new worktree, the commit dx made it at); whether this run made it (a reuse says false); and the main checkout it belongs to (the repo the worktree was made from, which may be another clone of the session's remote than the folder dx ran in). Else null. After --dry-run, created is false and path, branch and commit are the ones dx would use (the full hash; when the commit would first need a fetch, which a dry run doesn't do, commit is the one the session has, as stored). The session's own commit is in dx sessions --json. When dx can't make one, reason says why (see At its commit, in its own worktree).
queued, results[]send: whether any device got it queued, and one item per device the send aimed at (see dx send).

Verbs add their own fields beside these: name gives explicit, color gives color, group gives group and explicit, open and fork give terminal and cwd (the folder the tab starts in), and drop gives worktrees[] (see dx drop). dx ui --json adds page_path, built_at and sessions (how many sessions the page lists).

resume and plain fork hand the terminal over to Claude Code. So resume has no --json, and fork --json means fork --open --json: it starts the clone in a new tab and prints the result. Any other verb given --json exits 2 (dx log --json doesn't pretend to work).

dx name

dx name <session> <name>      # set it (alias: dx rename)
dx name <session> --clear     # take it off
dx name <session>             # show it

dx open

dx open <session> [--terminal tmux|vscode|wt|iterm|terminal|print] [--cwd <folder>] [--dry-run] [-y] [--take-over] [--copy-in] [--json]

Opens the session in a new terminal tab and returns at once, unlike resume and fork, which take over the terminal you're in.

dx fork --open

dx fork <session> --open [--terminal <t>] [--cwd <folder>] [--dry-run] [-y] [--copy-in] [--json]

Starts a clone of the session in a new terminal tab and returns, the way dx open opens one. The clone is a new session: it remembers everything so far, then goes its own way, and the original is untouched.

One place at a time

A session is open in one place at a time. Before resume, open or wake opens a session under its own id, dx checks where else it is open. A fork is a new session, so fork makes no such check.

copy says what dx knows of the copy here on every open, fork and wake result, whatever opened. It only reports: whether the session opened is spawned and skipped.

dx wake --from

dx wake --from <device> [<n>|<session>] [-y] [--list] [--dry-run] [--terminal <t>] [--take-over] [--json]

Reopens here what is open on another device, each as a clone unless --take-over; open-elsewhere doesn't apply. The device is named the way dx send names one (see Which session a target names).

At its commit, in its own worktree

dx open <session> --worktree [--terminal <t>] [--dry-run] [-y] [--copy-in] [--json]
dx fork <session> --worktree [--open] [--terminal <t>] [--dry-run] [-y] [--copy-in] [--json]
dx resume <session> --worktree [--copy-in]

Starts the session at the commit it was saved at, in a folder of its own under $DX_HOME/worktrees/<id8>/<repo>, on a branch dx/<name>. dx makes the worktree before the tab opens, in the foreground, from a folder on this device that holds the session's repo, and reuses it on the next run. A clone (every fork, and a session open on another device) gets a worktree of its own, on dx/<name>-<clone id8>.

reasonExitMeaning
no_repo3No folder on this device holds the session's repo (its remote, or for a session with none, its folder or name).
commit_missing3The commit isn't in any folder here that has the session's remote, and fetching that remote in the first of them didn't bring it (rebased away, or never pushed).
commit_ambiguous4The row kept a short hash that now matches more than one commit.
no_commit1The session has no commit: it was saved outside git, snapped before its repository had a commit, or never snapped on the device it was open on.
fetch_failed1The commit wasn't in any of them, and the fetch of the first one's own remote failed.
path_taken1dx can't use the folder that is, or would be, the session's worktree: it isn't a worktree dx made, or it was made on another system that shares the DX_HOME, or it belongs to a repo without the session's remote, or its link to its repo is broken (the repo moved and git worktree repair wasn't run), or its entry in the repo (.git/worktrees/<name>) now belongs to another worktree (the repo was cloned again at its old place, or git pruned the entry while the folder was away and a newer worktree got its name). dx reuses a worktree it made for the session when the repo it is looking at lists it, or when it stands where that repo's worktree would go (another clone of the remote with the same folder name). A clone with a different folder name gets a second worktree.
path_too_long1Windows: a file in the worktree would have a full path of 260 characters or more, or a folder of 248 or more (counted in UTF-16 units, as Windows counts), and core.longpaths is off. dx never sets it.
branch_taken1Both dx/<name> and dx/<name>-<id8> exist already.
add_failed1git worktree add failed. dx removes the branch it made for it.
claude_too_old1Claude Code is older than 2.0.73, or dx can't read its version: the clone's id names the folder, so a clone in a worktree needs one that takes an id. fork: the plain fork without --worktree still works, unless --open (or --json, which opens a tab) is on.
git_too_old1git is older than 2.17, which has no git worktree remove.

Claude's home

Claude Code keeps its transcripts (projects/) and its registry of running sessions (sessions/) in $CLAUDE_CONFIG_DIR, or in ~/.claude when that isn't set. dx uses the same home, read once per run: the run's home.

A session stays in its home. dx records a session's home when it's snapped, when the commit hook starts it and when a fork's clone starts, in a file sync and connect don't send. When the run's home has no copy of a session recorded in another home that still exists, dx copies nothing and starts nothing:

--copy-in (resume, open, fork) lets the copy go ahead, once, and makes the run's home the session's home. wake doesn't take it: exit 2.

A home dx can't read is one whose sessions folder dx can't open, whether by the folder's own permissions, a parent's or a Windows deny. It's never read as gone or closed, and it says nothing about any other home: a session open in a home dx can read is open.

dx send

dx send <session> [<device>] [--full] [--json]

Queues a session for your paired devices, or for the one named. Queued means handed to the transport: dx can't know when it arrives, and it never says "delivered".

results[] has one item for each device the send aimed at (the one named, else every paired device):

device is the name as dx connect shows it. The exit is 0 when at least one device got it queued, or every device was up to date. When nothing was queued and a device failed, it's exit 1. A device that failed beside one that worked gets a warning on stderr, and the exit stays 0.

dx drop

dx drop [<session>] [-y] [--json]

Drops the session, and a tombstone tells your other devices. Claude's transcript stays. When dx made a worktree for the session on this device (see At its commit, in its own worktree), drop offers to remove it and its dx/ branch, if nothing there would be lost: it's clean (untracked files count), no Claude runs in it, it isn't locked and has no submodules, git is 2.17 or newer, and its commits are on a remote, after a fetch of each one. Its ignored files go only with a yes given now, or when each pattern that ignores them is on the disposable list. A git repository of its own inside it goes only with a yes to its own question.

worktrees[] has one item for each worktree dx made for the session on this device:

FieldMeaning
path, branchThe worktree, and its branch (null when it has none).
removed, branch_removedWhether this drop removed the worktree, and its branch.
ignored[]{pattern, count}: each .gitignore pattern that ignores files there, and how many.
deletedIgnored files were deleted with it.
kept_reasons[]Why it was kept, empty when it was removed: removed is false exactly when this says why.
commandThe command that removes it, as the kept line prints it. null when it was removed, for lost and folder_missing, and for remove_failed once git has let it go.
kept_reasonsWhy
dirtySomething in it isn't committed (untracked files count), git couldn't say, or a file is marked assume-unchanged or skip-worktree, so dx can't tell.
unpushedA commit there isn't on a remote, dx can't tell which are, or the commit it started at is only on its branch.
runningA Claude runs in it or may be starting there, dx can't read the list of processes, or a Claude home dx can't read may hold one (see Claude's home).
lockedgit has it locked, or dx couldn't read git's record of it.
submodulesIt has submodules, which git removes only with --force.
nested_repoA folder in it holds a git repository of its own, and no one said yes to its question.
fetch_faileddx couldn't reach a remote to check that its commits are pushed.
old_gitgit is older than 2.17.
not_disposableUnder always with no one to ask, ignored files there match a pattern that isn't on the disposable list; or ignored files appeared after dx asked; or dx couldn't read the whole list of them.
no_persondrop-worktree is ask, and there was no one to ask.
declinedSomeone answered no.
neverdrop-worktree is never.
lostdx can't vouch for it: it isn't where dx makes worktrees, no repository knows it any more, or its repo's entry now belongs to another worktree. Nothing touches it.
remove_faileddx couldn't first remove the links in it, git's remove refused (something changed after dx checked), or the folder stayed behind (a file there is in use).
folder_missingIts folder is already gone. dx forgets it and keeps its branch.

Read a word you don't know as "kept".

dx config

dx config [<setting> [<value> | --clear]] [--json]
dx config disposable [--add <pattern>… | --remove <pattern>… | --clear] [--every-repo] [--json]

Shows or changes dx's settings on this device: open-elsewhere (clone, ask or refuse; see One place at a time), drop-worktree (ask, always or never; see dx drop) and disposable: the .gitignore patterns whose files dx may delete with a worktree, kept as written, each for one repo or for every repo. --add, --remove and --clear change this repo's list, or with --every-repo every repo's. A pattern that starts with # is refused (\#build is the name #build), and so is one that holds a tab.

With no setting, --json gives settings[], each {name, value, default, choices}. With one, the result has that setting's name, value, default and choices, and changed. disposable's value is a list of {pattern, repo}, where repo is null for a pattern every repo shares, else {key, name}, and its choices is null. An unknown setting, an unknown or empty value, or two values is exit 2. Setting the value a setting already has is changed: false.

dx doctor

dx doctor [--json]

Checks dx on this device and says what to fix: the hooks of the repo it runs in, the install, Claude Code, Node.js, dx connect, auto-sync, the terminal dx wake opens tabs in, the worktrees dx made, and what dx left behind. It changes nothing except two things other verbs also keep up to date: Claude Code's version, and the newest release dx knows of. It keeps them in ~/.dx only when that folder exists, and never creates it. It takes no argument; an argument or an option it doesn't know is exit 2.

doctor exits 0 whenever it ran, whatever it found, so ok is true then too. healthy says whether anything needs fixing: true exactly when every check ran and none needs a fix. Exit 1 is only for a run that can't start at all.

findings[] has an item for each thing a check found:

FieldMeaning
checkA stable id: repo, hook_post_commit, hook_pre_push, hooks_path, dx_home, dx_exec, dx_on_path, dx_version, launcher, claude, claude_fork, claude_hook, claude_home, claude_homes, node, rsntr, connect_node, connect_transport, connect_devices, sync_target, sync_daemon, sync_watcher, wake_terminal, tmux, worktree_gone, worktree_orphan, worktree_link, worktrees_other_system, stale_locks and launcher_copies. A check can have several items (one for each worktree or lock folder), and a release can add ids.
checkedfalse when the check couldn't run (git is missing, rsntr's answer couldn't be read, or dx couldn't tell whose a process is). Then needs_fix is false.
needs_fixSomething is wrong, and a person can fix it. A thing that is only worth knowing is false: dx not enabled in this repo, connect or sync not set up, a lock folder left over, a newer release. So a fresh install is healthy when dx is on PATH and the device has git, Claude Code and Node.js. Each one missing makes it unhealthy: dx_on_path, claude or node needs a fix, and without git repo can't be checked.
messageThe sentence a person reads.
commandThe command the line ends with, else null. For a fix, it is the one that fixes it. For a note, it is a next step, such as dx enable or dx update, and nothing needs fixing. Either way it is for a person to read before running it, not for a script to run: one fix pipes curl into bash, and another adds a line to a shell startup file.

Beside healthy and findings[], the result has an object for each part, with the facts its checks read. Like the findings, they are dx's own and may change in any release.

ObjectFields
repogit, top, hooks_from, custom_hooks_path, linked, post_commit (new, old, legacy, other or none), pre_push, tracked
installhome, present, script, ran_from (home, launcher or other), on_path, on_path_kind (link, copy or other), bin_dir, bin_dir_on_path, version, latest_known, latest_checked_at, launcher ({home, on_path, same}, on Windows)
claudefound, path, version, forks_with_id, home, home_from (default, env or ignored), home_exists, home_readable, sessions_exists, sessions_readable, other_homes[] ({home, readable})
nodefound, version
connectset_up, rsntr ({path, version, wanted}), node_running, node_pid, device_name, transport (relay or lan), relay, devices[] ({id, name})
synctarget, daemon_pid, daemon_running, watcher_pid, watcher_running, last_push, last_pull, last_error
waketerminal, reason, opens_tabs, tmux, dx_terminal
worktreesrows[] ({path, id, repo, branch, system, folder, session, link}), other_system (how many were made on another system)
leftoverslocks[] ({path, pid, age}), launcher_copies (Windows), launcher_folder

dx ui --no-open

dx ui --no-open [--out <path>] [--json]

Builds the session viewer page without opening a browser. --out writes it elsewhere (default: ~/.dx/data/ui.html).

Not covered

dx's verbs run through the dx command, and through a local server for dx's own pages that runs only while you keep it open: it listens on 127.0.0.1, acts only for the page dx opened for it, and runs each request as one of a few of the verbs above with --json. There is no URL scheme and no other way in. A transcript's content isn't part of this contract, and clears (--clear) are not sent to your other devices.