This task implements Phase 2 of OCBS native backup integration (see NATIVE_INTEGRATION.md). Phase 1 (skill wrapping) is complete and committed to master (e7fd874).
Add native backup as a storage source option in OCBS core engine. When users run ocbs backup --source native, OCBS will:
- Run
openclaw backup createto generate a tar.gz archive - Extract the archive to a temporary directory
- Walk the extracted files and chunk them (SHA-256 deduplication)
- Store chunks in pack files (reusing existing storage)
- Create BackupManifest and store in SQLite index
This preserves all OCBS features (incremental, checkpoints, auto-cleanup) while leveraging native's reliable tar.gz generation.
/tmp/ocbs-phase2/ # Git worktree for feature/phase2-native-backend branch
See P2_TASKS.md for full checklist. Key components:
- BackupSource Enum - Add DIRECT/NATIVE enum to core.py
- Native Backup Runner -
_run_native_backup()method to run openclaw backup create - Archive Chunker -
_chunk_archive()method to extract and chunk archives - CLI Flag - Add
--sourceflag to backup command - Config Support -
defaultSourceandnativeBackupDirconfig options - Skill Updates - Pass
--sourceparameter through to core - Tests - Integration tests for native path
- Documentation - Update SKILL.md, README.md
- Reuse existing chunk storage (
_store_chunk(),_write_pack_file()) - Use batch processing for large archives (13K+ files) to avoid file descriptor limits
- Handle subprocess errors and timeouts (10 minutes for backup)
- Add dry-run support for testing without creating backups
- Fallback to DIRECT source if native CLI unavailable
- Native backup generates valid tar.gz
- Archive extraction works
- Chunking produces deduplicated chunks
- BackupManifest records paths correctly
- CLI
--source nativeworks - Skill
backup --source nativeworks - Config
defaultSource=nativeworks - Large workspace backups (13K+ files) succeed
- Updated core.py with native backend
- Updated cli.py with --source flag
- Updated skill.py with source parameter
- Integration tests passing
- Documentation updated
- Ready for PR to master
- Base branch: master (commit e7fd874)
- Feature branch: feature/phase2-native-backend
- Worktree: /tmp/ocbs-phase2
- Integration plan:
/tmp/ocbs-phase2/NATIVE_INTEGRATION.md - Task checklist:
/tmp/ocbs-phase2/P2_TASKS.md - GitHub Issue: #6