You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define a narrow core `openclaw snapshot` command that gives file-syncing hosts a safe file to sync for OpenClaw-owned SQLite state.
16
+
Define a narrow core `openclaw backup sqlite snapshot` command that gives file-syncing hosts a safe file to sync for OpenClaw-owned SQLite state.
17
17
18
18
Hosted OpenClaw environments such as Scout/Lobster persist OpenClaw state by syncing files when they are saved. Live SQLite files are the wrong sync boundary: `state/openclaw.sqlite` or `agents/<agentId>/agent/openclaw-agent.sqlite` can be incomplete without their WAL, and `*.sqlite-wal`, `*.sqlite-shm`, and `*.sqlite-journal` are process-local sidecars rather than durable artifacts.
19
19
20
-
The `snapshot` command provides the missing translation step. It asks SQLite to materialize a clean database artifact, verifies it, writes a manifest, and publishes the completed artifact set into a sync-owned location. That completed artifact write, not arbitrary live database churn, is what the host should sync.
20
+
The SQLite snapshot backup command provides the missing translation step. It asks SQLite to materialize a clean database artifact, verifies it, writes a manifest, and publishes the completed artifact set into a sync-owned location. That completed artifact write, not arbitrary live database churn, is what the host should sync.
21
21
22
22
SQLite remains the hot local runtime database. This RFC does not choose a replacement database, make cloud storage mandatory, or require managed failover. It defines a state-artifact boundary: OpenClaw core owns the SQLite-aware artifact operation, while the host owns upload, retention, routing, encryption, and restore timing.
23
23
@@ -43,17 +43,17 @@ Deltas do not remove this requirement. Ryan's underlying concern is that whole-f
43
43
## Goals
44
44
45
45
- Keep SQLite as the hot local runtime database for this proposal.
46
-
- Make snapshot behavior explicit through a narrow core `openclaw snapshot` command.
46
+
- Make snapshot behavior explicit through a narrow core `openclaw backup sqlite snapshot` command.
47
47
- Produce a host-syncable SQLite artifact and manifest from live OpenClaw SQLite state.
48
48
- Handle WAL state correctly without syncing live SQLite sidecars as durable artifacts.
49
49
- Make restore and verification first-class behaviors, not incidental backup side effects.
50
50
- Define a reusable SQLite snapshot provider contract for OpenClaw-owned SQLite databases.
51
51
- Define the state-artifact boundary that lets hosted platforms persist OpenClaw state without understanding OpenClaw's internal SQLite file layout.
52
52
- Keep the command narrow: create, verify, and restore syncable SQLite artifacts.
53
53
- Document host sync guidance: ignore live SQLite sidecars and sync completed snapshot artifacts/manifests instead.
54
-
- Add commands under `openclaw snapshot`.
54
+
- Add commands under `openclaw backup sqlite snapshot`.
55
55
- Leave `openclaw backup` integration as a possible later follow-up, not part of the initial proof stack.
56
-
- Keep default local OpenClaw runtime behavior unchanged unless the snapshot command is invoked.
56
+
- Keep default local OpenClaw runtime behavior unchanged unless the SQLite snapshot backup command is invoked.
57
57
- Avoid hot writes over network filesystems as a durability or concurrency strategy.
58
58
- Treat WAL bundles as the first high-frequency optimization after full snapshot artifacts are correct.
59
59
- Define lifecycle metadata needed to validate, order, restore, and audit snapshots.
@@ -81,38 +81,29 @@ Deltas do not remove this requirement. Ryan's underlying concern is that whole-f
81
81
82
82
### Command shape
83
83
84
-
Add a core `openclaw snapshot` command that owns SQLite-safe snapshot and restore workflows for OpenClaw state.
84
+
Add a core `openclaw backup sqlite snapshot` command that owns SQLite-safe snapshot and restore workflows for OpenClaw state.
85
85
86
-
The command surface should stay direct:
86
+
The command surface should stay narrow inside the existing backup area:
This does not imply automatic scheduling, cloud storage, failover, or a new database abstraction. The core command produces and verifies the syncable artifact; the host decides where that artifact is stored and when it is restored.
106
105
107
-
Later, if maintainers want one user-facing home for backup and restore workflows, the same provider contract can be wired under the existing backup command surface:
108
-
109
-
```text
110
-
openclaw backup snapshot
111
-
openclaw backup restore
112
-
openclaw backup status
113
-
```
114
-
115
-
That integration is intentionally not part of the initial implementation roadmap. The first proof should stay scoped to the `snapshot` command so it can demonstrate correctness without changing the existing backup command behavior.
106
+
This keeps the feature out of the top-level command namespace while still making the SQLite implication explicit. `openclaw backup create` and `openclaw backup verify` keep their existing archive behavior; `backup sqlite snapshot` is the per-database SQLite artifact path.
116
107
117
108
### Responsibility split
118
109
@@ -129,9 +120,9 @@ OpenClaw should provide:
129
120
- lifecycle metadata shape
130
121
- safety rules such as no hot writes over network filesystems
131
122
132
-
The `snapshot` command should own the operator workflow around the core primitive:
123
+
The `backup sqlite snapshot` command should own the operator workflow around the core primitive:
133
124
134
-
- snapshot command UX
125
+
-SQLite snapshot backup command UX
135
126
- local snapshot artifact creation and publication into a sync-owned artifact directory
The diagram is a responsibility split, not a default managed-hosting requirement. Default local OpenClaw can run with only the runtime box. Operators and hosts use the snapshot command when they need verified snapshot and restore workflows.
219
+
The diagram is a responsibility split, not a default managed-hosting requirement. Default local OpenClaw can run with only the runtime box. Operators and hosts use the SQLite snapshot backup command when they need verified snapshot and restore workflows.
229
220
230
221
For hosted OpenClaw, the same split becomes the host integration contract. The host can ask OpenClaw to materialize a clean artifact before upload and can hydrate local disk from a verified artifact before OpenClaw opens SQLite. The host does not need to treat live SQLite sidecars as durable sync inputs.
231
222
@@ -247,7 +238,7 @@ family. Today, memory-search state is owned by the per-agent database-first
247
238
store, so Phase 1 can protect it through the per-agent database target:
248
239
249
240
```text
250
-
openclaw snapshot create --agent main
241
+
openclaw backup sqlite snapshot create --agent main
251
242
```
252
243
253
244
A future memory-search-only target would need a separate design because it
@@ -327,7 +318,7 @@ Restore artifacts should be consumed before OpenClaw opens the target database f
327
318
328
319
### Restore verification
329
320
330
-
Restore is a required behavior for `openclaw snapshot`, not an incidental backup side effect.
321
+
Restore is a required behavior for `openclaw backup sqlite snapshot`, not an incidental backup side effect.
331
322
332
323
A restore operation must:
333
324
@@ -388,13 +379,13 @@ At minimum, snapshot metadata should include:
388
379
- restore source and restore point when hydrated
389
380
- current writer owner or lease holder, when leases are enabled
390
381
391
-
The exact storage location for this metadata is implementation-defined, but `openclaw snapshot` must be able to read enough metadata to verify and restore a snapshot without opening a possibly unsafe runtime database first.
382
+
The exact storage location for this metadata is implementation-defined, but `openclaw backup sqlite snapshot` must be able to read enough metadata to verify and restore a snapshot without opening a possibly unsafe runtime database first.
392
383
393
384
### Provider shape
394
385
395
386
The implementation can start as a SQLite-specific snapshot provider rather than a database abstraction layer.
396
387
397
-
The provider contract should be reusable by any OpenClaw feature that needs to capture or restore an OpenClaw-owned SQLite database. `openclaw snapshot` is the first proposed CLI surface, but the contract should not depend on command-only state.
388
+
The provider contract should be reusable by any OpenClaw feature that needs to capture or restore an OpenClaw-owned SQLite database. `openclaw backup sqlite snapshot` is the first proposed CLI surface, but the contract should not depend on command-only state.
398
389
399
390
A minimal shape is:
400
391
@@ -420,13 +411,13 @@ type RemoteSnapshotProvider = SqliteSnapshotProvider & {
420
411
421
412
This keeps SQLite runtime access local while making state artifacts portable. A local snapshot provider can be the reference implementation. Cloud/object-store providers can come later without changing the default local runtime.
422
413
423
-
If the design proves broadly useful, the same contract can support backup restore, startup hydration, or state migration workflows without changing the narrow `openclaw snapshot` command.
414
+
If the design proves broadly useful, the same contract can support backup restore, startup hydration, or state migration workflows without changing the narrow `openclaw backup sqlite snapshot` command.
424
415
425
416
### Implementation roadmap
426
417
427
418
The implementation should be split into two phases.
428
419
429
-
Phase 1 is the committed snapshot command work. It proves full verified
420
+
Phase 1 is the committed SQLite snapshot backup command work. It proves full verified
430
421
snapshots, named OpenClaw database targets, and fresh-state restore. It should
431
422
also collect the metrics that decide whether Phase 2 is worth doing:
432
423
@@ -447,7 +438,7 @@ The current Phase 1 implementation stack is:
Add the shared SQLite snapshot provider, local artifact repository, public
476
-
`openclaw snapshot` command surface, named database targets, and safe-sync
467
+
`openclaw backup sqlite snapshot` command surface, named database targets, and safe-sync
477
468
artifact proof.
478
469
479
470
-`SqliteSnapshotProvider` contract
@@ -485,16 +476,16 @@ artifact proof.
485
476
- user-facing core commands:
486
477
487
478
```text
488
-
openclaw snapshot create
489
-
openclaw snapshot verify
490
-
openclaw snapshot restore
479
+
openclaw backup sqlite snapshot create
480
+
openclaw backup sqlite snapshot verify
481
+
openclaw backup sqlite snapshot restore
491
482
```
492
483
-`--target global` for `state/openclaw.sqlite`
493
484
-`--agent <agentId>` for `agents/<agentId>/agent/openclaw-agent.sqlite`
494
485
- manifest fields for database role, agent id, schema version, and source path
495
486
- host-sync guidance that says live SQLite sidecars are ignored and completed
496
487
artifacts are the sync input
497
-
- target-directory safety checks, restore manifest validation, SQLite integrity checks after restore, and docs for the `openclaw snapshot` command surface
488
+
- target-directory safety checks, restore manifest validation, SQLite integrity checks after restore, and docs for the `openclaw backup sqlite snapshot` command surface
498
489
- proof that OpenClaw can create a snapshot from a named database target, copy only the completed snapshot directory, restore from that copied artifact into a fresh local SQLite path, and verify the restored database
499
490
500
491
This proof should also document the host contract: which OpenClaw command or API materializes the artifact, which files are safe to sync, which live SQLite sidecars should be ignored, which manifest fields the host can store without interpreting SQLite internals, and what must be restored before OpenClaw opens the database.
@@ -556,7 +547,7 @@ full snapshot generation. Conservative pruning policy can remain later work.
556
547
557
548
After the initial PRs, follow-up RFCs or implementation PRs can consider:
558
549
559
-
-`openclaw backup` integration
550
+
-broader `openclaw backup`archive integration using the same provider contract
560
551
- object/blob storage providers
561
552
- retention and scheduling
562
553
- WAL bundle retention and pruning policy
@@ -569,9 +560,9 @@ This approach targets the reliability problem directly. It does not require Open
569
560
570
561
The database-first work in openclaw/openclaw#94646 improves this RFC because it gives snapshot a concrete target model. Snapshot does not have to invent logical database units. It can operate over the already-established global control-plane database and per-agent data-plane databases, then extend to dedicated owner stores only when those stores have comparable ownership and lifecycle metadata.
571
562
572
-
Calling the command`snapshot` keeps the first deliverable concrete. It describes the artifact OpenClaw needs before higher-level reliability features can exist. It also avoids overpromising automatic failover before leases, promotion, and orchestration are designed.
563
+
Calling the subcommand`snapshot`under `backup sqlite`keeps the first deliverable concrete without giving it top-level command real estate. The path says what it is: a backup-area SQLite artifact, not a broad backup archive and not automatic failover.
573
564
574
-
Keeping the first implementation stack under `openclaw snapshot` keeps the proof small and command-scoped. Existing `openclaw backup create` and `openclaw backup verify` behavior can remain unchanged while the snapshot provider proves the harder SQLite correctness and restore semantics.
565
+
Keeping the first implementation stack under `openclaw backup sqlite snapshot` keeps the proof small and command-scoped. Existing `openclaw backup create` and `openclaw backup verify` behavior can remain unchanged while the snapshot provider proves the harder SQLite correctness and restore semantics.
575
566
576
567
Treating remote storage as artifact storage avoids the common failure mode where object storage or network filesystems are used as if they were local disk. SQLite remains local and authoritative while running. Reliability comes from verified snapshots, manifests, restore procedures, and later WAL bundles.
0 commit comments