---
summary: "CLI reference for `nodmix backup` (create local backup archives)"
read_when:
  - You want a first-class backup archive for local Nodmix state
  - You want to preview which paths would be included before reset or uninstall
title: "Backup"
---

# `nodmix backup`

Create a local backup archive for Nodmix state, config, auth profiles, channel/provider credentials, sessions, and optionally workspaces.

```bash
nodmix backup create
nodmix backup create --output ~/Backups
nodmix backup create --dry-run --json
nodmix backup create --verify
nodmix backup create --no-include-workspace
nodmix backup create --only-config
nodmix backup verify ./2026-03-09T08-00-00.000+08-00-nodmix-backup.tar.gz
```

## Notes

- The archive includes a `manifest.json` file with the resolved source paths and archive layout.
- Default output is a timestamped `.tar.gz` archive in the current working directory.
- Timestamped backup filenames use your machine's local timezone and include the UTC offset.
- If the current working directory is inside a backed-up source tree, Nodmix falls back to your home directory for the default archive location.
- Existing archive files are never overwritten.
- Output paths inside the source state/workspace trees are rejected to avoid self-inclusion.
- `nodmix backup verify <archive>` validates that the archive contains exactly one root manifest, rejects traversal-style archive paths, and checks that every manifest-declared payload exists in the tarball.
- `nodmix backup create --verify` runs that validation immediately after writing the archive.
- `nodmix backup create --only-config` backs up just the active JSON config file.

## What gets backed up

`nodmix backup create` plans backup sources from your local Nodmix install:

- The state directory returned by Nodmix's local state resolver, usually `~/.nodmix`
- The active config file path
- The resolved `credentials/` directory when it exists outside the state directory
- Workspace directories discovered from the current config, unless you pass `--no-include-workspace`

Model auth profiles are already part of the state directory under
`agents/<agentId>/agent/auth-profiles.json`, so they are normally covered by the
state backup entry.

If you use `--only-config`, Nodmix skips state, credentials-directory, and workspace discovery and archives only the active config file path.

Nodmix canonicalizes paths before building the archive. If config, the
credentials directory, or a workspace already live inside the state directory,
they are not duplicated as separate top-level backup sources. Missing paths are
skipped.

The archive payload stores file contents from those source trees, and the embedded `manifest.json` records the resolved absolute source paths plus the archive layout used for each asset.

During archive creation, Nodmix skips known live-mutation files that do not have restoration value, including active agent session transcripts, cron run logs, rolling logs, delivery queues, socket/pid/temp files under the state directory, and related durable-queue temp files. The JSON result includes `skippedVolatileCount` so automation can see how many files were intentionally omitted.

Installed plugin source and manifest files under the state directory's
`extensions/` tree are included, but their nested `node_modules/` dependency
trees are skipped. Those dependencies are rebuildable install artifacts; after
restoring an archive, use `nodmix plugins update <id>` or reinstall the plugin
with `nodmix plugins install <spec> --force` when a restored plugin reports
missing dependencies.

## Invalid config behavior

`nodmix backup` intentionally bypasses the normal config preflight so it can still help during recovery. Because workspace discovery depends on a valid config, `nodmix backup create` now fails fast when the config file exists but is invalid and workspace backup is still enabled.

If you still want a partial backup in that situation, rerun:

```bash
nodmix backup create --no-include-workspace
```

That keeps state, config, and the external credentials directory in scope while
skipping workspace discovery entirely.

If you only need a copy of the config file itself, `--only-config` also works when the config is malformed because it does not rely on parsing the config for workspace discovery.

## Size and performance

Nodmix does not enforce a built-in maximum backup size or per-file size limit.

Practical limits come from the local machine and destination filesystem:

- Available space for the temporary archive write plus the final archive
- Time to walk large workspace trees and compress them into a `.tar.gz`
- Time to rescan the archive if you use `nodmix backup create --verify` or run `nodmix backup verify`
- Filesystem behavior at the destination path. Nodmix prefers a no-overwrite hard-link publish step and falls back to exclusive copy when hard links are unsupported

Large workspaces are usually the main driver of archive size. If you want a smaller or faster backup, use `--no-include-workspace`.

For the smallest archive, use `--only-config`.

## Related

- [CLI reference](/cli)
