Command reference

Every espx command with its arguments and flags, as the CLI defines them.

Every command takes --help. espx --version (or -V) prints the version. No command waits for input unless it takes -i and you pass it.

CommandDoes
setupInstall the esp-rs tools and Rust targets
newCreate a project with esp-generate
buildcargo build --release with a size check
flashBuild and cargo espflash flash --release
runBuild, flash and monitor
monitorWatch a board's serial output
replayPlay back a recording
eraseErase a board's whole flash
cleancargo clean
devicesList attached boards
infoRead a board's chip, flash size and MAC
chipsList supported chips
boardsList known dev boards, or name an attached one
boardPrint one dev board's pins
depsResolved esp-hal crate versions
contextWhat an agent needs to write firmware here
doctorCheck the toolchain, offline
envShell exports for the tools
agentShow or change what AI agents may do
logThe agent audit log
mcpServe MCP, or add espx to an MCP client
updateUpdate espx to the latest signed release (the app's copy updates with the app)
uninstallRemove what setup installed

espx setup

Install the esp-rs tools into ~/.espx/bin and the Rust targets for your chips. Idempotent.

espx setup [--chip <list>|all] [--shell]
FlagMeaning
--chip LISTChips to set up, comma-separated, or all. Default: every RISC-V chip. Xtensa chips (esp32, esp32s2, esp32s3) also install Espressif's Rust fork through espup
--shellAppend eval "$(espx env)" to your shell config (~/.zshrc or ~/.bashrc) so plain cargo finds the tools

See Installation and Xtensa chips.

espx new

Create a bare-metal Rust project for a chip with esp-generate, plus a README and AGENTS.md.

espx new <name> [--chip C] [--board B] [--dir .] [--port P] [--board-id ID] [-o OPT]... [-i]
Argument or flagMeaning
NAMEProject name; the project is created in DIR/NAME
--chip CChip to target (see espx chips). Default esp32c6, or the board's chip
--board BBoard model to target (see espx boards); selects its chip and records its pins
--dir DIRDirectory to create the project in. Default .
--port PPin the board's serial port in espflash_ports.toml
--board-id IDBind the project to a physical board (its id, port or name) in espx.toml's [board] section
-o, --option OPTExtra esp-generate option (wifi, embassy, alloc, defmt, probe-rs, ...). Repeatable. log is on unless defmt is given
-i, --interactivePick options in esp-generate's terminal UI instead of headless generation

See Projects.

espx build

Build the project with cargo build --release, then report the image and RAM size and check the image fits the app partition.

espx build [--dir .] [--json] [-- <cargo args>]
FlagMeaning
--dir DIRProject directory. Default .
--jsonNewline-delimited JSON events on stdout: diagnostic, size, done
-- ARGSExtra arguments for cargo build

espx flash

Build and flash the project with cargo espflash flash --release.

espx flash [--dir .] [--port P] [--baud B] [--monitor] [-i] [--json] [-- <args>]
FlagMeaning
--dir DIRProject directory. Default .
--port PBoard: a port, a board id or a name. Default: [board] id in espx.toml, espflash_ports.toml, or the single connected board
--baud BFlashing speed. Default: [board] baud in espx.toml, else espflash's default or espflash.toml
--monitorOpen the serial monitor after flashing
-i, --interactiveLet espflash ask which board to use when several are connected
--jsonNewline-delimited JSON events on stdout
-- ARGSExtra arguments for cargo espflash flash. With any, espx skips its own build step

See Build and flash.

espx run

Build, flash and open the serial monitor (cargo espflash flash --release --monitor in a terminal).

espx run [--dir .] [--port P] [--until RE] [--expect RE]... [--reject RE]... [--timeout D] [--json] [-- <args>]
FlagMeaning
--dir DIRProject directory. Default .
--port PBoard: a port, a board id or a name. Default as for flash
--until REExit 0 once a monitor line matches this regex
--expect REExit 0 once lines matching each of these regexes have appeared, in order, one line each. Repeatable
--reject REExit 1 at once when a line matches this regex. Repeatable
--timeout DStop monitoring after this long (30s, 2m, 1h) and exit 124
--jsonNewline-delimited JSON events on stdout
-- ARGSExtra arguments for cargo espflash flash. With any, espx skips its own build step

With any of --until, --expect, --reject, --timeout or --json, or when stdin is not a terminal, espx flashes and reads the port itself. See Scripts and CI.

espx monitor

Watch a board's serial output. In a terminal without other flags this is espflash monitor (Ctrl+R resets, Ctrl+C exits); otherwise espx reads the port itself and follows the board through resets. Works outside a project.

espx monitor [--dir .] [--port P] [--baud B] [--until RE] [--expect RE]... [--reject RE]... [--timeout D] [--json] [--record PATH] [--input] [-- <args>]
FlagMeaning
--dir DIRProject directory; its release binary, if built, decodes defmt and resolves backtraces. Default .
--port PBoard: a port, a board id or a name. Default as for flash
--baud BSerial speed. Default 115200, or MONITOR_BAUD
--until REExit 0 once a line matches this regex
--expect REExit 0 once lines matching each of these regexes have appeared, in order. Repeatable
--reject REExit 1 at once when a line matches this regex. Repeatable
--timeout DStop after this long (30s, 2m) and exit 124
--jsonNewline-delimited JSON events on stdout
--record PATHWrite every event and the raw bytes to this file, for espx replay
--inputSend each line typed on stdin to the board
-- ARGSExtra arguments for espflash monitor. An error together with the flags that make espx read the port itself

See Monitor and replay.

espx replay

Play back a recording made with monitor --record, with its original timing.

espx replay <PATH> [--fast] [--until RE] [--expect RE]... [--reject RE]... [--timeout D] [--json]
Argument or flagMeaning
PATHThe recording (newline-delimited JSON)
--fastIgnore the recorded timestamps and play back as fast as possible
--until REExit 0 once a line matches this regex
--expect REExit 0 once lines matching each of these regexes have appeared, in order. Repeatable
--reject REExit 1 at once when a line matches this regex. Repeatable
--timeout DStop after this long and exit 124
--jsonNewline-delimited JSON events on stdout

espx erase

Erase the whole flash of a connected board with espflash erase-flash. This resets the board.

espx erase [--port P]
FlagMeaning
--port PSerial port. Auto-detected when one board is connected

espx clean

Remove build artifacts with cargo clean.

espx clean [--dir .]
FlagMeaning
--dir DIRProject directory. Default .

espx devices

List the serial ports with a dev board on them.

espx devices [--all] [--probe] [--watch] [--json]
FlagMeaning
--allList every serial port, not only known dev boards
--probeIdentify the chip on each port with espflash board-info. This connects to and resets every board listed
--watchKeep running and report boards as they are plugged in and unplugged. Not with --probe or --all
--jsonOne JSON document on stdout; with --watch, one event per line

See Boards and ports.

espx info

Show the chip, revision, crystal, flash size, features and MAC of a connected board with espflash board-info. This resets the board.

espx info [--port P] [--json]
FlagMeaning
--port PSerial port. Auto-detected when one board is connected
--jsonOne JSON document on stdout

espx chips

List the supported chips with their architecture, Rust target and status.

espx chips [--json]
FlagMeaning
--jsonOne JSON document on stdout

See Chips and boards.

espx boards

List the supported dev board models: id, chip and name.

espx boards [--json]
FlagMeaning
--jsonOne JSON document on stdout

espx boards name

Name a physical board in ~/.espx/boards.toml. espx devices shows the name, and every --port flag accepts it.

espx boards name <BOARD> <NAME>
ArgumentMeaning
BOARDThe board's id, its port, or its current name
NAMEThe name: letters, digits, -, _ and .

espx board

Print one dev board model's LED, BOOT button and UART pins, USB ids and documentation link.

espx board <ID> [--json]
Argument or flagMeaning
IDBoard id from espx boards, such as xiao-esp32c6
--jsonOne JSON document on stdout

espx deps

Print the resolved versions of the esp-hal crate family from Cargo.lock.

espx deps [--dir .] [--json]
FlagMeaning
--dir DIRProject directory. Default .
--jsonOne JSON document on stdout, with each crate's source

espx context

Print what an agent needs to write firmware here: chip, board pins, bound board, esp-hal version and features, the esp-hal examples link for the exact release, and attached boards. The same text espx new writes to AGENTS.md.

espx context [--dir .] [--board B] [--json]
FlagMeaning
--dir DIRProject directory. Default .
--board BBoard id (see espx boards) when the project does not record one
--jsonOne JSON document on stdout

See Agent context.

espx doctor

Check rustup, cargo, the tools, rust-src and the RISC-V targets of the stable toolchain, offline. The Xtensa rows are optional.

espx doctor [--json]
FlagMeaning
--jsonOne JSON document on stdout

espx env

Print the shell export lines that put espx's tools (and, after an Xtensa setup, Espressif's fork) on the PATH.

eval "$(espx env)"

espx agent

Show what AI agents may do to boards in a project: the [agent] policy in espx.toml, with boards resolved to ids.

espx agent [--dir .] [--json]
FlagMeaning
--dir DIRProject directory. Default .. Also accepted by agent set and agent allow
--jsonOne JSON document on stdout: the resulting policy. Also accepted by agent set and agent allow

See Agent policy.

espx agent set

Change the policy. Keys you leave out stay as they are, and comments in espx.toml are kept. Pass at least one flag.

espx agent set [--boards B,..|--no-boards|--bound-board] [--flash on|off] [--erase on|off]
FlagMeaning
--boards B,..The boards agents may touch, by id, name or port, comma-separated
--no-boardsLet agents touch no board at all
--bound-boardLet agents touch only the project's [board] id (the default without boards)
--flash on|offWhether agents may flash the allowed boards
--erase on|offWhether agents may erase the allowed boards

espx agent allow

Make the smallest change that lets agents do one thing to one board.

espx agent allow <flash|erase|reset> [--board B]
Argument or flagMeaning
ACTIONflash, erase or reset
--board BThe board, by id, name or port. Default: the project's board, else the one attached

espx log

Show the agent audit log, ~/.espx/agent.log: every tool call an agent made through espx.

espx log [--json] [--tail N]
FlagMeaning
--jsonOne JSON document on stdout
--tail NOnly the last N entries

espx mcp

Serve the Model Context Protocol on stdio for AI agents.

espx mcp

See MCP server.

espx mcp install

Add espx to an MCP client: write its config file, or print the command that does.

espx mcp install --client <claude-code|claude-desktop|cursor|codex|vscode> [--print]
FlagMeaning
--client CThe client to configure: claude-code, claude-desktop, cursor, codex or vscode
--printPrint the config instead of writing it

espx update

Update espx itself to the latest release, after checking its SHA-256 and its signature against the espx release key. Re-run espx setup to update the tools.

espx update [--check] [--force]
FlagMeaning
--checkOnly report whether a newer release exists
--forceReinstall even when already on the latest release

update replaces an espx that the install script put in ~/.espx/bin. Updating has the details. It refuses the copy inside the desktop app, which the app updates itself, and a build that cargo installed: pull the repository and run cargo install --path crates/espx-cli again for that one. --check reports in every case.

espx uninstall

Remove what espx setup installed. Say what with flags, or choose with -i.

espx uninstall [--home] [--xtensa] [--targets] [--shell] [--self] [--all] [-i]
FlagMeaning
--homeRemove ~/.espx: the tools, the export file, the update cache, and everything else espx keeps there
--xtensaRemove Espressif's Rust fork: espup uninstall, ~/.espup, the export file
--targetsRemove the RISC-V Rust targets from rustup
--shellRemove the eval "$(espx env)" line from your shell config
--selfRemove the espx binary itself
--allEverything above
-i, --interactiveAsk about each item in the terminal

Without a flag and without -i, uninstall stops with nothing_selected.