zyme CLI reference

The zyme command drives the optimization loop behind Building a patch. Install it via Environment setup, then run zyme --help to see the live command map.

Commands are grouped by lifecycle role. High-traffic commands include EXAMPLES sections — run zyme <cmd> --help for the full set.

Core loop — edit / measure / decide

CommandPurpose
zyme initScaffold a new task in cwd
zyme runCommit pipeline edit, measure, append pending row to results.tsv
zyme dryrunRun pipeline + evaluate without committing or logging
zyme acceptPromote latest pending row to keep; advance best
zyme rejectMark latest pending row as discard; auto-restore pipeline
zyme rollbackDemote the most recent accepted round; re-point best to the prior keep

Measurement — references and verification

CommandPurpose
zyme baseline recordManually enter a baseline measurement
zyme baseline reference --tier <T>Run reference.py/.R once per tier, populate reference_output_<T>/
zyme baseline noiseCalibrate intrinsic-noise estimates (stochastic algorithms)
zyme baseline promotePromote a rerun row as the new baseline
zyme baseline rebench --threads 1,4,8Re-time baseline at multiple thread counts
zyme baseline listList recorded baselines
zyme baseline showShow a specific baseline row
zyme profileProfile one pipeline run; writes hotspot evidence under profile_history/
zyme verifyFull (tier × threading) cube; writes verify.tsv with PASS/SOFT/HARD verdicts
zyme attestPackaging ship gate: full tier sweep (default --reps 2); commits package_verify.tsv

Analysis — read-only dashboards

CommandPurpose
zyme statusRound count, best speedup, current pipeline state
zyme plotRender speed-vs-round plot from results.tsv
zyme scanWorkspace-wide dashboard across multiple tasks
zyme registrySearchable registry of optimized functions + hot dependency engines (rebuild / query / suggest / list)
zyme auditReplay the audit log for the current task

Workflow — multi-task / templates

CommandPurpose
zyme dispatch runRun multiple tasks in parallel under a single dispatcher
zyme dispatch statusStatus of all dispatched tasks
zyme dispatch logsStream logs from dispatched tasks
zyme dispatch stopStop a running dispatcher
zyme bench register-templateRegister a benchmark template
zyme bench list-templatesList available templates
zyme bench initInstantiate a template into a new task
zyme bench listList benchmark suites
zyme prompt saveSave the current task’s prompt set into the registry
zyme prompt listList registered prompts
zyme prompt showPrint a registered prompt
zyme prompt diffDiff between two prompt versions
zyme prompt useActivate a prompt version for the current task
zyme prompt annotateAnnotate a prompt with a note

Utility — one-shot tools

CommandPurpose
zyme inspect-parallelismProbe upstream’s parallelism knobs (numba / openmp / Ray)
zyme datasetsManage the workspace /datasets/ layer (shared + per-task)
zyme publish-speedupsManually publish a task’s speedups.tsv to the shipped package

High-traffic commands in detail

zyme init

zyme init <target_repo> [<target_function>] [--dataset <path>] [--field Bio|OtherField]
         [--no-clone] [--no-bench-snapshot] [--language python|R]

Scaffold a task in cwd. See Initialization for the full walkthrough.

Example

mkdir test_findallmarkers && cd test_findallmarkers
zyme init https://github.com/satijalab/seurat FindAllMarkers

zyme run

zyme run "<hypothesis>"
        [--task-dir <path>]              # defaults to cwd
        [--dataset <tier_or_name>]       # which dataset/tier to measure on
        [--extra-tiers <t1,t2,...>]      # also measure these (no separate decision)
        [--rerun --n <N>]                # re-time current HEAD without a new decision
        [--setup]                        # allow task-definition file changes (Initialization only)

Example

$EDITOR pipeline/run.py
zyme run "vectorize the inner cosine loop"          # decision round
zyme run --rerun --n 3                              # 3 reps, no decision

zyme accept

zyme accept -m "<note>" [--task-dir <path>]

Promote the latest pending row to keep. Advances best state. Updates memory/best_state.md.

zyme reject

zyme reject -m "<note>" [--task-dir <path>]

Mark latest pending row as discard. Automatically restores pipeline/run.py/.R to last accepted state.

zyme dryrun

zyme dryrun [--task-dir <path>] [--dataset <tier>]

Run pipeline + evaluate, print metrics, don’t commit, don’t log.

zyme profile

zyme profile [<label>]
             [--dataset <tier_or_name>]
             [--backend full|cpu|mem|native]
             [--json]
             [--no-archive]
             [--diff <A> --diff-against <B>]

Run the task pipeline once under a profiler. This is diagnostic only: it does not write results.tsv, does not commit, and does not run evaluate.py/.R.

Use it after initialization to find the first real bottleneck, and re-run it when several accepted rounds stop moving the dominant cost.

Common runs

zyme profile --dataset tiny                    # default backend=full
zyme profile "baseline tiny" --backend cpu     # cheap call counts
zyme profile --backend mem --dataset medium    # allocation pressure
zyme profile --json | jq .actionable_hotspots  # machine-readable

Backends

BackendPythonRUse when
fullScalene, fallback to cProfileprofvis/Rprof, fallback to RprofDefault. Good first profile: CPU, memory, native split where available
cpucProfileRprofCheap function-level timing and call counts
memmemrayRprof with memory profilingYou need allocation pressure, not just wall time
nativemacOS sample(1)macOS sample(1)You need to see inside BLAS, Rcpp, Cython, or forked workers

Outputs

profile_history/<run-id>/profile.json
profile_history/<run-id>/run.log
profile_history/<run-id>/<raw-profiler-artifact>
profile_history/latest/profile.json

Read profile_history/latest/profile.json first. The most useful fields are layer_breakdown, per_layer_top, actionable_hotspots, and override_summary.

Compare two profiles

zyme profile --diff history:baseline \
             --diff-against current

current means the latest profile. history:<text> picks the most recent profile_history/ run whose directory name contains that text.

zyme rollback

zyme rollback [-m <reason>] [--dry-run]

Demote the most recent accepted (keep) commit and re-point best.ref to the prior keep — flips its results.tsv row to status=rollback without rewriting git history. Use when a previously-accepted round is later revealed to regress. --dry-run reports what would change without applying.

zyme verify

zyme verify [--reps N] [--threads 1,4,8] [--tiers tiny,medium,large,ood_large]

Validation validation cube. Each cell = (tier × threads) → PASS / SOFT (within scaling-tax tolerance) / HARD (regression). Renders an ASCII matrix. Persists rows to verify.tsv.

zyme attest

zyme attest [--reps N] [--tiers tiny,medium,large,ood_large,ood_xlarge]

Packaging ship gate — the command you run to verify a patch before shipping. Runs the full tier sweep (baseline + patched timing + metric gate) at the declared reps and writes package_verify.tsv, which you commit alongside the patch.

zyme status

zyme status [--task-dir <path>] [--last <N>] [--phase optimize|validate|memory|all]
decision rounds: 47/50   pending: 0   keep: 12   discard: 35
best speedup: 4.8x (tiny), 3.2x (medium)
pipeline: pipeline/run.py at commit ab12cd
last 5 decisions:
   47  keep    vectorize inner loop                                   +0.4x
   46  discard try simd intrinsics — broke on small tiers
   ...

zyme scan

zyme scan [<workspace_root>]

Workspace dashboard — every task in the tree with round count, best speedup, status. Useful for managing many in-flight optimization tasks.


Common flags

--version is the only true top-level flag. The flags below are defined on the subcommands that accept them, not globally:

FlagEffect
--task-dir <path>Run a task-scoped command from outside the task dir (CI; supervisor agents). Workspace-level commands (init, scan, dispatch, …) do not accept it
--jsonEmit machine-readable JSON on the read-only commands that support it (e.g. profile, scan, audit, cost)

Exit codes

CodeMeaning
0Success
1User error — bad args, missing file, wrong state (fix and retry)
2Validation / phase-discipline / operation failure — e.g. a gate failure, missing task.yaml, a failed dataset migration, or zyme run blocked by task-definition changes outside --setup
3Resource error — out of memory, disk full, watchdog timeout

Environment variables

VarEffect
ZYME_TIEROverride the tier evaluate.py/.R sees (used internally; rarely set by hand)
ZYME_REFERENCE_DIR / ZYME_TEST_DIR / ZYME_DATA_PATH / ZYME_TASK_DIRSet by the runner before invoking evaluate.py/.R / pipeline/run.py/.R
ZYME_THREADSThread count, read by run_task.sh; highest precedence in the auto_threads picker (chain: ZYME_THREADS > AUTOZYME_THREADS > OMP_NUM_THREADS > AUTOZYMER_THREADS)
AUTOZYME_DISABLEDSet to 1 to suppress activation entirely (session-wide opt-out)
AUTOZYME_THREADSThread count for the auto_threads picker (user-facing; honored below ZYME_THREADS)
AUTOZYMER_THREADSLegacy spelling of AUTOZYME_THREADS; still honored by the picker as a last-resort fallback
NUMBA_NUM_THREADSRead by numba at module import; set BEFORE import autozyme to take effect