Garak's CLI flags (--target_type, --target_name, --spec) specify which model to scan and which probes, buffers, and tags to run against it; garak/cli.py manages argument parsing, plugin configuration per type, and deprecated option migration. The CLI validates required options (file existence, JSON format), uses mutually exclusive argument groups for plugin configuration, and gates experimental features behind a config flag. A buff (buffer) is a garak plugin that transforms probe payloads before they reach the model, allowing a single probe to exercise a model under multiple input variations; examples of transformations include paraphrasing and encoding.
garak uses --target_type and --target_name CLI flags to specify the model family and exact model to scan; by default it runs all known probes against the target.[1] The --target_type / -t flag also accepts the deprecated aliases --model_type / -m; using any of -m, --model_name, or --model_type triggers a deprecation notice (since version 0.13.1.pre1).[2]
The --spec / -S flag is the unified selection grammar supporting probe modules, buff modules, tags, and tiers; the - prefix excludes items, and tier:N is inclusive (tiers 1 through N) — see Spec grammar and parsing for the full grammar.[2] The --probes / -p, --probe_tags, and --buffs / -b flags are deprecated in favor of --spec / -S; they use argparse.SUPPRESS and therefore do not appear in help output.[2] The --list_probes flag lists all available probes in garak.[1]
The command_options list in garak/cli.py enumerates every valid top-level CLI command: list_detectors, list_probes, list_generators, list_buffs, list_config, plugin_info, interactive, report, version, and fix.[2] The --fix flag applies fixer migrations to a provided configuration; it requires at least one of --config, --*_option_file, or --*_options to be specified.[2]
garak/cli.py generates per-plugin-type mutually exclusive argument groups (--<type>_option_file and --<type>_options) dynamically by iterating over _plugins.PLUGIN_CLASSES and _plugins.PLUGIN_TYPES.[2] parse_cli_plugin_config() accepts plugin options either as a JSON string via --<plugin_type>_options or from a JSON file via --<plugin_type>_option_file; these two arguments are mutually exclusive per plugin type.[2] When --<plugin_type>_option_file is given but the path does not exist, parse_cli_plugin_config() raises FileNotFoundError; if the file's JSON is malformed, it logs a warning and re-raises json.decoder.JSONDecodeError.[2] When --<plugin_type>_options itself contains malformed JSON, the error is only logged as a warning and not re-raised, meaning the option is silently dropped rather than aborting the run.[2]
--allow_abbrev=False is set on the argparser in garak/cli.py, preventing abbreviated long-option matching, which could otherwise cause silent mismatch bugs.[2] Experimental features are gated behind _config.system.enable_experimental; when enabled, the parser description gains the suffix " - EXPERIMENTAL FEATURES ENABLED".[2]
garak/cli.py supports bootstrap confidence interval configuration via --confidence_interval_method (choices: bootstrap or none), --bootstrap_num_iterations, --bootstrap_confidence_level, and --bootstrap_min_sample_size, all of which override config file values.[2]
To probe an OpenAI model for encoding-based prompt injection, set the API key and pass --probes encoding: export OPENAI_API_KEY="sk-123XXXXXXXXXXXX" then python3 -m garak --target_type openai --target_name gpt-5-nano --probes encoding.[1] To probe the Hugging Face gpt2 model for the DAN 11.0 jailbreak using dot-notation probe selection: python3 -m garak --target_type huggingface --target_name gpt2 --probes dan.Dan_11_0.[1]
Sources