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"
| Option | What it does |
|---|---|
--project PATH | The 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 MODE | ask only answers, agent can edit your files, plan writes a plan for you to review. The default is agent. |
--model NAME | gpt-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 TEXT | Send one message, print the reply and exit. |
-c, --continue | Continue the latest chat about this project, including one from the Trace app. |
--conversation ID, --resume ID | Continue an earlier conversation. |
--ui UI | auto (the default) opens the full chat in a terminal, tui always asks for it, and plain gives a simple line-by-line prompt. |
--format FORMAT | text (the default) or json, which prints one JSON event per line, with the last line summing up the turn. |
--no-interactive | Never stop to ask you anything: part previews and file deletions the assistant asks for are declined. |
--auto-approve | Accept part previews and file deletions without asking. Each one is recorded in the output. |
--allow-route | Let the assistant start basic routing without asking. |
--allow-spend | Let the assistant start paid advanced layout runs without asking. Use it with --max-minutes N, the most minutes one run may take. |
--show-thinking | Show the assistant's reasoning as it works. |
--share-components | Share 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
| Command | What it does |
|---|---|
erc | Check the schematic's electrical rules. --all shows every finding. |
drc | Check the board's design rules. --all shows every finding; --refill refills zones first. |
check | Run ERC and DRC. |
update-pcb | Update the board from the schematic. --delete-extra removes footprints no longer in the schematic. |
refill | Refill the board's copper zones. |
finish | Finish the board: teardrops, zones and a check that each decoupling capacitor sits near its pin. --audit-only changes nothing. |
repair | Repair DRC findings automatically. --dry-run says what it would change. |
annotate | Number the schematic's symbols (R1, R2 and so on). |
export KIND | Write gerbers, drill, pos, bom, netlist, pdf, svg, step, glb, ipc2581 or odb files. |
fab | Write the fabrication package: Gerbers, drill and position files and a bill of materials, zipped. |
bom | Write the bill of materials as CSV. |
render | Render the board in 3D to a picture, top (the default) or bottom. |
prep | Check that the board is ready for layout. |
score | Score the board's placement. |
metrics | Measure the layout's quality. |
project | Show the project's files. |
--jsonprints one JSON document instead of the text report, for scripts and coding assistants.--exit-code-violations(onerc,drc,check,prep,scoreandmetrics) exits with code 5 when the check finds errors.--out DIR(onexport,fab,bomandrender) picks the folder. Otherwise files go to afabricationoroutputsfolder in the project, andfabwrites the zip beside its folder.update-pcb,refill,finish,repairandannotatechange 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.
| Option | What it does |
|---|---|
-o, --output FILE | Where to write the report. |
--format FORMAT | report for a text report (the default) or json. |
--units UNITS | mm (the default), in or mils. |
--severity-error, --severity-warning, --severity-exclusions, --severity-all | Which findings to include. |
--exit-code-violations | Exit 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
| Command | Formats |
|---|---|
trace-cli sch export FORMAT | pdf, svg, dxf, hpgl, ps, netlist, bom, python-bom |
trace-cli pcb export FORMAT | gerbers, 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 svg | Symbol 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.
| Option | What it does |
|---|---|
--schematic FILE | Update from this schematic instead. |
--delete-extra | Remove footprints whose symbol is no longer in the schematic. |
--keep-footprints | Keep a footprint whose symbol now names a different one, instead of swapping it. |
--keep-fields | Leave the footprints' fields as they are. |
--remove-extra-fields | Remove footprint fields the symbol doesn't have. |
--group | Carry the schematic's groups over to the footprints. |
--override-locks | Change locked footprints too. |
--relink | Match footprints to symbols by reference instead of by their link to the symbol. |
--allow-duplicate-references | Add 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--hierarchyto 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
| Command | What it does |
|---|---|
pcb refill | Fills every copper zone and saves the board. --no-save only reports. |
pcb finish | Adds teardrops, fills zones and checks that each decoupling capacitor sits near the pin it serves. --audit-only changes nothing. |
pcb repair | Groups 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 metrics | Scores layout quality (connections, routing, zones and DRC) as a JSON report you can compare between runs. |
pcb score | Scores a placement before routing: input-capacitor loop area and decoupling-capacitor mounting inductance. |
pcb calc | Works 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 render | Renders the board in 3D to a PNG or JPEG image. |
pcb layout | Runs 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.
| Command | What it does |
|---|---|
status, review | Show where the project stands. |
changes, branches, stashes | List changes, branches or stashes, with the IDs other commands need. --limit (up to 64) and --offset page through long lists. |
commit -m TEXT | Save a version of your saved changes on this computer. |
push | Publish your commits to the project in Workspaces. |
pull | Bring in the latest published changes. |
create-branch --name NAME | Create a branch. |
switch --branch-id ID | Switch 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 ID | Bring back changes you left on this branch. |
add | Add 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 ID | Open a pull request. |
close-pr --number N, merge-pr --number N | Close or merge a pull request. |
conflicts, resolve-conflict, finish, abort | See 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 ID | Stop a pull request merge that is still running. It doesn't close the pull request. |
receipt --request-id ID | Show what happened to an earlier action. |
reconcile --request-id ID | Check 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 loginopens your browser to signtrace-cliin.--no-browserprints the sign-in address instead, and--with-tokenreads an API token from standard input (see Sign in without a browser).trace-clikeeps its own sign-in, separate from the Trace app's.auth statusshows the accounttrace-cliis signed in to and which sign-in it uses, and exits with a nonzero code if it isn't signed in.auth logoutsignstrace-cliout. The Trace app stays signed in.doctorchecks thattrace-cliis on yourPATH, your sign-in, the connection to Trace, the project in the current folder and your terminal.--jsonprints the result as JSON.--versionprints the version number;version --format plain,commitoraboutprints more detail.
Coding assistants and shell completion
| Command | What it does |
|---|---|
guide | Print how a coding assistant should use trace-cli. --write adds it to the project's AGENTS.md and CLAUDE.md, replacing an earlier copy. |
mcp | Serve Trace to a coding assistant over MCP. See MCP. |
completion SHELL | Print shell completion for bash, zsh, fish or powershell, for example eval "$(trace-cli completion zsh)". |
Exit codes
| Code | Meaning |
|---|---|
0 | The command finished. |
1 | The arguments were wrong. |
3 | An input file was missing or couldn't be read. |
5 | A check found violations (with --exit-code-violations). For the project commands, that means errors. |
| Any other nonzero code | The 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.