Skip to content

weft CLI reference

View as Markdown

The weft binary has nine commands. weft studio and weft dev serve Studio; weft runs, weft open, weft export, weft doctor and weft mcp are clients of a running Studio’s JSON API; weft vacuum maintains the database; weft version prints the version. This page lists every flag with its environment variable, default and effect. The how-to pages are Use the weft command, Develop with weft dev and Let Claude Code or Cursor read your runs.

Terminal window
weft --help
weft — the weft framework's command line
Usage:
weft studio [--addr] [--db] [--token] [--rotate-token] [--manifest] [--open] [--no-playground] [--retain] [--pricing] [--log-level] [--log-format]
weft dev [studio's flags] [--no-watch] [--watch dir] [-- command args…] (default: go run .)
weft runs [--url] [--token] [--agent] [--since] [--failed] [--status] [--limit] [--json]
weft open [id] [--url] [--token] [--open] [--with-token] (a run, public, session or trace id; none: the Studio root)
weft export <run id> [--url] [--token] [--format json|jsonl|otlp] [--wefttest dir [--fixtures-only [--test name]] [--force]]
weft doctor [--url] [--token]
weft mcp [--url] [--token] (a read-only stdio MCP server over the Studio API; weft mcp -h lists its tools)
weft vacuum [--db] [--retain]
weft version
Environment (each mirrors a flag): WEFT_STUDIO_ADDR (--addr), WEFT_DB (--db),
WEFT_STUDIO_TOKEN (--token), WEFT_MANIFEST (--manifest), WEFT_STUDIO_URL (--url;
unset, the API commands read the discovery file a running weft studio wrote,
WEFT_DISCOVERY=off skips it, else http://127.0.0.1:7331),
WEFT_RETAIN (--retain; a Go duration of at least 1h, 0 = off), WEFT_PRICING (--pricing),
WEFT_LOG_LEVEL (--log-level: debug|info|warn|error), WEFT_LOG_FORMAT (--log-format: text|json).
Run "weft <command> -h" for a command's flags.

Flags use Go’s flag package: -flag and --flag are the same, a value follows as --flag value or --flag=value, and a boolean turns off with --open=false. weft <command> -h prints that command’s flags, each spelled --name, and exits 0. The exception is weft version, which has no flags: weft version -h prints weft: version takes no arguments (got "-h") and exits 2 (--help likewise, naming --help). Every usage error names its arguments in words, never a Go slice: weft: runs takes no arguments (got "extra"), weft: export needs exactly one run id (got none). weft open and weft export accept their run id anywhere among the flags. weft runs, weft mcp, weft studio, weft doctor and weft vacuum take no positional argument. weft dev takes the app’s command after its own flags; put -- first when that command has flags of its own.

CommandWhat it doesTalks to
weft studioServes Studio (setup B): the UI, OTLP ingest and the playground, over SQLite or ClickHouse— (it is the server)
weft devweft studio in-process plus your app, restarted on a .go save— (it is the server)
weft runsLists the newest top-level runs, one row eachGET /api/runs
weft openPrints the page of a run, public id, session or trace, or the Studio root; --with-token signs it inGET /api/runs/{id}, /api/sessions/{id}, /api/traces/{id}
weft exportWrites a run’s export to stdout, or its replay test to a package directoryGET /api/runs/{id}/export
weft doctorChecks a running Studio, one line per checkGET /api/meta
weft mcpA read-only MCP server over stdio for a coding agent22 read tools
weft vacuumOne retention sweep, then VACUUM or OPTIMIZE TABLE … FINALthe database file or DSN
weft versionPrints the weft version the binary was built from—
weft helpPrints the usage text—

Each connection flag mirrors one environment variable; the flag wins when both are set. The flags without a mirror (--open, --no-playground, --rotate-token, --watch, --no-watch, --read-only and the per-command flags) shape one run of the command, not a connection.

FlagEnvironmentDefaultCommands
--addrWEFT_STUDIO_ADDR127.0.0.1:7331, unpinned: a busy port moves to the next free one in 7331–7340. Either form set pins the address. A Studio already holding the same SQLite file refuses the start (One Studio per database)studio, dev
--dbWEFT_DB, a bare SQLite path, never a URL./.weft/weft.dbstudio, dev, vacuum
--log-formatWEFT_LOG_FORMATtext when a level is set; with neither set, Go’s default log linestudio, dev
--log-levelWEFT_LOG_LEVELinfostudio, dev
--manifestWEFT_MANIFESTthe nearest weft.json from the working directory upwardstudio, dev
--pricingWEFT_PRICINGthe table shipped with this weft (studio/pricing.json)studio, dev
--retainWEFT_RETAINoff: every run is keptstudio, dev, vacuum
--tokenWEFT_STUDIO_TOKENstudio, dev: the database’s stable token in <db>.token, never printed; a generated one, printed, for a database with no file. The clients: the discovery file’s, when it names the resolved Studioevery command but vacuum and version
--urlWEFT_STUDIO_URLthe discovery file’s Studio (WEFT_DISCOVERY=off skips it), else http://127.0.0.1:7331runs, open, export, doctor, mcp

One resolver for the clients. weft runs, open, export, doctor and mcp find the Studio in one order: --url, else WEFT_STUDIO_URL, else the discovery file a running weft studio or weft dev wrote (the trust rules otel.Install uses: loopback, fresh, 0600 and yours), else http://127.0.0.1:7331. The token is --token, else WEFT_STUDIO_TOKEN, else the discovery file’s when that file names the resolved Studio, so a token goes only to the Studio it belongs to. When you named no Studio, one line on stderr says which was taken:

weft: Studio http://127.0.0.1:7331 (discovery file ~/.cache/…/weft/studio.json)

Before 0.20.0 the clients other than weft mcp read --url, else WEFT_STUDIO_URL, else 7331, and never the file.

Environment variables has the same variables with the code that reads each one.

CodeWhen
0Success, including -h, --help and weft help, weft dev reusing a running Studio, and weft dev stopped by Ctrl-C, SIGTERM or SIGHUP
1A failure, printed as one weft: … line on stderr, weft studio on a database another Studio holds included. weft doctor prints its own lines instead and exits 1 when a check reads FAIL
2A usage error: an unknown command or flag, a bad flag value (--status bogus, --retain 30m, --log-level loud), an argument a command does not take, weft version -h included
the app’sweft dev --no-watch: the app’s exit code; 127 when the command cannot start, 1 when a signal ended it

Serves setup B: studio.New with the UI at /, OTLP ingest on /v1/traces and /v1/logs, the playground, and a token wall. Run Studio covers the three setups.

Terminal window
weft studio --db sqlite://other.db --open=false
studio: http://127.0.0.1:7331/
studio: token created in ~/work/other.db.token (stable for this database; --rotate-token renews it)
studio: db other.db
studio: no weft.json from ~/work upward; no manifest (--manifest names one)
studio: apps find this Studio through ~/xdg/weft/studio.json (WEFT_STUDIO_URL overrides it, WEFT_DISCOVERY=off ignores it)
studio: sign in with `weft open --with-token` (prints this Studio's link, the token in its fragment)

The discovery file went to $XDG_RUNTIME_DIR/weft/ because the directory had no .weft; after a default start it goes to ./.weft/ (the location order). The last line is printed when Studio did not open the browser. In the outputs on this page, ~/work and ~/xdg stand for the scratch directories the commands ran in.

FlagEnvironmentDefaultEffect
--addr addressWEFT_STUDIO_ADDR127.0.0.1:7331, unpinnedThe listen address. Set, it pins: a busy address is exit 1, with no probe and no other port. Unset, the port policy applies. Either way the database lock is taken first (One Studio per database)
--db urlWEFT_DB, a bare SQLite path./.weft/weft.dbsqlite://path or clickhouse://user:pass@host:9000/db. sqlite://:memory: has no file. Any other form is exit 1. The banner masks a DSN’s password as ***. Without --db, WEFT_DB is opened as a SQLite file whatever it holds, and the banner reads studio: db $WEFT_DB or ./.weft/weft.db (default)
--log-format formatWEFT_LOG_FORMATtext when a level is set, else Go’s log linetext or json, the server log on stderr. Another value is exit 2
--log-level levelWEFT_LOG_LEVELinfodebug, info, warn (or warning) or error, in any case. Another value is exit 2
--manifest pathWEFT_MANIFESTthe nearest weft.json upwardThe manifest served at /api/manifest, read once at start. A file that cannot be read or does not decode is exit 1 (start lines)
--no-playground—playground onTurns the playground and its runtime link off
--open—on when stdout is a terminalOpens the browser on the UI with the token in the URL fragment; --open=false turns it off. The opener is open on macOS, rundll32 url.dll,FileProtocolHandler on Windows and xdg-open elsewhere; when it cannot start, the start goes on (start lines)
--pricing pathWEFT_PRICINGthe shipped tableA pricing table that replaces the shipped one whole. A file that does not load is exit 1, naming the path and the field
--retain durationWEFT_RETAINoffstudio.Retain: a Go duration (720h), at least 1h; 0 is off. Under 1h, negative or unparsable is exit 2
--rotate-token—offWrites a new <db>.token before serving. Panel tokens signed with the old one stop verifying. On a reuse it is not applied, and a line says so
--token stringWEFT_STUDIO_TOKEN<db>.token, created on the first startThe API token. Set, it overrides the file and leaves it alone

The banner prints, in order: the port note (when the wanted port was busy), the UI link (bare unless the token was generated for this process), where the token came from, the database, then the manifest, retention and pricing notes, and the discovery file’s path. A database with no file prints its generated token instead of a token line:

Terminal window
weft studio --db sqlite://:memory: --addr 127.0.0.1:7466 --no-playground --retain 720h
studio: http://127.0.0.1:7466/#token=<generated>
studio: dev token <generated> (WEFT_STUDIO_TOKEN fixes it)
studio: db :memory:
studio: no weft.json from ~/work upward; no manifest (--manifest names one)
studio: retention 720h0m0s: runs that are not running and were last seen longer ago are deleted (studio's tables only)
studio: apps find this Studio through ~/work/.weft/studio.json (WEFT_STUDIO_URL overrides it, WEFT_DISCOVERY=off ignores it)

The other lines a start can print:

LineWhen
studio: token from --token, studio: token from WEFT_STUDIO_TOKENA fixed token
studio: token from <path> (stable for this database; --rotate-token renews it)A later start on the same file
studio: manifest <path> (--manifest), with WEFT_MANIFEST or found upward in the parenthesesA manifest was loaded; <path> is the resolved path
weft: --manifest: <error>, weft: WEFT_MANIFEST: <error>, weft: manifest <path>: <error> (found upward)The manifest file cannot be read: exit 1
weft: manifest <path>: does not parse: <error>The file does not decode as a JSON object, or its weft is not a number, or its agents is not an array: exit 1. Missing keys are not checked: {} starts and is served
weft: could not open a browser (<error>); open the link yourself--open and no opener could start (a container, a headless box); never an exit
studio: no discovery file (<error>); apps need WEFT_STUDIO_URL=<url>The discovery file could not be written; Studio serves anyway
weft: studio already running at http://127.0.0.1:7331 (pid 1683241) on ~/work/other.db: one Studio per database file — sign in to it with `weft open --with-token`, or stop it firstAnother Studio holds the database file’s lock: exit 1, the database is not opened
studio: sign in with `weft open --with-token` (prints this Studio's link, the token in its fragment)Studio did not open the browser
studio: shutting down (interrupt)SIGINT, SIGTERM or (on unix) SIGHUP: a five-second grace window for open requests, then the discovery file is removed

weft studio and weft dev take an exclusive lock on <db>.lock beside a SQLite database (flock, LockFileEx on Windows). The lock is held while they serve and released by the kernel when the process ends, a crash included. It is taken before the port policy, so a second weft studio on the same file is refused whatever its port, its directory or its timing, with exit 1 and the line above. Before 0.20.0 it said …, reusing and exited 0, and only on the wanted port. weft dev reuses the holder instead of refusing. It names the holder only from this user’s 0600 lock file with a loopback URL and a live pid.

The lock file holds the holder’s URL and pid while it serves and stays on disk after the process exits. Leave it there: removing it races the next start. A symlink, a directory or any other non-regular file at that path is refused at start, and on unix so is a hard link (a file with more than one link). The refusal reads lock …/weft.db.lock: dblock: the lock file is not a regular file; weft never follows, truncates or chmods such a file, so remove it to start. The lock stands for the file a symlinked database path names; two hard links or two case-insensitive spellings of one database file are not detected. A ClickHouse database takes no lock.

The HTTP server bounds a request’s headers at 10 s and an idle keep-alive connection at 2 minutes. Writes and body reads have no server timeout: /api/live and the runtime link’s command stream stay open, and a 16 MiB ingest upload may be slow.

weft studio in-process, with the same flags and port policy, plus the app: the command after its flags (after -- when the command has flags of its own), by default go run .. Develop with weft dev covers the loop.

Terminal window
weft dev -- go run ./cmd/app
answered: Order 42 has shipped.
failed: weft: run failed at step 1: weft: run exceeded the maximum number of steps
studio http://127.0.0.1:7331/ · app pid 2825860 · runtime rt_921efe69d315c004 registered
studio: shutting down (interrupt)

The first two lines are the app’s own output; the third is weft dev’s start line; the last follows Ctrl-C.

FlagEnvironmentDefaultEffect
--addr, --db, --log-format, --log-level, --manifest, --open, --pricing, --retain, --rotate-tokenas on weft studioas on weft studioAs on weft studio. The manifest, retention and pricing notes are not printed: the start line replaces the banner
--no-playground—playground onTurns the playground off; the start line then reads playground off (--no-playground): no runtime link
--no-watch—watching onDoes not restart the app on a .go change; weft dev exits with the app’s exit code
--token stringWEFT_STUDIO_TOKEN<db>.tokenThe API token; the app receives it as WEFT_STUDIO_TOKEN
--watch dir—the working directoryA directory to watch for .go changes, repeatable; given, the list replaces the default. A path that is not a directory is exit 2 (not checked under --no-watch)

The app’s environment gains WEFT_ENV=dev (unless the shell set WEFT_ENV to something), WEFT_STUDIO_URL, WEFT_STUDIO_TOKEN and WEFT_DB (the absolute SQLite path); those three override the shell’s. For a database with no file or ClickHouse weft dev does not set WEFT_DB, so a WEFT_DB from the shell passes through (the table).

Prints the newest top-level runs, one row each, paging GET /api/runs 100 rows at a time:

Terminal window
weft runs
weft: Studio http://127.0.0.1:7331 (discovery file ~/xdg/weft/studio.json)
ID AGENT STATUS STARTED STEPS DUR COST PROMPT STOPPED BY ERROR
otel-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7 support succeeded 2026-10-01 12:00:00 +0200 2 3.2s $0.0029 - - -
weft: weft open <id> shows one in Studio; weft export <id> --format jsonl writes it out

That run is the stock-span run from Inspect agents written in other languages, which records no prompt or stop. STARTED is local time with its zone. DUR is the run’s duration, COST its whole bill (own plus delegated), PUBLIC ID a column of its own when a row has one, and ERROR a failed run’s kind and why, cut to 60 characters. The table is stdout; the Studio line and the hint naming the next step go to stderr. PROMPT is the first line of the run’s prompt preview, cut to 40 characters with …, or - for a content-off run. STOPPED BY is what ended the run, with a cancelled run’s cause in parentheses, or - when none was recorded. Every cell prints control characters as spaces.

FlagEnvironmentDefaultEffect
--agent string—every agentOnly this agent’s runs (the API’s agent=)
--failed—offOnly failed runs (status=failed). With --status other than failed or cancelled it is exit 2
--json—offPrints the rows as Studio serves them, a JSON array (prompt_preview, stopped_by and cancel_cause included when set)
--limit int—50Prints at most this many runs; 0 prints every match. When it hid runs, stderr says weft: showing the newest N; --limit 0 lists all. Negative is exit 2
--since duration—no boundA duration back from now (2h, 30m) or an RFC 3339 time; paging stops at the first older run. Anything else is exit 2
--status status—every statusrunning, succeeded, failed, interrupted, parked or cancelled; another word is exit 2
--token stringWEFT_STUDIO_TOKENnoneThe bearer token
--url stringWEFT_STUDIO_URLthe resolverThe Studio to talk to

The columns changed in 0.20.0; scripts read --json, which did not. No match prints weft: no runs match on stderr and exits 0; with --json it prints [] on stdout and nothing on stderr.

Takes a run id, a public id, a session id or a trace id, tried in that order, checks it exists and prints its page, bare. With no id it prints the Studio root:

Terminal window
weft open otel-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7
weft open --with-token
http://127.0.0.1:7331/runs/otel-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7
http://127.0.0.1:7331/#token=<token>

weft open --with-token with no id is a terminal’s signed-in link: the token in the fragment, never sent to a server. (The Studio line on stderr is left out above.)

FlagEnvironmentDefaultEffect
--open—offAlso opens the browser on the link, the token in its fragment, with weft studio’s opener; a failure is the line weft: could not open a browser (<error>); open the link yourself, never an exit
--token stringWEFT_STUDIO_TOKENnoneThe bearer token
--url stringWEFT_STUDIO_URLthe resolverThe Studio to talk to
--with-token—offPrints the link with #token= and the resolved token, signed in. The token may be the panel tokens’ signing key: keep it out of logs

An id that is none of the four is exit 1, naming what was tried. A subagent’s id, which carries slashes, is escaped in the link.

Writes GET /api/runs/{id}/export to stdout, or with --wefttest <dir> writes Studio’s save-as-test tree into the package directory <dir>: <agent>_replay_test.go beside testdata/TestReplay_<run>/*.json, a test that passes under go test there (Turn a Studio run into a test). --fixtures-only writes the fixtures alone, where wefttest.Replay reads them:

Terminal window
weft export d286bfec55eff7c475a895aa2fae1987 --wefttest ./testdata --fixtures-only --test TestSupportReplay
weft: wrote 2 fixtures to testdata/TestSupportReplay; a test named TestSupportReplay replays them with wefttest.Replay(t, "./testdata")
FlagEnvironmentDefaultEffect
--fixtures-only—offWith --wefttest: the fixtures alone under <dir>/<test> (a suite’s testdata), no test file. Before 0.19.0 this was what --wefttest did
--force—offWith --wefttest: writes over a test file or fixtures already there, the old *.json fixtures removed first (replaced, never merged). Without it a target already holding them is exit 1. A symlinked testdata or testdata/<test> is refused before any write
--format string—jsonThe stdout export: json, jsonl or otlp. wefttest and any other value are exit 2; with --wefttest it is exit 2
--test name—the run idWith --fixtures-only: the test that replays the fixtures, so the directory <dir>/<name>. A subtest TestX/case is a nested directory; an absolute name or one that leaves <dir> is exit 2. Without --fixtures-only it is exit 2: the tree names its test TestReplay_<run>
--token stringWEFT_STUDIO_TOKENthe resolverThe bearer token
--url stringWEFT_STUDIO_URLthe resolverThe Studio to talk to
--wefttest dir—offWrites the run’s save-as-test tree (the replay test and its testdata/) into the package directory dir instead of stdout

--test, --fixtures-only or --force without --wefttest is exit 2. Under --wefttest the zip’s names and declared sizes are checked before the first write, and each refusal is exit 1. The old *.json fixtures in the target are then removed, and a size check while reading can still fail partway, after they were removed and some files were written:

MessageWhen
the wefttest export is not a zip: …The answer does not read as a zip
the wefttest export holds "<name>": want fixture files under one testdata/<test>/A malformed testdata/ entry, or a second test directory
the wefttest export holds "<name>": want fixture files under testdata/<test>/A path outside testdata/ that is not a plain file name (a subdirectory, or a name with \ or :)
the wefttest export mixes flat fixtures ("<name>") with testdata/<test>/Top-level fixtures beside a testdata/<test>/ layout
the wefttest export holds "<name>": want fixture filesAn entry that is not a regular file
the wefttest export holds no fixturesNothing but the _test.go skeleton
the wefttest export unzips to more than 536870912 bytesThe entries together pass 512 MiB, by their headers or as read

The command has no flag for a run’s subagent tree: Studio’s &tree=1 is a browser download (Export a run).

Asks a running Studio’s GET /api/meta what it is, within 5 s, and prints one line per check: ok, warn or FAIL, a label and the finding. A FAIL line exits 1; warnings do not.

Terminal window
weft doctor
ok studio reachable at http://127.0.0.1:7331 (weft v0.20.2, studio v0.20.2)
ok token accepted
ok discovery ~/xdg/weft/studio.json -> http://127.0.0.1:7331 (this Studio)
ok db sqlite ~/work/other.db (643.8 KiB)
warn content studio stores content as received; latest run otel-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7: unmarked — the latest run carries no content mark: no events stored, a weft older than the mark, or a non-weft exporter
ok data newest run 629h45m0s ago (service py-support) carries no weft version: a non-weft exporter
ok otlp open: OTLP at http://127.0.0.1:7331/v1/traces and /v1/logs takes a loopback app's spans with no ingest token
ok ingest 1 OTLP batches accepted, 0 refused; no app reported lost records (weft.records.dropped on its heartbeats and run brackets)
warn runtimes none connected
- WEFT_ENV is unset in this shell: the app opens the runtime link only with WEFT_ENV=dev (or runtime.Enabled(true))
- WEFT_STUDIO_URL is unset in this shell: the app dials the Studio a running `weft studio` names in its discovery file, else its otel Studio destination; set WEFT_STUDIO_URL=http://127.0.0.1:7331 to pin this one (or runtime.Studio(url, token))
ok panel /panel.js matches studio v0.20.2
ok manifest none: no weft.json configured (studio.Manifest, or --manifest / WEFT_MANIFEST) and no runtime registered one, nothing to compare

That is weft v0.20.2 against the stock-span run above, after the Studio line on stderr.

LineReadswarn or FAIL when
studiothe response itself, weft_version, studio_versionNot reachable: that line, a start one with weft studio hint, and exit 1; no other check runs
tokenthe status, auth_requiredFAIL: a 401 (no token, or the wrong one) or any other non-200 answer
dbdb.kind, db.path, db.sizenever
contentcontentwarn: the latest run’s content is not full, or it could not be read
ingestingestwarn: a refused OTLP batch in the last hour, or an app that reported dropped records
runtimesruntimes, capabilities, this shell’s WEFT_ENV and WEFT_STUDIO_URLwarn: none connected, with hints from the two variables
panelpanel_version, studio_versionFAIL: /panel.js has no version stamp, or not the server’s
manifesthas_manifest, manifest_checkwarn: the manifest and the latest runs disagree, or the check failed. Its finding leads with its source: weft.json: 1 agent, 1 checked against their latest runs: current, or runtime registrations (no weft.json): …. Before 0.20.0 the label was weft.json
discoverydiscovery_file, this shell’s discovery filewarn: another Studio’s file, two Studios on one database, or no discovery file. WEFT_DISCOVERY=off in the shell is ok, naming the WEFT_STUDIO_URL an app then needs
datacontent.latest (started, weft_version, service)the newest run’s age, weft version and service
otlpthe ingest routeopen, walled or off

The finding each line can print, beyond the sample above (- lines are continuations):

LineFinding
studiostudio not reachable at <url>: <error>, then - start one with `weft studio`, or point --url (WEFT_STUDIO_URL) at the one you run; … api/meta is not JSON: …
tokena 401 names --token "$(cat <db>.token)" and weft open --with-token. A 401 to the token sent: FAIL refused: it is not this studio's token (WEFT_STUDIO_TOKEN / --token). Else FAIL api/meta answered <code>: <message>, or … a redirect to <location>, not followed: point --url at the Studio itself; ok not required (no Token configured)
db<kind> <path> (<size>); <kind> <path>; <kind> (no file path served to this caller); <kind> (this studio predates db.path)
content…; no run stored yet; warn …; the latest run could not be read: <error>; a non-full latest run adds - fix: <fix> when Studio gives one
ingest<n> service(s) reported records lost on the way here, with one - <service>: N records dropped by its destination (last heard <time>) each. Then - fix: queue full or exports failing — the app's WARN names which ("weft/otel: destination queue full": raise it with otel.QueueSize(n), or use otel.Blocking() under WEFT_ENV=dev (or otel.DevMode()); "weft/otel: destination dropped records": its err is the export's failure). A refusal adds - last refused at <time>: <error> and a fix naming Studio’s WARN and the ingest token. ok not served (no ingest.dropped): … for a Studio older than ingest health or a panel token
runtimesok N connected; under warn none connected, - studio has no runtime link: the playground is off (studio.Playground(true)) when the capability is missing, and WEFT_STUDIO_URL=<x> in this shell, not <url>: the app dials the former when the variable names another Studio
panelFAIL /panel.js carries no version stamp: this studio's build lacks the panel bundle; FAIL /panel.js is <v>, studio is <v>: the embedded bundle is stale (make studio-build)
manifestEach finding leads with its source. none: no weft.json configured (studio.Manifest, or --manifest / WEFT_MANIFEST) and no runtime registered one, nothing to compare. present (weft.json or a runtime's registration); not checked for this caller. warn the check failed: <error>. With a file: weft.json: N agents; none has a recorded run to compare yet, weft.json: N agents, M checked against their latest runs: current, or warn weft.json: stale for <agents>: weft.json and the latest runs disagree (…): regenerate weft.json, or redeploy the app if weft.json is newer. With no file, runtime registrations (no weft.json): N agents, M checked against their latest runs, or warn runtime registrations (no weft.json): … (runs from another build): redeploy the app, or ignore it if those runs are old with a - stale: <agents> line. Before 0.20.0 this line was labelled weft.json
FlagEnvironmentDefaultEffect
--token stringWEFT_STUDIO_TOKENthe resolverThe bearer token
--url stringWEFT_STUDIO_URLthe resolverThe Studio to check

A capability that is off names its cause (--no-playground: “drop the flag”), and a stale panel or manifest line names the reinstall and the latest run’s manifest hash.

A redirect is reported, never followed, by every client command, not only weft doctor (Notes).

A stdio MCP server over a running Studio’s read API; stdout is the protocol and every line of its own goes to stderr. It serves until stdin closes, then exits 0. Let Claude Code or Cursor read your runs lists the 22 tools.

FlagEnvironmentDefaultEffect
--read-only—trueThe only mode: every tool is a GET. --read-only=false is exit 2
--token stringWEFT_STUDIO_TOKENthe discovery file’s token, when that file names the resolved StudioThe bearer token, sent in the Authorization header only and never printed
--url stringWEFT_STUDIO_URLthe discovery file’s Studio, else http://127.0.0.1:7331The Studio to read. Without --url, each look after a failure re-reads the variable and the file

A Studio that does not answer at start is one WARN on stderr, and the server serves anyway. A Studio that answers and refuses (a 401 with no token) is exit 1. Every tool takes max_bytes: default 65536, at most 4194304.

One retention sweep when a retention is given, then the backend’s vacuum: VACUUM on SQLite, OPTIMIZE TABLE … FINAL on the tables deletions mutate on ClickHouse. It touches Studio’s tables only.

Terminal window
weft vacuum --retain 1h
vacuum: swept 1 runs last seen before 2026-10-27T11:49:08Z (retention 1h0m0s)
vacuum: other.db 270336 → 270336 bytes (WAL 57712 → 0 bytes)

The main file and the WAL are printed apart. On SQLite the vacuum checkpoints the WAL after VACUUM (PASSIVE, then TRUNCATE, each under its own 250 ms busy timeout), so the file’s size after a vacuum is its size; a WAL a live reader or writer holds is said. On ClickHouse the second line is vacuum: <db> optimized.

FlagEnvironmentDefaultEffect
--db urlWEFT_DB, a bare SQLite path./.weft/weft.dbsqlite://path or clickhouse://user:pass@host:9000/db. A SQLite file that does not exist is exit 1 (weft: no database at missing.db (nothing to vacuum)), never created. A URL in WEFT_DB is taken as a file name: exit 1 when no such file exists, else that file is vacuumed (Notes)
--retain durationWEFT_RETAINnone: no sweepSweeps the runs not running and last seen longer ago first. Under 1h is exit 2

Keep and delete recorded runs covers when to run it.

Prints the weft version the binary was built from (its module tag). weft --version and weft -version are the same; any argument after it, -h and --help included, is exit 2 (weft: version takes no arguments (got "-h")).

Terminal window
weft version
v0.20.2

weft help, weft -h, weft --help and weft -help print the usage text above on stdout and exit 0. weft with no command prints it on stderr with weft: a command is required, and an unknown command with weft: unknown command "<name>"; both exit 2.

  • Pass --url or set WEFT_STUDIO_URL when the discovery file cannot find Studio. Since 0.20.0 every client, weft runs, open, export, doctor and mcp, finds a running weft studio or weft dev through its discovery file before trying 7331, so a Studio the port policy moved to 7332 is found. A Studio elsewhere, another user’s, or a shell with WEFT_DISCOVERY=off is not. (Source: cmd/weft/resolve.go:15-22, 45-80)
  • Point --url at the Studio itself, not at a proxy that redirects. weft runs, open, export, doctor and mcp never follow a redirect: Go would keep the bearer token on a hop to another port or from https to http. The answer is exit 1, weft: GET <path>: <code>, a redirect to <location>, not followed: point --url at the Studio itself. (Source: cmd/weft/api.go:37-48, 94-100; internal/doctor/doctor.go:167-172, 199-205)
  • Give the clients the token; they have no default. A weft studio on a file always walls its API with <db>.token, and a client without one gets 401 the API requires a token. (Source: cmd/weft/main.go:874-875; cmd/weft/api.go:122-124)
  • Give ClickHouse to --db, never to WEFT_DB. WEFT_DB is a SQLite file path, so WEFT_DB='clickhouse://u:p@host:9000/db' weft studio starts with no error and serves a new, empty SQLite file at ./clickhouse:/u:p@host:9000/db, the password in its path and in the banner’s token created in … line. --db takes the URL and masks the password. (Source: cmd/weft/main.go:886-906, 925-933; observed with the v0.20.2 binary)
  • weft vacuum reads a URL in WEFT_DB as a file name too. Where no such file exists it exits 1 with weft: no database at clickhouse://u:p@host:9000/db (nothing to vacuum). Where weft studio already ran with the same variable, it vacuums that stray SQLite file, prints vacuum: clickhouse://u:p@host:9000/db <before> → <after> bytes (WAL <before> → <after> bytes), password included, and exits 0. (Source: cmd/weft/vacuum.go:129-146, 117)
  • --addr turns the port policy off. A pinned busy address is exit 1, never a reuse. Leave it unset to reuse a running Studio on the same database. (Source: internal/listen/listen.go:154-160)
  • --status takes six words; --failed is one of them. --failed --status succeeded is exit 2; --failed --status cancelled lists cancelled runs. (Source: cmd/weft/api.go:334-347)
  • weft vacuum needs the file to itself. SQLite’s VACUUM and another process’s writer wait on each other up to the busy timeout; run it while Studio is stopped or idle. (Source: cmd/weft/main.go:217-222)

Symbols used: wefttest.Replay · studio.New · studio.Retain