Reference / Trace App CLI

CLI Command Reference

The trace-cli commands and their options, from the chat and project commands to ERC, DRC, exports, board updates, conversions, Workspaces and sign-in.

This page covers the commands in trace-cli as shipped with Trace 3.3. To set it up, see Trace CLI: install the Trace app, put trace-cli on your PATH and sign in. The examples write plain trace-cli; use the full path to the executable if it isn't on your PATH.

trace-cli --help prints an overview of the commands, grouped by what they do. Every command prints its own help:

trace-cli --help
trace-cli pcb --help
trace-cli pcb update --help

Commands that read a design take the saved files, not what's open in the editor, so save in Trace first. Keep a design's files together: the .trace_sch or .trace_pcb, its matching .xo drawing file and the project's .kicad_pro and library tables.

AI chat

trace-cli chat talks to the assistant about a project, using your Trace account and your plan's usage, like the chat in the app. Run in a terminal with no other options, it opens the full chat; plain trace-cli in a project folder does the same. See Chat with Trace in your terminal.

trace-cli chat --mode ask --message "List the parts that have no footprint"
OptionWhat it does
--project PATHThe project to work on: its folder, its .kicad_pro, or a schematic (.trace_sch) or board (.trace_pcb). A KiCad file name is mapped to the Trace file next to it. Leave it out to use the project in the current folder or the folders above it.
--mode MODEask only answers, agent can edit your files, plan writes a plan for you to review. The default is agent.
--model NAMEgpt-astra (GPT Astra), gpt-sol (GPT Sol), genie-2-flash (Trace Genie 2.0 Flash) or genie-2 (Trace Genie 2.0). Leave it out to use the default model.
-m, -p, --message TEXTSend one message, print the reply and exit.
-c, --continueContinue the latest chat about this project, including one from the Trace app.
--conversation ID, --resume IDContinue an earlier conversation.
--ui UIauto (the default) opens the full chat in a terminal, tui always asks for it, and plain gives a simple line-by-line prompt.
--format FORMATtext (the default) or json, which prints one JSON event per line, with the last line summing up the turn.
--no-interactiveNever stop to ask you anything: part previews and file deletions the assistant asks for are declined.
--auto-approveAccept part previews and file deletions without asking. Each one is recorded in the output.
--allow-routeLet the assistant start basic routing without asking.
--allow-spendLet the assistant start paid advanced layout runs without asking. Use it with --max-minutes N, the most minutes one run may take.
--show-thinkingShow the assistant's reasoning as it works.
--share-componentsShare parts generated in this run with Trace's shared component catalog. Without it, your setting in the Trace app decides.

With --message, or when the input isn't a terminal (for example in a script), trace-cli behaves as if you passed --no-interactive unless you add --auto-approve. A question nobody is there to answer goes with the assistant's recommended answer. Basic routing and paid runs don't start unless you add --allow-route or --allow-spend; in the full chat, Trace asks you on a card instead. In Agent mode the assistant can still edit your files, so use --mode ask when you only want answers.

If the project has a .trace/rules.md file, the assistant reads it, just as in the app. See TraceRules.

Project commands

New in Trace 3.3. The commands you can type in the chat also run on their own. Each finds the project from the current folder, or the folders above it, unless --project names one.

trace-cli check
trace-cli drc --json --exit-code-violations
trace-cli export gerbers --out ./fab
trace-cli fab
CommandWhat it does
ercCheck the schematic's electrical rules. --all shows every finding.
drcCheck the board's design rules. --all shows every finding; --refill refills zones first.
checkRun ERC and DRC.
update-pcbUpdate the board from the schematic. --delete-extra removes footprints no longer in the schematic.
refillRefill the board's copper zones.
finishFinish the board: teardrops, zones and a check that each decoupling capacitor sits near its pin. --audit-only changes nothing.
repairRepair DRC findings automatically. --dry-run says what it would change.
annotateNumber the schematic's symbols (R1, R2 and so on).
export KINDWrite gerbers, drill, pos, bom, netlist, pdf, svg, step, glb, ipc2581 or odb files.
fabWrite the fabrication package: Gerbers, drill and position files and a bill of materials, zipped.
bomWrite the bill of materials as CSV.
renderRender the board in 3D to a picture, top (the default) or bottom.
prepCheck that the board is ready for layout.
scoreScore the board's placement.
metricsMeasure the layout's quality.
projectShow the project's files.
  • --json prints one JSON document instead of the text report, for scripts and coding assistants.
  • --exit-code-violations (on erc, drc, check, prep, score and metrics) exits with code 5 when the check finds errors.
  • --out DIR (on export, fab, bom and render) picks the folder. Otherwise files go to a fabrication or outputs folder in the project, and fab writes the zip beside its folder.
  • update-pcb, refill, finish, repair and annotate change your files. Work on a copy, and check the result before you order boards.

Checks: ERC and DRC

trace-cli sch erc ./my-board/my-board.trace_sch --output ./erc-report.json --format json --exit-code-violations
trace-cli pcb drc ./my-board/my-board.trace_pcb --output ./drc-report.json --format json --exit-code-violations

Both checks use the rules and severities saved in your project. They write a report and don't change your design.

OptionWhat it does
-o, --output FILEWhere to write the report.
--format FORMATreport for a text report (the default) or json.
--units UNITSmm (the default), in or mils.
--severity-error, --severity-warning, --severity-exclusions, --severity-allWhich findings to include.
--exit-code-violationsExit with code 5 when there are findings, so a script can tell.

DRC also has:

  • --schematic-parity: check that the board matches the schematic.
  • --refill-zones: fill copper zones before checking.
  • --save-board: save the board after refilling (use it with --refill-zones). Leave it out to keep the board file unchanged.
  • --all-track-errors: report every error on each track.

Exports

CommandFormats
trace-cli sch export FORMATpdf, svg, dxf, hpgl, ps, netlist, bom, python-bom
trace-cli pcb export FORMATgerbers, drill, pos, ipc2581, ipcd356, odb, gencad, pdf, svg, dxf, hpgl, ps, stats, step, stpz, glb, vrml, stl, ply, brep, xao, u3d, 3dpdf
trace-cli sym export svg, trace-cli fp export svgSymbol and footprint library graphics
trace-cli sch export pdf ./my-board/my-board.trace_sch --output ./my-board.pdf
trace-cli sch export netlist ./my-board/my-board.trace_sch --output ./my-board.net
trace-cli pcb export gerbers ./my-board/my-board.trace_pcb --output ./fab/ --board-plot-params
trace-cli pcb export drill ./my-board/my-board.trace_pcb --output ./fab/
trace-cli pcb export pos ./my-board/my-board.trace_pcb --format csv --output ./fab/positions.csv

Some formats write one file and others a folder, and each has its own options for layers, units and so on: check --help for the one you use. --board-plot-params uses the Gerber settings saved in the board. Netlists default to KiCad's format; --format also offers kicadxml, cadstar, orcadpcb2, spice, spicemodel, pads and allegro.

Check the layers, drill files and units before you send files to a manufacturer.

Update a board from its schematic

New in Trace 3.2. trace-cli pcb update does what Update PCB from Schematic does in the board editor: it brings in footprints from the project's libraries, sets every pad's net, spreads out the new parts and saves the board. If the board file doesn't exist yet, it makes it.

trace-cli pcb update ./my-board/my-board.trace_pcb --output ./update-report.json

By default it updates from the schematic next to the board (the .trace_sch, or else a .kicad_sch). The JSON report goes to --output, or is printed if you leave that out.

OptionWhat it does
--schematic FILEUpdate from this schematic instead.
--delete-extraRemove footprints whose symbol is no longer in the schematic.
--keep-footprintsKeep a footprint whose symbol now names a different one, instead of swapping it.
--keep-fieldsLeave the footprints' fields as they are.
--remove-extra-fieldsRemove footprint fields the symbol doesn't have.
--groupCarry the schematic's groups over to the footprints.
--override-locksChange locked footprints too.
--relinkMatch footprints to symbols by reference instead of by their link to the symbol.
--allow-duplicate-referencesAdd the new footprints even where that doubles a reference (see below).

The schematic must be annotated: every part needs its own reference, such as R1 and R2 rather than R?. If it isn't, the update stops and lists the parts to fix.

If the board has footprints that carry a schematic reference but aren't linked to its symbols, for example on a board imported or edited apart from the schematic, an update would add a second footprint for each of them. trace-cli pcb update stops before changing anything and lists the references. To update those footprints in place and keep their placement and routing, run it again with --relink. --delete-extra doesn't help here: it removes the placed footprints and adds unplaced new ones. Use --allow-duplicate-references only if you really want the extra copies.

Convert between Trace and KiCad

trace-cli sch convert works in both directions, chosen by the file you give it:

  • A KiCad schematic (.kicad_sch) becomes a Trace schematic (.trace_sch). Add --hierarchy to convert every sub-sheet it uses as well.
  • A Trace schematic becomes KiCad files, with the whole hierarchy: each sub-sheet is written as its own .kicad_sch, in the same place relative to the top sheet as in your project. New in Trace 3.2.

Without --output, the converted file is written next to the original.

trace-cli sch convert ./my-board/my-board.trace_sch --output ./kicad-copy/my-board.kicad_sch

trace-cli pcb convert does the same for boards. A .kicad_pcb becomes a .trace_pcb next to it. A .trace_pcb becomes a .kicad_pcb at the --output you give (required), with the project file and custom rules copied beside it.

trace-cli pcb import reads boards from other design tools. --format takes auto (the default), pads, altium, eagle, cadstar, fabmaster, pcad or solidworks, and --report-format json or text describes what was imported.

Open converted files and check them before you rely on them.

More board commands

CommandWhat it does
pcb refillFills every copper zone and saves the board. --no-save only reports.
pcb finishAdds teardrops, fills zones and checks that each decoupling capacitor sits near the pin it serves. --audit-only changes nothing.
pcb repairGroups DRC findings by cause, applies fixes that can't make the board worse, checks again and reports what's left. --dry-run only reports the plan.
pcb metricsScores layout quality (connections, routing, zones and DRC) as a JSON report you can compare between runs.
pcb scoreScores a placement before routing: input-capacitor loop area and decoupling-capacitor mounting inductance.
pcb calcWorks out net class values: impedance-controlled trace widths from the board's stack-up, track width from current, spacing from voltage and via current.
pcb renderRenders the board in 3D to a PNG or JPEG image.
pcb layoutRuns Trace's advanced placement and routing on the board.

pcb layout is paid, like advanced layout in the app. Run it with --dry-run first: that reports the cost and whether the board is ready, and spends nothing. A real run needs --time-budget MINUTES, the most minutes it may run, and --save writes the result over the input board. See Placement and routing and Billing.

refill, finish and repair save the board unless you tell them not to. Work on a copy, and check the result and run DRC before you order boards.

Workspaces

trace-cli workspaces works with Workspaces projects you have opened in Trace on this computer. Every command takes --project with the full path to the project's .kicad_pro in Trace's local copy. Results are JSON; add --json to print them on one line. Trace CLI walks through a first session.

CommandWhat it does
status, reviewShow where the project stands.
changes, branches, stashesList changes, branches or stashes, with the IDs other commands need. --limit (up to 64) and --offset page through long lists.
commit -m TEXTSave a version of your saved changes on this computer.
pushPublish your commits to the project in Workspaces.
pullBring in the latest published changes.
create-branch --name NAMECreate a branch.
switch --branch-id IDSwitch to another branch. If you have changes that aren't pushed, add --move to take them with you or --stash to leave them on the current branch. --move can't take commits you haven't pushed; push them first or use --stash.
restore-stash --stash-id IDBring back changes you left on this branch.
addAdd a saved local project to Workspaces, with --personal for your Personal Cloud or --team-id ID for a team. --project is the local project here.
open-pr --title TEXT --target-branch-id IDOpen a pull request.
close-pr --number N, merge-pr --number NClose or merge a pull request.
conflicts, resolve-conflict, finish, abortSee and settle conflicts from a pull, a switch or a restored stash: resolve-conflict --conflict-id ID with --decision set to keep-local, take-team or merge, then finish, or abort to stop. Pass the original action's --request-id.
cancel-merge --request-id IDStop a pull request merge that is still running. It doesn't close the pull request.
receipt --request-id IDShow what happened to an earlier action.
reconcile --request-id IDCheck an earlier branch or pull request action with the server.

Reading works while the project is open in Trace. For commands that change it, save your work and close the project in Trace first. They show what they are about to do and ask you to type y; --yes confirms without asking, and without a terminal and --yes they stop and change nothing.

Give each action its own --request-id (any new UUID) if you may need to check on it later with receipt. See Workspaces recovery for what to do when an action didn't finish.

Account and version

trace-cli auth login
trace-cli auth status
trace-cli auth status --json
trace-cli auth logout
trace-cli doctor
trace-cli --version
trace-cli version --format about
  • auth login opens your browser to sign trace-cli in. --no-browser prints the sign-in address instead, and --with-token reads an API token from standard input (see Sign in without a browser). trace-cli keeps its own sign-in, separate from the Trace app's.
  • auth status shows the account trace-cli is signed in to and which sign-in it uses, and exits with a nonzero code if it isn't signed in.
  • auth logout signs trace-cli out. The Trace app stays signed in.
  • doctor checks that trace-cli is on your PATH, your sign-in, the connection to Trace, the project in the current folder and your terminal. --json prints the result as JSON.
  • --version prints the version number; version --format plain, commit or about prints more detail.

Coding assistants and shell completion

CommandWhat it does
guidePrint how a coding assistant should use trace-cli. --write adds it to the project's AGENTS.md and CLAUDE.md, replacing an earlier copy.
mcpServe Trace to a coding assistant over MCP. See MCP.
completion SHELLPrint shell completion for bash, zsh, fish or powershell, for example eval "$(trace-cli completion zsh)".

Exit codes

CodeMeaning
0The command finished.
1The arguments were wrong.
3An input file was missing or couldn't be read.
5A check found violations (with --exit-code-violations). For the project commands, that means errors.
Any other nonzero codeThe command failed; read its message or report.

pcb update, the project commands with --json and the Workspaces commands also say why they stopped in their JSON output.