Command line reference
Westering has four subcommands. detect, import and intervene each print one JSON document to standard output and read only the files they are handed, and mcp serves detect and intervene as tools to an MCP client. The root also prints the version.
$ ./target/debug/westering --help
An offline policy lab for a graded stall rescue ladder. It reads recorded traces of agent work, detects looping and fixation stalls, and replays scripted scenarios against the ladder, recording which rung clears the stall.
Usage: westering <COMMAND>
Commands:
detect Run the stall detectors over a trace file or a tool call log
import Print the native trace a tool call log imports to
intervene Run a scripted sandbox session
mcp Serve the Model Context Protocol over standard input and output
Options:
-h, --help Print help
-V, --version Print version
detect
$ ./target/debug/westering detect --help
Run the stall detectors over a trace file or a tool call log
Usage: westering detect [OPTIONS] --trace <TRACE>
Options:
--trace <TRACE> Path to a trace file or a tool call log
--format <FORMAT> How to read the file [default: trace] [possible values: trace, openai, anthropic, auto]
--progress <PROGRESS> The rule that marks a logged call as progress, tool-result when not named [possible values: tool-result, call-result]
-h, --help Print help
detect reads one trace file, runs the looping and tool fixation detectors over it, and prints the detections. The trace format page describes the input and the detectors page describes the rules.
--format names how the file is read. trace, the default, is the native trace format, openai and anthropic read a tool call log, and auto decides from the file. --progress names the rule that marks a logged call as progress, tool-result when it is not named, and it is refused beside the trace format. The importing agent logs page describes the formats and the rules.
$ ./target/debug/westering detect --trace examples/logs/openai_chat.json --format auto
{
"detections": [
{
"detail": "call pattern of length 1 repeated 4 times with no progress",
"evidence_span": {
"end_step": 5,
"start_step": 2
},
"pattern": [
"search_files(path=\"src\", query=\"retry_limit\")"
],
"shape": "looping",
"trace_id": "openai_chat"
}
],
"trace_id": "openai_chat"
}
import
$ ./target/debug/westering import --help
Print the native trace a tool call log imports to
Usage: westering import [OPTIONS] --trace <TRACE>
Options:
--trace <TRACE> Path to a trace file or a tool call log
--format <FORMAT> How to read the file [default: auto] [possible values: trace, openai, anthropic, auto]
--progress <PROGRESS> The rule that marks a logged call as progress, tool-result when not named [possible values: tool-result, call-result]
-h, --help Print help
import prints the native trace a trace file or a tool call log reads as, the document detect reads, in the same pretty form. Its --format defaults to auto, and its --progress is the one detect takes. Detect run on the printed document gives the detections it gives on the log, so an imported log can be kept and run again as a trace.
$ ./target/debug/westering import --trace examples/logs/openai_chat.json > target/imported.json && ./target/debug/westering detect --trace target/imported.json | grep -E '"(shape|start_step|end_step)"'
"end_step": 5,
"start_step": 2
"shape": "looping",
intervene
$ ./target/debug/westering intervene --help
Run a scripted sandbox session
Usage: westering intervene [OPTIONS] --scenario <SCENARIO>
Options:
--scenario <SCENARIO> The scripted scenario to run [possible values: fixation-clears-on-nudge, loop-clears-on-nudge, loop-needs-fork, loop-needs-sharper, loop-needs-subtask, loop-never-clears]
--fixtures <FIXTURES> Path to a directory of recorded judgment fixtures
-h, --help Print help
intervene runs one of the six committed scripted scenarios in a local sandbox and prints the session record. With --fixtures <dir> the session also consults recorded judgment answers, as the judgment fixtures page describes. Any other scenario name is refused.
$ ./target/debug/westering intervene --scenario no-such-scenario; echo "exit $?"
error: invalid value 'no-such-scenario' for '--scenario <SCENARIO>'
[possible values: fixation-clears-on-nudge, loop-clears-on-nudge, loop-needs-fork, loop-needs-sharper, loop-needs-subtask, loop-never-clears]
For more information, try '--help'.
exit 2
mcp
$ ./target/debug/westering mcp --help
Serve the Model Context Protocol over standard input and output
Usage: westering mcp
Options:
-h, --help Print help
mcp serves detect and intervene as tools over the Model Context Protocol on standard input and output until its input ends, and then exits 0. The MCP server page describes the tools, the protocol versions, and a client configuration.
Version
$ ./target/debug/westering --version
westering 0.1.0
--version and -V print the package version at exit 0. They are read at the root alone, so westering detect -V is refused as an unexpected argument.
Exit codes
| Code | Meaning |
|---|---|
| 0 | The command ran and printed its document, or help or the version was printed |
| 1 | An internal failure outside the tool's own refusals, such as a document nested past the reader ceiling, or a write failure on a large output |
| 2 | A refusal, a malformed or unreadable trace, log or fixture file, an unknown scenario, or a malformed invocation |
| 120 | Standard output could not take a small output, discovered when the output buffer is flushed at exit |
Each code below was captured from a real run.
$ ./target/debug/westering detect --trace examples/looping_trace.json > /dev/null; echo "exit $?"
exit 0
$ ./target/debug/westering detect --trace target/missing_trace.json; echo "exit $?"
error: trace file cannot be read, target/missing_trace.json
exit 2
$ python3 -c "print('[' * 10000 + ']' * 10000)" > target/deep_trace.json && ./target/debug/westering detect --trace target/deep_trace.json; echo "exit $?"
error: trace file is nested too deeply, target/deep_trace.json
exit 1
Exit code 120 needs a standard output that refuses writes. A pipe whose reader has already closed is one.
$ python3 -c "import os, subprocess; r, w = os.pipe(); os.close(r); print('exit', subprocess.run(['./target/debug/westering', 'detect', '--trace', 'examples/looping_trace.json'], stdout=w).returncode)"
error: stdout: Broken pipe (os error 32)
exit 120
A refusal of a trace, log or fixture file prints exactly one line that starts with error: on standard error, and prints nothing to standard output. A malformed invocation, such as an unknown scenario name or a flag with no value, is refused by the argument parser, which prints its error line and then a usage hint, as the unknown scenario example above shows, also at exit status 2.