CLI Command-line interface
The snt executable evaluates PUEL expressions, converts quantities, and
parses DIPL definitions from a terminal or shell script. It uses the same
C++ implementation as the language bindings.
Module-specific command examples are grouped with the PUQ, MAT, and DIP modules.
Getting started
For a source build, enable ENABLE_EXEC_APPS and
ENABLE_EXEC_APPS_SNT, together with the PUQ, DIP, and API modules.
These options are enabled by default. The executable is written to
build/bin/snt and installed into the installation prefix’s bin
directory. See Installation for build and installation steps.
Once the executable is on your PATH, inspect the available commands:
snt -h
snt dip -h
snt dip init -h
snt dip format -h
snt dip validate -h
snt dip lint -h
snt dip setup -h
snt puq -h
snt mat -h
snt report -h
snt hub -h
snt mcp -h
snt dip docs --list
snt completion bash
snt dip docs prints the embedded DIPL language reference by chapter or
heading, while snt completion bash and snt completion zsh print shell
completion generated from the command metadata. For DIPL formatting,
validation, linting, and DIPfile tool settings, see DIPL developer tools.
Model Context Protocol
Use snt mcp to connect AI agents through the Model Context Protocol.
See MCP: connecting AI agents for setup, capabilities, examples, and Docker deployment.
Quantities and units
The PUQ commands evaluate expressions, convert units, inspect quantities, and list available unit definitions. Quote expressions so the shell passes them as a single argument:
snt puq eval "23*cm + 3*m"
snt puq convert "2.5*m" "cm"
snt puq info "23*kg*m2/s2"
snt puq list deriv
For conversions between unit systems, specify the input system with -s
and output system with -S. Some conversions also require the physical
quantity, supplied with -Q:
snt puq convert "12*statA" "A" -s ESU -S SI -Q "I"
Materials and chemical compositions
The mat command inspects elements, stoichiometric substances, and material
mixtures. Isotopes use natural abundances by default. Use
--default-isotopes for elements such as technetium or curium that have no
natural-abundance entry in the periodic table; where NIST publishes a
representative isotope, MAT uses it. Charge signs are conventional electric
charges: C{13+2} is a cation, H{1+1} is a proton, and H{1-1} is a
hydride anion. Quote formulas and material expressions so the shell passes
them as one argument:
snt mat element "C{13+2}"
snt mat element "H{1+1}"
snt mat element "Cm" --default-isotopes
snt mat substance "H2O"
snt mat material "0.2 <H2O> 0.8 <NaCl>"
Material normalization is selected with --norm number,
--norm number_fraction, or --norm mass_fraction. Matter options accept
PUQ quantity expressions and therefore use explicit multiplication symbols:
snt mat substance "H2O" --default-isotopes \
--mass-density "997*kg/m3" --volume "1*L"
snt mat material "0.965 <H2O> 0.035 <NaCl>" --norm mass_fraction \
--mass-density "1.02*g/cm3" --volume "1*L"
Available matter inputs are --number-density, --mass-density,
--volume, and --mass. The command prints the composition and derived
matter values, including component number densities and mass densities. MAT is
a stoichiometric and matter-calculation module; it does not model reactions,
phases, activities, or thermodynamic equilibrium. Particle expressions such as
[p], [n], and [e] use free-particle rest masses and exclude nuclear
binding energy.
Use --field NAME to print only a summary value instead of the full report.
The output contains one unlabelled value per line. Repeat --field to select
several values in the requested order:
$ snt mat substance "H2O" --field formula_mass
18.015286*u
$ snt mat element "C{13+2}" --field charge --field mass
+2
13.002258*u
Available fields are expression, symbol, isotope_selection,
declared_isotope, effective_isotope_number, charge, mass,
ionization_energy_sum, protons, neutrons, electrons,
mass_correction, and mass_approximation for elements; formula,
formula_mass, protons, neutrons, electrons,
mass_correction, mass_approximation, and component_count for
substances; and expression, normalization, reference_count,
reference_batch_mass, mean_species_mass, protons, neutrons,
electrons, mass_correction, mass_approximation, and
component_count for materials. Matter fields are matter_volume,
matter_mass, matter_mass_density, matter_number_density, and
matter_total_number_density. Optional fields exist only when the
corresponding value is available; requesting a missing field is an error.
Positive atomic ions include the sum of NIST reference ionization energies when every required stage is known. The output identifies applied corrections and labels missing corrections or unsupported electron affinities explicitly. Isotope shifts and source uncertainties limit the accuracy of the reported masses.
DIPL parameters
Compare saved environments with snt dip compare. It prints a summary and
up to 50 differences by default. Exit status is 0 when equal in the selected
scope, 1 when different, and 2 for invalid input or an error.
snt dip compare before.diph5 after.diph5
snt dip compare before.diph5 after.diph5 --scope full --max-details 20
--max-array-examples N controls the number of flat array indices shown
for each changed array. See DIPH5 comparison
for scope semantics.
Use dip parse with --input file to load a file or --input string
to supply definitions directly. --print displays nodes with names and
units, and --request selects a node:
snt dip parse --input file parameters.dip --print
snt dip parse --input string "answer int = 42" --request answer --print
Repeat --input to combine sources before evaluating a request.
For a reusable set of units, named sources, DIPL files, and inline DIPL, place the declarations in a DIPfile project:
mkdir my-project
cd my-project
snt dip init
printf 'simulation.steps int = 100\n' >> main.dip
snt dip parse --project DIPfile --request simulation.steps --print
snt dip init creates DIPfile and main.dip in the current directory.
It refuses to replace either existing file. Replace the example parameter in
main.dip with your own declarations.
--project supplies the model and resolves paths relative to the DIPfile.
It can be combined with --input override_string or --input override_file
to tune its values.
Guided parameter setup
Mark project values with !setup to include them in a guided questionnaire.
snt dip setup uses the DIPL type for the prompt, displays labelled !options
as selectable choices, and accepts numeric values with units, plain text, and
DIPL expressions for arrays. Existing values are shown as defaults; values
without defaults must be supplied. Each answer is checked immediately with the
regular DIP parser, so !condition, !format, units, shape, and type checks
apply at each prompt. The complete project is validated again before the
override is written; invalid values return to their prompt.
snt dip setup examples/dip/GuidedSetup/DIPfile --output run-settings.dip
snt dip parse --project examples/dip/GuidedSetup/DIPfile \
--input override_file run-settings.dip --print
For example, the setup can keep existing defaults, reject invalid input, and repeat that prompt until a valid value is entered:
$ snt dip setup examples/dip/GuidedSetup/DIPfile --output run-settings.dip
[1/8] simulation.enabled — Run the simulation
Enable? [Y/n] <Enter keeps true>
[2/8] simulation.method — Time integration method
1) Euler
2) Runge–Kutta 4
3) Adaptive Runge–Kutta
Select option (Enter keeps current): <Enter>
[3/8] simulation.steps — Number of time steps
Enter a value (with units if needed; Enter keeps current): 700
[4/8] simulation.timestep — Time step
Enter a value (with units if needed; Enter keeps current): 3 m
Incompatible dimensions: m cannot be converted to ms.
Enter a value (with units if needed; Enter keeps current): 0.3 ms
[5/8] simulation.tolerance — Relative error tolerance
Enter a value (with units if needed; Enter keeps current): 1e-5
[6/8] simulation.run_name — Name for this run
Enter text (Enter keeps current): "run 1"
Format mismatch: the value does not match [A-Za-z0-9_-]+.
Enter text (Enter keeps current): run-1
[7/8] simulation.initial_state — Initial state vector
Enter a DIPL value expression (Enter keeps current): [3, 4, 6, 7]
Dimension range mismatch: expected exactly 3 values.
Enter a DIPL value expression (Enter keeps current): [3, 4, 6]
[8/8] simulation.random_seed — Random seed (required; no default is declared)
Enter a value (with units if needed; Enter keeps current): 234429
Write to run-settings.dip? [Y/n] y
Saved run-settings.dip
The full parser diagnostics include details and source locations; they are
shortened above to keep the interaction readable. Text entries are plain text,
so enter run-1 without quotes. Enter accepts the displayed default where
one exists. The output file is an ordinary DIPL override that can be reused
with snt dip parse or another DIP integration.
The guided setup example demonstrates the input controls inferable from DIPL types and directives. See guided-setup-example.
To use a DIPfile project in the browser, package its local text dependencies into one static JSON asset:
snt dip package --project DIPfile --output project.bundle.json
The packager evaluates the project with the native parser, includes files it
opens (including .dipt tables), and reports missing or out-of-directory
files. See WebAssembly and JavaScript for parseBundle and validateBundle.
Values for shell scripts
The --value option prints exactly one defined, unitless scalar without
its name or string quotes. It requires --request and cannot be combined
with --print. Optionally use --type to require bool, integer,
float, or string without implicit conversion:
answer=$(snt dip parse --input string "answer int = 42" \
--request answer --value --type integer)
printf '%s\n' "$answer"
In this mode, invalid requests write an error to standard error and return a nonzero exit status. Arrays, values with units, and undefined values are rejected. For reading such scalar settings during CMake configuration, see CMake integration.
Registering schemas
Schema inputs take a name and either body text or a file containing the body,
without a $schema wrapper:
snt dip parse -i schema_string settings 'value int = 42' \
-i string 'physics : settings' -r physics.value --value
snt dip parse -i schema_file settings settings.dipl \
-i string 'physics : settings' --print
As with other individual inputs, these cannot be combined with --project
or --load.
Overriding values
Pass an unwrapped override body using override_string:
snt dip parse -i file parameters.dip \
-i override_string 'simulation.steps = 1024' --print
Duplicate targets fail, including duplicates in $override regions in files.
Project inputs accept override text alongside the manifest:
snt dip parse --project DIPfile \
-i override_string 'simulation.steps = 1024' --print
The project and override inputs may be supplied in either order.
Use -i override_file overrides.dip to read an unwrapped override body from
a file.
Describing and previewing parameters
For the full review cycle, see Inspect, propose, preview, review.
The read-only semantic commands return versioned JSON. describe reports
one evaluated path, while list selects values by path and explicit tags:
snt dip describe --project DIPfile --path simulation.steps --format json
snt dip list --project DIPfile --query '?simulation.' --limit 50 --format json
snt dip list --project DIPfile --tag-all runtime --format json
Use dip entries to print only the direct names of a group or map, one per
line. List elements are printed as zero-based indices. This is useful for a
shell loop; use --format json when names need machine-safe quoting:
snt dip entries --project DIPfile --path materials
snt dip entries --input parameters.diph5 --path materials --format json
while IFS= read -r key; do
printf 'Material: %s\n' "$key"
done < <(snt dip entries --project DIPfile --path materials)
snt dip records --input findings.dip --collection findings \
--where-eq category=warning --field quote --field editorial_interest --limit 20
snt dip override-contract --project DIPfile --path simulation.steps --format json
snt dip schemas --project DIPfile --format json
Use --input for a DIPL file or a DIPH5 snapshot. Values in the JSON
response have a DIPL text encoding. Values exceeding --max-value-elements
or the 4096-byte text cap are omitted, and tables have no single value.
list omits value content by default and
reports whether its result was truncated. Missing defaults and dependency
graphs are marked unavailable instead of being inferred. Add
--record-graph to describe or list to capture dependencies while
parsing a DIPfile or DIPL input. A DIPH5 snapshot uses its saved graph state.
The describe, list, override-contract, preview, and records
responses use the versioned schema_version value 1.
Available values from describe and list use an object with
available: true, encoding: "dipl", and text; the text is the exact
DIPL representation, so large integers are not rounded through a JSON number.
Unavailable values and facts use available: false with a stable reason.
Units are normalized DIPL strings or null. Source locations are null
when unavailable; otherwise they contain source and a one-based line,
and some commands also include column or file. records
additionally provides the original DIPL text in dipl alongside its typed
value; use dipl when exact numeric spelling or precision matters.
records queries a keyed map collection in item order. Repeat --where-eq
to require multiple scalar string fields and --field to select output
fields. Results include the item key, typed scalar values, original DIPL text, types,
units, declaration locations, a total count, and an offset. Missing
selected fields are null; missing filter fields do not match. Use
--offset with --limit for the next page. This command accepts one
project, DIPL file, or DIPH5 snapshot per call. The same query is available
through the C++ dip::Inspector::records API and the dipl_records MCP
tool.
schemas returns the snt-schema-hierarchy/2 contract: reusable member
trees, ordered application sites, and each evaluated value’s applied and
contributing schema IDs. Schema IDs are registered names within this project.
It preserves collection item paths such as items[key]. For a DIPH5 input,
definitions_available and applications_complete are false; retained
schema associations are still listed, while unknown origins and inheritance
flags are null. This command does not modify the model.
override-contract classifies an override target as existing_value,
existing_item, new_item, or unavailable. It reports applicable
constraints and a reason for unavailable targets. A new collection item needs
a schema on its collection; append a list item with items[] or create a
map item with items[key]. This is a static guide: use preview to check
the proposed value and dependent calculations.
For a populated example, run this from the repository root:
snt dip describe --input examples/dip/SemanticDescription/parameters.dip \
--path simulation.speed --record-graph --format json
It reports the evaluated speed, units, descriptive metadata, tags, enforced
condition, source location, and reads of simulation.distance and
simulation.duration. Metadata fields absent from the DIPL input remain
empty; the tool does not invent publication details or a default value.
preview evaluates the original model and a separate candidate with
ordered overrides. It reports validation diagnostics and an effective-value
diff without writing project files or generated outputs:
snt dip preview --project DIPfile --override-file candidate.dip --format json
snt dip preview --input parameters.dip --override 'simulation.steps = 200' \
--max-details 20 --format json
An invalid candidate is a JSON result with candidate_valid: false and
diff.available: false. The command exits successfully when it can return
that result; command-line usage errors return a nonzero status. Preview
accepts DIPfile, .dip, and .dipl inputs, while description and listing
also accept DIPH5 snapshots.
Environment persistence
Use --save to write the full evaluated environment to a DIPH5 file.
--save writes a source-complete DIPH5 v3 archive that can be used with
snt dip experiment. See Environment Persistence for managed runs
and external-host reporting.
Use --load instead of --input to query saved parameters without
reevaluating their DIPL sources:
snt dip parse --input string "simulation.steps int = 100" --save parameters.diph5
snt dip parse --load parameters.diph5 --print
snt dip parse --load parameters.diph5 --request simulation.steps --value --type integer
snt dip parse --project DIPfile --record-graph --save project.diph5
--load cannot be combined with any --input. --save overwrites an
existing file and does not require --print or --value. It saves the
entire environment even when --request or --tags restricts printed
output. After a successful save, the CLI reports the absolute DIPH5 path on
stderr, leaving printed values on stdout. If output validation fails, the
destination is not written.
--record-graph records evaluation dependencies while parsing DIPL input;
the graph is stored by --save. It cannot be used with --load.
SNT3 0.10 and later read and write only DIPH5 v3. The older v2.11 specification
is preserved as an appendix to the current specification for migration with a
pre-0.10.0 release.
To inspect many values without evaluating the original DIPL project for each query, save one evaluated snapshot and list from it:
snt dip parse --project DIPfile --save evaluated.diph5
snt dip list --input evaluated.diph5 --query '?' --format json
The snapshot contains evaluated state, not a reevaluable copy of the DIPL program. Recreate it after changing project inputs or overrides; the CLI does not automatically check snapshot freshness.
File errors are reported on standard error with a nonzero exit status. See DIP environment persistence for the format and its limitations.
Generating static parameters
Use --generate <format> <file> to export the complete evaluated
environment as language-native source or a data file. It works after parsing
DIPL input or loading a DIPH5 environment:
snt dip parse --input file parameters.dip --generate cpp parameters.hpp
snt dip parse --load parameters.diph5 --generate julia parameters.jl
snt dip parse --input file parameters.dip --generate json parameters.json
Supported format names are cpp, c, fortran, rust, julia,
json, and yaml. --generate can accompany --save. Requests and
tags only affect text printed by the command, not the generated environment.
See Static parameter generation for the
native representations and format-specific behavior.
Generating reports
snt report writes a report of evaluated values and units, descriptions,
parameter paths, source identities, custom unit definitions, schema information,
override status, and available publication metadata. Function names are listed
when registered; executable function bodies are not included. Built-in PUQ unit
catalogues are not duplicated in the report. Output paths are sorted for repeatable reports. The
default format is tex; it requires no external tools:
snt report --project DIPfile --output report.tex
snt report --load run.diph5 --output report.tex
snt report --input file parameters.dip --output report.tex
Brief++ also renders the same report as Markdown (md), reStructuredText
(rst), HTML (html), Typst (typ), plain text (txt), or a
briefpp/1 document tree (json):
snt report --project DIPfile --format html --output report.html
snt report --project DIPfile --format md --output report.md
snt report --load run.diph5 --format json --output report.json
These formats need no external tools. Markdown tables use Brief++’s
MyST-style directives. Report JSON describes the document; use
snt dip parse --generate json for static parameter export JSON.
The command accepts the same --input kinds as snt dip parse. A project
may be combined with override_string or override_file inputs. A DIPH5
--load cannot be combined with other inputs. For loaded snapshots, the
report contains only provenance retained in DIPH5.
Reports from DIPL inputs record evaluation dependencies automatically. The
Parameter guide links effective values to full reference entries, and the
Schemas section lists the parameters each schema supplied. A loaded DIPH5
report includes calculation relationships only if its snapshot contains a
recorded graph; otherwise the report states that they are unavailable.
Empty groups and collections without value descendants are not present in a
DIPH5 snapshot and therefore cannot appear in a report generated from it.
Use --intro introduction.tex to insert trusted LaTeX after the report
contents page. The file is read as a fragment, without a document preamble. Its text
is included in both TeX and PDF reports. Other formats reject --intro.
--format pdf compiles the same generated TeX with pdflatex. Select a
compatible executable with --tex-compiler when needed:
snt report --project DIPfile --format pdf --output report.pdf
snt report --load run.diph5 --format pdf --output report.pdf \
--tex-compiler /path/to/pdflatex
PDF output requires a locally installed TeX compiler. If it is unavailable or
compilation fails, the command reports an error and does not create the output
PDF. The TeX compiler is never installed by snt report.
For reports containing Unicode characters unsupported by pdflatex, use
--tex-compiler lualatex when that compiler is installed.
Use --title, --author, --date, and --report-version for the
cover. To regenerate the bundled CreateReport example PDF from the repository root:
build/bin/snt report --project examples/dip/CreateReport/DIPfile \
--intro examples/dip/CreateReport/introduction.tex \
--title "Mock Heat Flow Study" --author "Example Research Team" \
--date "2026-09-28" --report-version "1.0 demo" \
--cheatsheet-pdf docs/dipl/cheatsheet/dipl-cheatsheet.pdf \
--format pdf --output examples/dip/CreateReport/report.pdf
The default cover title is DIP parameter report; an empty author appears
as Not specified. The date defaults to the local generation date and the
version to the SNT build version. Set date and version explicitly for a
reproducible cover. The CreateReport example shows the layout and provides a PDF to inspect.
SNT Hub
For project discovery, pinned workspaces, example setup, and optional build and run recipes, see the SNT Hub guide.
Server, dmap, and viewer commands
The main executable also hosts the REST server and dimension-map generator:
snt server --help
snt server --port 8081
snt server --project model=/srv/model/DIPfile
snt dmap --help
Build server support with ENABLE_SNT_SERVER=ON and dimension-map
generation with ENABLE_SNT_DMAP=ON. Server support requires cpp-httplib;
builds without it can set ENABLE_SNT_SERVER=OFF. See REST API server for routes
and options.
snt dmap is a developer tool for precomputing PUQ unit dimensions. Run it
from the source repository root only when updating unit definitions: it
overwrites src/snt/puq/systems/dmaps/dmap_*.h. Review the generated diff
before committing. Its -e option replaces those headers with empty
placeholders.
The optional snt view <artifact> command opens the graphical
Parameter Viewer. Its guide covers building the viewer,
browsing live projects and DIPH5 snapshots, opening source locations, and
reloading after an edit.
All three features belong to the snt target and require ENABLE_EXEC_APPS_SNT.