Summary
Exclude node_modules directories inside extensions/ when creating backup archives to reduce backup size significantly.
Problem to solve
openclaw backup create archives the entire state directory including ~/.openclaw/extensions/*/node_modules/. These dependency trees are large (often hundreds of MB) and can be trivially reinstalled via npm install --omit=dev. Including them inflates backup archives unnecessarily and makes backup/restore slower.
Additionally, native modules in node_modules may not be compatible across platforms, so restoring them as-is can still require reinstallation.
Proposed solution
Add a filter callback to the tar.c() call in src/infra/backup-create.ts that skips node_modules directories within the extensions/ subtree of the state directory. This preserves plugin source code, manifests, and configuration while excluding reinstallable dependencies.
After restoring, users would run npm install --omit=dev in each extension directory to restore dependencies -- the same flow as initial plugin installation.
Alternatives considered
- Skip entire extensions/ directory -- too aggressive; config references plugins and restore would fail without them.
- Add --exclude-extensions CLI flag -- more flexible but adds complexity; the default behavior should be smart enough.
- Wrapper script -- fragile workaround that does not help other users.
Impact
- Affected: all users running openclaw backup create with installed plugins
- Severity: medium (bloated backups, slow transfers)
- Frequency: every backup
- Consequence: unnecessarily large archive files; wasted disk/bandwidth on every backup cycle
Summary
Exclude node_modules directories inside extensions/ when creating backup archives to reduce backup size significantly.
Problem to solve
openclaw backup create archives the entire state directory including ~/.openclaw/extensions/*/node_modules/. These dependency trees are large (often hundreds of MB) and can be trivially reinstalled via npm install --omit=dev. Including them inflates backup archives unnecessarily and makes backup/restore slower.
Additionally, native modules in node_modules may not be compatible across platforms, so restoring them as-is can still require reinstallation.
Proposed solution
Add a filter callback to the tar.c() call in src/infra/backup-create.ts that skips node_modules directories within the extensions/ subtree of the state directory. This preserves plugin source code, manifests, and configuration while excluding reinstallable dependencies.
After restoring, users would run npm install --omit=dev in each extension directory to restore dependencies -- the same flow as initial plugin installation.
Alternatives considered
Impact