Skip to content

CLI Reference

This page lists every subcommand and flag of the bifrost executable. For task-oriented examples, see CLI and Scan a Codebase.

The installed binary prints the same information:

  • bifrost --help lists every mode, flag, MCP toolset, and tool name.
  • bifrost scan --help lists the scan options.
  • bifrost --help TOOL prints one tool’s description and input schema.
  • bifrost --list-policies prints the built-in policy catalog.
  • bifrost --list-row-schemas prints the row-relation catalog that relational policies can bind.

No flag has an environment-variable equivalent. Environment variables that change behavior are listed in Environment Variables.

Bifrost reads the command line in this order and runs the first mode that applies:

  1. pack-engine-profile or install-semantic-packs as the first argument runs that subcommand.
  2. scan as the first argument runs the scan subcommand. In any other position, scan is an unknown argument.
  3. Any policy flag anywhere on the command line makes the invocation a policy invocation. The policy flags are --policy, --no-builtin-policies, --policy-file, --policy-pack, --policy-category, --policy-id, --exclude-policy-id, --list-policies, --list-row-schemas, --format, --fail-on, --suppressions-file, --scope-file, --baseline-file, --accept-current, --evaluation-date, --diff-base, --no-incremental, --policy-timings, --output, --color, --verbose, --require-explicit-schema-versions, --explain-finding, --explain-candidate, --explain-near-misses, and --explain-generation.
  4. --install registers Bifrost with coding hosts.
  5. --query-file runs one saved code query.
  6. --tool runs one tool.
  7. --repl starts the interactive code-query REPL.
  8. Otherwise Bifrost starts an MCP server over stdio. With no arguments, it uses the searchtools toolset and binds the current directory.

--help, -h, --version, -V, and --build-identity act as soon as the parser reaches them. Arguments before them are parsed; arguments after them are not.

SubcommandArgumentsOutputMeaning
bifrost scan [PATH] [OPTIONS]One optional project directory; default: current directoryPolicy report on stdout; pack witness lines on stderrEvaluates every default-active built-in policy on PATH.
bifrost scan --list-builtin-policiesNoneJSON on stdoutPrints the built-in policy catalog, the same document as --list-policies, and runs nothing.
bifrost pack-engine-profileNone; any argument is an errorOne JSON object on stdoutPrints this build’s semantic-pack consumer profile: engine_version, build_identity, model_set_sha256, capability_contract_version, schemas, and capabilities. Pack acquisition reads the same profile in-process; this command is for inspection.
bifrost install-semantic-packs BUNDLE_DIR CACHE_ROOTTwo non-empty pathsOne JSON object on stdoutVerifies a native semantic-pack bundle and installs its compatible packs into the catalog CACHE_ROOT/semantic-pack-catalog.v<N>. A relative CACHE_ROOT is resolved against the current directory. The output names the catalog root and each installed pack’s pack_id, pack_version, and manifest_digest. A bundle that installs no compatible pack is an error.

bifrost scan accepts only these options. Each may appear once.

OptionValueDefaultMeaning
PATHDirectoryCurrent directoryProject root to scan. When omitted, the scan prints the directory it uses on stderr. A path that is not a directory is an error.
--list-builtin-policiesNoneOffPrint the built-in catalog as JSON and exit. Cannot be combined with PATH or any other option.
--format FORMAThuman, json, or sarifhumanReport format.
--fail-on THRESHOLDnever, finding, note, warning, or errorwarningLowest severity of an active finding that makes the scan exit 1.
--evaluation-date YYYY-MM-DDUTC calendar date, year 0 to 9999Today in UTCDate used to decide whether suppressions have expired.
--no-incrementalNoneOffEvaluate every policy in full without reading or writing policy units in the analyzer cache.
--output PATHFile pathStandard outputWrite the report atomically to PATH.
--verboseNoneOffPrint complete finding records, provenance, and audit details. Only with --format human.
--color MODEauto, always, or neverautoANSI colors in human output. Only with --format human.
-h, --helpNone-Print the scan help.

Before the report, a scan writes one builtin-policy-pack <id>@<version> policies=<count> line per shipped pack, one builtin-policy-catalog sha256=<digest> line, and one activation summary line to stderr. The policies=<count> values and the summary count every policy in the catalog, including opt-in policies that the scan does not run.

A scan reads the default suppression, scope, and baseline files under PATH. It does not accept --sources, --policy-timings, policy selectors, or custom document paths. Use the flag surface for those.

The Modes column uses these names: MCP (MCP server), tool (--tool), query (--query-file), REPL (--repl), install (--install), and policy (any policy invocation, including listings and explanations). “Once” means that a second occurrence is an error. “Last wins” means that a later occurrence replaces the earlier value without an error.

FlagValueDefaultRepeatModesMeaning
--root DIRDirectoryCurrent directoryLast winsMCP, tool, query, REPL, policyWorkspace root to analyze. With --mcp and no --root, the server starts without a workspace and waits for the client to supply one. In REPL mode, and in MCP mode without --mcp, a missing --root makes Bifrost print the directory it uses on stderr.
--workspace NAME=PATHName and directory-RepeatableMCPAdd one named workspace to a single MCP server. The name must start with an ASCII letter or digit and contain only letters, digits, ., _, and -. See MCP Tools Reference.
--mcp TOOLSETSToolset names joined with |: searchtools, core, symbol, workspace, diff, extended, text, slopcopsearchtools when bifrost runs with no mode flagLast winsMCPRun an MCP server over stdio with these toolsets. core is symbol, workspace, and diff. searchtools is every toolset.
--replNoneOff-REPLStart the interactive code-query REPL.
--diff-snapshot-object-dir DIRPath to a Git objects directory, absolute or relative to the current directoryNoneLast winsMCP, toolTrusted extra object store for immutable diff-tool endpoints. Bifrost resolves the path and rejects a missing path or a non-directory before it serves requests.
--no-line-numbersNoneOff-MCP, tool, queryRemove line-number prefixes from rendered text. In MCP mode this also changes the symbol toolset: get_definitions_by_reference and scan_usages_by_reference replace get_declarations_by_location, get_definitions_by_location, and scan_usages_by_location. --tool and --query-file print only structured JSON, so most of their output is unchanged.
--installNoneOffOnceinstallRegister a user-level MCP server named brokk with every supported coding host found on PATH. See Install Bifrost.
FlagValueDefaultRepeatModesMeaning
--tool NAMETool name from bifrost --help-OncetoolRun one tool and print one JSON object. Every tool in the searchtools toolsets is available, plus classify_test_files. See MCP Tools Reference.
--args JSONInline JSON object{}Last winstoolArguments for --tool, in the tool’s MCP input shape. File arguments may use <commit-ish>:<path>.
--sources PATHFile, directory, or glob under the rootWhole workspaceRepeatabletool, policyBuild the workspace from only these files. An explicit source overrides .bifrostignore. In policy mode it restricts evaluation to these files.
--query-file PATHWorkspace-relative .rql or .json file-OncequeryRun one saved CodeQuery through query_code. The path must stay inside the workspace after symlinks are resolved.
--workspace-scaled-limitsNoneOffOncequeryRun --query-file with the execution limits that policy evaluation uses, which scale with source volume, instead of the interactive limits.
FlagValueDefaultRepeatMeaning
--policyNoneOffOnceEnter policy mode without other policy flags. With no --policy-file and no selector, Bifrost evaluates every default-active built-in policy.
--policy-file PATHWorkspace-relative .rqlp file whose root is a (policy ...) documentNoneRepeatableEvaluate this workspace policy. Any explicit input replaces the built-in default.
--policy-pack IDBuilt-in pack ID: bifrost.code-smells, bifrost.correctness, bifrost.security, bifrost.effectsNoneRepeatableSelect built-in policies by pack.
--policy-category NAMEBuilt-in category: correctness, performance, security, effectsNoneRepeatableSelect built-in policies by category.
--policy-id IDBuilt-in policy ID from --list-policiesNoneRepeatableSelect one built-in policy. This is the only way to run an opt-in policy.
--exclude-policy-id IDBuilt-in policy ID from --list-policiesNoneRepeatableSkip one built-in policy after the positive selectors resolve. Use it to drop a policy from a pack while the run keeps every other member, including members added later.
--no-builtin-policiesNoneOffOnceRefuse the built-in default. Requires at least one --policy-file. Cannot be combined with the three selectors or --exclude-policy-id.
--list-policiesNoneOffOncePrint the built-in catalog as JSON and exit.
--list-row-schemasNoneOffOncePrint the bifrost_relation_schema/v1 catalog as JSON and exit.

The pack and category values above are the ones in this build’s catalog. --list-policies prints the current list. An unknown pack, category, or ID is an error with exit status 2.

Built-in selectors combine like this:

  • Several values of one selector form a union. --policy-category correctness --policy-category performance selects both categories.
  • Different selectors intersect. --policy-pack bifrost.security --policy-category security selects security-category policies in that pack. A combination that matches no policy is an error with exit status 2.
  • A policy whose catalog activation is opt-in runs only when --policy-id names it. A pack or category selection, --policy, and scan skip it.
  • --exclude-policy-id applies after the selectors above intersect. It needs at least one pack, category, or ID selector. Each excluded ID must be a known built-in policy that the selectors select, and the exclusion must leave at least one policy to run. An unknown ID, an ID the selectors do not select, and an exclusion that removes every selected policy are errors.
  • A report from a run that selected built-in policies records the shipped catalog digest, the selected policy IDs, and the excluded policy IDs under evaluation.builtin_selection. A run of workspace --policy-file inputs alone has no such field.
  • Selected built-in policies run in catalog order, without duplicates. They share one analyzer snapshot, report, and exit status with every --policy-file input.
FlagValueDefaultRepeatMeaning
--suppressions-file PATHWorkspace-relative JSON file.bifrost/suppressions.json, .bifrost/suppressions.private.json, and .bifrost/suppressions.local.json, read in that order when presentOnceRead accepted findings from this one file instead of the three default files.
--scope-file PATHWorkspace-relative JSON file.bifrost/policy-scope.jsonOnceRead directory-level acceptances and root exclusions from this file.
--baseline-file PATHWorkspace-relative JSON file.bifrost/baseline.jsonOnceRead, and with --accept-current write, the bulk-acceptance baseline.
--evaluation-date YYYY-MM-DDUTC calendar date, year 0 to 9999Today in UTCOnceDate used for suppression expiry. A suppression stays current on its expires_at date.
--require-explicit-schema-versionsNoneOff-Reject a policy, endpoint, or RQL dependency that omits its schema version.

The field tables of these files are on Policies Reference.

FlagValueDefaultRepeatMeaning
--format FORMAThuman, json, or sarifhumanOnceReport format. All three come from one canonical report.
--verboseNoneOffOnceHuman output only: print every finding, including applied suppressions, with provenance and audit details.
--color MODEauto, always, or neverautoOnceHuman output only. auto uses ANSI colors only when the report goes to stdout (no --output), stdout is a terminal, NO_COLOR is unset, and the platform is not Windows.
--output PATHFile pathStandard outputOnceWrite the report to a temporary file beside PATH, synchronize it, and atomically replace PATH.
--fail-on THRESHOLDnever, finding, note, warning, or errorwarningOnceLowest severity of an active unsuppressed finding that makes a complete run exit 1. finding includes unrated findings.
--diff-base REVAny revision git rev-parse acceptsNoneOnceAlso evaluate the committed content of REV, classify findings as new or persisting, and gate only on new findings.
--no-incrementalNoneOffOnceEvaluate every policy in full without reading or writing policy units in the analyzer cache.
--accept-currentNoneOffOnceRun the selected policies and write every current strong finding identity to the baseline file. Writes only when the run is reliable and complete and no suppression record is orphaned.
--policy-timingsNoneOffOnceAdd each policy’s elapsed time to the report’s work metrics. Also write one bifrost: policy stage timings {...} line to stderr whose JSON has kind bifrost.policy-stage-timings and schema_version 1.

These flags ask a question about one policy. They print one JSON document.

FlagValueDefaultRepeatMeaning
--explain-finding IDFinding ID as a policy report prints it-OnceExplain why the selected policy produced this finding.
--explain-candidate PATH:BYTE_START[-BYTE_END]Workspace path and byte offsets; the last : separates the path-OnceExplain why the selected policy did not report this exact position.
--explain-near-misses NInteger from 1 to 64-OnceRank the N subjects in the policy’s own seed scope that came closest to matching. A policy whose seed declares no kind, language, or path scope is refused.
--explain-generation HEXworkspace_generation value from an earlier answer-OnceAnswer only if the workspace still has this generation; otherwise exit 2. Requires one of the three flags above.

The selection must resolve to exactly one policy, given by --policy-file or a built-in selector.

FlagValueMeaning
-h, --help [TOOL]Optional tool name; a following argument that starts with - is not a topicPrint the general help, or one tool’s description and parameters. An unknown tool is an error.
-V, --versionNonePrint bifrost <version>, then one builtin-policy-pack <id>@<version> policies=<count> line per shipped pack, then builtin-policy-catalog sha256=<digest>.
--build-identityNonePrint the embedded source identity: the source commit, with a -dirty suffix and digest when the build tree had local changes.
FlagBehavior
--server MODEDeprecated alias for --mcp MODE. Prints bifrost: --server is deprecated; use --mcp <toolsets> on stderr, then behaves like --mcp MODE. bifrost --help does not list it.
--lspPrints the LSP server has moved out of this repository and exits 1. The language server is the separate bifrost-lsp program. LSP Server describes it and the earlier releases that still accept --lsp.
--server lspPrints the --server deprecation warning, then the same message as --lsp, and exits 1.

Bifrost rejects these combinations before it does any work:

CombinationResult
Any policy flag with --install, --query-file, --tool, --args, --mcp, --repl, --no-line-numbers, --workspace-scaled-limits, or --diff-snapshot-object-dirError, exit 2
--list-policies with --list-row-schemasError, exit 2
A listing flag with any other policy flag or --sourcesError, exit 2
Two of --explain-finding, --explain-candidate, --explain-near-missesError, exit 2
An explanation flag with --format, --fail-on, --suppressions-file, --scope-file, --baseline-file, --accept-current, --evaluation-date, --diff-base, --policy-timings, --verbose, --color, or --sourcesError, exit 2
An explanation flag with no --policy-file and no built-in selectorError, exit 2
--explain-generation without an explanation flagError, exit 2
--no-builtin-policies with a built-in selector, or without --policy-fileError, exit 2
--verbose or --color with --format json or --format sarifError, exit 2
--accept-current with --fail-on or --diff-baseError, exit 2
--install with any other flagError, exit 1
--query-file with --tool, --args, --mcp, --repl, --diff-snapshot-object-dir, or --sourcesError, exit 1
--workspace-scaled-limits without --query-fileError, exit 1
--tool with --mcp or --replError, exit 1
--sources without --tool or a policy flagError, exit 1
--repl with --mcpError, exit 1
--repl with --diff-snapshot-object-dirError, exit 1
--workspace with --root or --diff-snapshot-object-dir, or without --mcpError, exit 1
A scan option outside the scan option list, a second PATH, or --list-builtin-policies with anything elseError, exit 2
Mode012
bifrost scanThe run was reliable, no active unsuppressed finding met --fail-on, and no suppression record is orphaned. Also a build that ships no policy packs.The run was reliable, and at least one active unsuppressed finding met --fail-on or at least one suppression record is orphaned.The run was unreliable: for example, a policy was inconclusive, unsupported, failed, or cancelled, or there was a suppression, scope, baseline, schema, output, or argument error.
Policy evaluation (--policy, --policy-file, selectors)Same as scan.Same as scan.Same as scan. Status 2 takes precedence over status 1.
--accept-currentThe run was reliable and complete, and the baseline was written.At least one suppression record is orphaned, so nothing was written.The run was not reliable and complete, so nothing was written; or the write failed.
--diff-baseAs policy evaluation, counting only new findings.As policy evaluation, counting only new findings.As policy evaluation; also when the root is not in a Git repository or REV does not resolve.
--list-policies, --list-row-schemasThe catalog was printed.Not used.Argument error, or the catalog could not be loaded.
--explain-finding, --explain-candidate, --explain-near-missesAn answer was printed, including an outcome of failed or unknown and an empty ranking.Not used.No answer could be produced, the generation did not match, the output write failed, or an argument error.
--toolThe tool succeeded.The tool failed, or an argument error.Not used.
--query-fileThe query ran.The query failed, or an argument error.Not used.
MCP server, --replThe session ended normally.Startup failed, including an invalid BIFROST_MCP_LOG or BIFROST_MCP_FILE_WATCHER value, or an argument error.Not used.
--installEvery host found was registered.No supported host was found, or registration failed for at least one host.Not used.
pack-engine-profile, install-semantic-packsThe command succeeded.Any error.Not used.
--help, --version, --build-identityOutput was printed.Unknown tool topic, or --version could not load the policy catalog.Not used.

Any argument error in a command line that contains a policy flag, or that starts with scan, exits 2 rather than 1. For example, bifrost --tool search_symbols --format json exits 2.

On Unix, a --tool or --query-file run checks every 2 seconds whether its parent process has exited. If it has, Bifrost cancels the run, waits 20 seconds, and exits with status 3.

--fail-on never turns off only the finding threshold. An orphaned suppression record still gives status 1, and an inconclusive, failed, or unsupported policy still gives status 2. Policies Reference lists every condition that makes a run unreliable.

The source repository also builds a most_relevant_files binary. Release packages do not include it. Build it with cargo build --bin most_relevant_files.

most_relevant_files [--root PROJECT_ROOT] [--recency-half-life COMMITS|none]
[--ranking-mode cascade|history_imports|usage_graph|usage_graph_exact]
[--history-only] [--exclude-tests] SEED_FILE...
ArgumentValueDefaultMeaning
SEED_FILEOne or more workspace pathsRequiredFiles to rank related files for.
--rootDirectoryCurrent directoryWorkspace root.
--ranking-modecascade, history_imports, usage_graph, usage_graph_exactcascadeRanking strategy.
--recency-half-lifePositive number of commits, or none250Half-life of the Git history weight. none turns off recency decay.
--history-onlyNoneOffRank by Git co-change only, without import-graph expansion.
--exclude-testsNoneOffDrop files classified as test or test_support from the printed page. The page can then have fewer than the 100 results it ranks.

Each output line is path<TAB>kind, where kind is test, test_support, production, or ambiguous. Errors exit 1.