CLI Reference¶
The morie command is the primary terminal interface. It is installed as a
console script entry point from morie.runner:main. morie --help lists
every subcommand; morie <subcommand> --help lists its options. The
subcommands below are grouped by what they do. The R package ships the same
verbs as rmorie (see The R command line: rmorie), so everything on this page has
an R twin.
Analysis pipeline¶
list-modulesPrint the 23 registered analysis modules with their output files.
run-module <name>/run-modules --modules <a> <b>/pipelineRun one, several, or all modules. Options shared by the three:
--dataset KEYA catalog dataset key (
morie list-datasets), for exampleocp21for the real CPADS PUMF. Overrides--cpads-csv.--cpads-csv PATHPath to a CPADS PUMF CSV. Without either option the modules use the real PUMF when it is on disk or already pulled into the cache (
morie pull ocp21once), and otherwise the bundled 1,200-row synthetic frame, with a warning that says so and names the command that gets the real one.--output-dir DIRDirectory for the CSV outputs.
--all(pipelineonly)Run the whole module surface.
-y/--yes(pipelineonly)Skip the confirmation prompt.
--no-carbon(pipelineonly)Disable emissions tracking. By default a pipeline run writes
emissions/emissions.csvunder the output directory plus a provenance capsule for the run (Measure the compute cost, and prove it) and prints the kg CO2eq at the end.
morie run-module power-design --output-dir /tmp/morie-outputs morie pipeline --all -y --dataset ocp21
Note
The full 23/23 run needs the R package installed plus the
surveyR package (required by the eBAC modules; it is in Suggests, so a source install does not pull it in):install.packages("survey").smotefamilyis optional; without it the SMOTE outputs are status-only.inspect PATH/verify PATH/explain FILENAMEBrowse output CSVs (schema, rows, summary statistics), validate them for correctness (exit status 1 when a check fails), or describe what a module-output CSV contains and how to read it.
--modulescopesinspectandverifyto one module’s expected outputs.generate-templateWrite a methods-and-results scaffold for a first paper (
--module, defaultpower-design;--out, defaultfirst-paper.md).
Datasets¶
See Get the real data for the walk-through.
list-datasetsList the 71 catalogued dataset keys with type, cached row count and the route each one is obtained by: a portal it downloads from on first use (open.canada.ca, data.ontario.ca, Statistics Canada, CIHI, health-infobase.canada.ca, ECCC NAPS whose Canada-wide hourly keys take about ten minutes, Toronto Police ArcGIS),
rmoriedataon CRAN, data.rmorie.com (the Health Infobase fallback copy and the OTIS research environments; the curated tables join the list once a key from rmorie.com/access is stored withmorie login --token), or “own file: data/…” for the one key that is your own research file (the MAPQ workbook), placed under$MORIE_DATA_DIRkeeping that relative path.pull KEY [--out FILE.csv]/pull --all [--out DIR]Download one dataset by catalog key (
ocp21,cu23bt, …) or by shortcut (tps-major,tps-shootings,tps-homicide,tps-layers,cpads,siu-index, and the-toybundled frames) and write it as CSV (--out, else stdout);--allpulls every catalog key into a directory and reports the ones that fail. Downloads are cached in the dataset store, so the modules use the real data from then on. CKAN downloads fall back to the resource file and then to its Internet Archive (Wayback Machine) snapshot when the live portal is down.--yearand--maxapply to the TPS feeds.download-bootstrapFetch the large bootstrap-weight files from the Statistics Canada CKAN API (
--survey csads_2021|csads_2023|csus_2019|csus_2023|all,--limit).ingest {ckan,tps,siu,a2aj}Pull open-data feeds: CKAN portals, Toronto Police Service ArcGIS layers, SIU director’s-report PDFs, and A2AJ Canadian Legal Data (
a2aj coverage,a2aj search QUERY,a2aj fetch CITATION).profile-dataset PATH(or--csv PATH)Infer measurement levels and variable roles for any tabular file (CSV, TSV, Excel, Parquet).
--treatment,--outcomeand--weightsare hints;--suggestprints an analysis plan.sample PATH --n N --method {srs,stratified,cluster,pps}Draw a sample (
--strata-col,--cluster-col,--size-col,--proportional,--seed,--output).
Assistant and LLM¶
Every assistant verb answers through the model you brought (Language models and the data key): your own
OpenAI-compatible server, then each provider whose key is set (ANTHROPIC_API_KEY,
OPENAI_API_KEY, …), then an Ollama server with a model, then a local keyword fallback
that says it is one. Nothing is hosted for you.
ask QUESTION/agent QUESTION/percy QUESTION(aliasperseus)Ask the MORIE assistant (streams by default;
--no-stream,--context,--model NAME).percyandagentstart the local tool-calling agent when Ollama is present and otherwise answer through the chain instead of printing a connection error.login [--no-browser] [--email ADDRESS [--to-email]] [--token [KEY]]Store or mint the data key for the curated tables at data.rmorie.com (Language models and the data key; no model uses it). With no options: the GitHub device flow (
--no-browserprints the URL instead of opening it).--emailasks for a one-time code sent to that address;--to-emailadditionally has the key itself emailed to you instead of stored on this machine.--tokenstores a key you already have (prompts for it whenKEYis omitted) and checks it with the data service before it is kept. A key the service rejects (401) is reported as “runmorie loginagain”, not as the service being unreachable.models [--route ROUTE]List the models the route
asktakes offers (or another route’s), the one in use marked*. Pick one per call withmorie ask --model NAMEor save it withmorie config set PROVIDER.model NAME.provider set --base-url URL --key KEY [--model NAME]/provider show/provider unsetAttach your own OpenAI-compatible endpoint: OpenAI, Anthropic’s compatibility endpoint (
https://api.anthropic.com/v1), OpenRouter, Mistral, Groq, a local LM Studio / vLLM / llama.cpp server, anything that serves/chat/completions. The setting lives in the credentials file both languages read;LLM_API_BASE_URL,LLM_API_KEYandMORIE_API_MODELin the environment take precedence.logoutForget the stored data key.
chatInteractive chat REPL with slash commands (
--agentloads a persona).serveStart a Perseus relay server (
--port, default 8421;--bind, default 127.0.0.1;--token).percysuitsPull all Perseus LLM models into Ollama (
--host,--dry-run,--ssh user@host).
Compute emissions and provenance¶
emissions [--seconds N] [--output-dir DIR] [--country ISO3] [--no-capsule]Load the CPU for
Nseconds (default 3) under the tracker and print the energy, the kg CO2eq, the grid intensity used and where the capsule went. The same tracker runs underpipeline. Method, columns and the capsule files: Measure the compute cost, and prove it and Compute emissions.
Editors and REPLs¶
tuiFull-screen terminal IDE (needs the
interactiveextra).edit FILEBuilt-in scientific editor (
--runexecutes on save,--lang).replHeadless polyglot REPL with cross-language variable bridging (
--lang,--no-polyglot,--no-detect).execExecute code inline, from stdin, or from
--file;--lang python|r.interactive install|status|removeAdd the REPL/exec/agent/TUI modules that the published package leaves out, verified against the bundled manifest, for the current user.
tutorial/cheatsheetInteractive first-time walkthrough; one-page command reference.
Environment¶
doctorDiagnostics for the language-model routes (your own endpoint, provider keys, Ollama, the route
asktakes), the data key, datasets, R and Docker;--fixtries to remediate.selftestQuick smoke test of every subsystem (also the Docker health check).
updateCheck PyPI for a newer release and optionally install it (
-y).bricklayerOffer to install the rest of the morie family (the R packages) and verify the shared C/C++ backend (
--checkreports only).r-installInstall the R side:
rmoriefrom r-universe (prebuilt, pullsrmoriedataandrmoriebricklayer), or with--githubthis repository’s own R arm,r-package/morie, built from source with remotes. Same options asbricklayer.
Data capsules¶
capsule init CSV --url URLPin a CSV: write
data_provenance.jsonbeside it (name, source URL and retrieval date, the file’s SHA-256, size and data rows;--script FILEpins an analysis script too).capsule pin DIRRe-pin a capsule’s provenance to its files as they are now.
capsule verify DIRThe checks of
rmoriebricklayer::vrfcps(), and ofcpsbndlvrf()oncapsule_bundle.jsonwhen present (--key-env VARor--key-file FILEsupplies the HMAC key;--public-key HEXpins the key: an hmac key id, or the ML-DSA or XMSS public keycapsule keygenprinted). An ML-DSA or XMSS signature is verified under the public key the bundle carries, so it needs no key.capsule keygen --scheme SCHEME --out FILEA new
ML-DSA-44,ML-DSA-65,ML-DSA-87(FIPS 204) orxmss-sha256(RFC 8391;--height H, 1-16, signs2^Hbundles, default 10) signing key, written as JSON readable by its owner only (the fields offipskg()/pqckg(); never overwritten). Prints the public key;--public-out FILEalso writes it as JSON.capsule sign DIR [--scheme SCHEME]Write
capsule_bundle.json: every file’s SHA-256, the digest ofmanifest.json, and an attestation over them, ascpsbndl()writes it.--scheme hmac(the default) signs with the shared secret in$MORIE_CAPSULE_KEY(or--key-env/--key-file; never on the command line); rmoriebricklayer >= 1.0.0 (srr) verifies it with the shared key (cpsbndlvrf(key = ...)).--scheme ML-DSA-44|65|87and--scheme xmss-sha256sign with a key fromcapsule keygen(or an R key written withtojs()), from the same places;--contextand--prehashapply to ML-DSA.cpsbndlvrf()verifies these bundles with no key, and rmoriebricklayer’s bundles of these schemes verify here. An XMSS key must be a--key-file: itsnext_indexis written back after each signature, and the used-index record morie shares with rmoriebricklayer (RMBL_XMSS_INDEX_FILE, elsexmss_used_indices.txtintools::R_user_dir("rmoriebricklayer", "config")) refuses an index already used.capsule drift REF CURCompare a capsule’s pinned CSV (or any CSV) with a current one, column by column: Kolmogorov-Smirnov or chi-square, population stability index, Jensen-Shannon divergence, added and removed columns, and Benford’s law on the numeric columns.
Every capsule command takes --json; the exit status is 0 when
everything verified (no drift), 1 when a check failed or drift was found,
and 2 on a usage or input error, as in rmbl-action.
Verification pipelines¶
verify-pollution --pollutant {no2,pm25}Run the pollution-to-health pipeline of Pollution to health (concentration-response, attributable fraction, deaths displaced, burden, equity index) and print a report with an assumption log; exit status 1 when an assumption fails, 2 on a data error. Exposure comes from
--demo(synthetic),--exposure-csv FILE(anexposurecolumn, optionalincome), or--exposure-mean X --exposure-prevalence P;--outcome,--reference,--baseline-rate(per 100,000 per year),--population,--region,--years,--json.verify-earth-engineSmoke-check Earth Engine credentials, initialisation and a one-pixel query (
--skip-query,--json). Python only: the Earth Engine client has no R counterpart, andrmorie verify-earth-enginesays so.
Models and cryptography¶
convert-checkpoint --checkpoint PT --output GGUFConvert a
.pttraining checkpoint to GGUF, optionally TurboQuant-compressed (--turbo-bits 2|3|4,--tokenizer-dir).crypto {keygen,encrypt,decrypt}Post-quantum file encryption (ML-KEM-768 + ChaCha20-Poly1305):
keygen [--name NAME] [--output DIR](keystore at~/.morie/keys/keystore.jsonunless--output),encrypt FILE --to PKFILE|NAME,decrypt FILE --key NAME.
Repo-root wrapper¶
A shell wrapper ./morie at the repository root invokes
.venv/bin/python -m morie.runner so the venv does not need to be activated
manually:
./morie list-modules
./morie pipeline --all -y