10.1 The output-directory lifecycle
Before a command writes scientific results, nlmx prepares its output directory. The default safety posture is conservative: a missing directory can be created, but a non-empty existing directory is rejected unless overwrite was explicitly enabled. This prevents an apparently successful rerun from mixing old and new artifacts.
What counts as non-empty
During the emptiness check, names beginning with log_ are ignored. Other files or subdirectories make the destination non-empty. This exception permits logging infrastructure to create a log beside a run without forcing overwrite, but it should not be read as permission to reuse arbitrary run folders.
--overwrite allows writes into the existing directory; it does not promise to erase stale files first. If a previous run emitted old_plot.png and the new run does not produce that name, the old file may remain. The safest operational pattern is one new output directory per run, followed by deliberate promotion or archiving.
Source and destination separation
When a model directory is known, nlmx canonicalizes it and the proposed output directory and refuses them when they resolve to the same location. This protects control streams, datasets and related input artifacts from being surrounded or replaced by generated output. Use a sibling such as results/run-2026-11-03/, not the model directory itself.
Canonicalization matters on Windows because relative paths, .. segments and alternate spellings can identify the same physical location. A merely different string is not necessarily a different directory.
The write transaction
The shared OutputSet creates parent directories as needed and records every successful path written through its text, byte or JSON methods. At the end, finish() hashes those recorded files and writes checksums.sha256. A command that fails before finish() can leave a partial output directory without a checksum manifest. Treat the presence of some plausible files as insufficient evidence of successful completion.
| Directory state | Default behavior | Review implication |
|---|---|---|
| Does not exist | Create it | Normal fresh run |
Exists; only log_* entries |
Proceed | Confirm logs belong to the intended run |
| Exists; any other entry | Refuse | Choose a fresh directory or consciously overwrite |
| Same as model directory | Refuse | Preserve source/output separation |
| Command failed mid-write | Partial files possible | Do not release; inspect log and rerun cleanly |
Operational naming
A useful run directory name contains a stable analysis stem and a unique revision or timestamp, for example results/base-focei-r03/. Avoid names such as final2-new/; they do not encode the reason for the revision. The directory name supplements, but never replaces, the command, effective settings and hashes inside the bundle.
Common mistakes
- Assuming
--overwritecleans the directory before writing. - Interpreting a populated directory as proof that the command reached its final step.
- Writing outputs beside source control streams and then archiving the mixture.
- Reusing a folder because only the scientific CSV files “look current.”
Checklist
- Start important analyses in a fresh, uniquely named directory.
- Confirm source and destination are physically different locations.
- Require a success status and a complete checksum manifest.
- Investigate unexpected files instead of silently excluding them.
Further reading
See output-folder conventions, portable project layouts and manifests and checksums.