Database layout
A few high-volume or lifecycle-specific features use dedicated SQLite stores, including the task registry and trajectory data.
Versioning contract
Each database records its schema in two places:PRAGMA user_versionis the SQLite schema version.- The primary
schema_metarow recordsrole,agent_id,schema_version, andapp_version.app_versionis the OpenClaw build that last wrote the schema metadata.
user_version is newer than the running build and reports a newer schema version error. The Gateway checks all registered databases before startup. openclaw update also refuses a package or source target whose declared schema support is older than an on-disk database. Target packages published before schema metadata was added cannot be preflighted.
Installing OpenClaw manually through npm bypasses the updater guard. Database open checks still refuse an incompatible build.
Agent schema history
Version 3 was an unshipped development step folded into version 4.
State schema history
Integrity checks
The Gateway preflight reads schema headers only. The background verifier owns the slower full scan for databases that do not need migration.
Quarantine decisions live only in a dedicated
openclaw-quarantine.sqlite store, so they survive damage to the databases being quarantined. Verification results are logged.
Troubleshooting
Why you cannot go back after updating to 2026.7.2
Every release throughv2026.7.1 used agent schema 1 and state schema 1. The 2026.7.2 release train (starting with v2026.7.2-beta.1) migrates your databases forward on first start. That migration is one-way: the data is rewritten into the newer schema, and installing an older OpenClaw afterwards does not undo it. The older build refuses to start with a newer schema version error that names the build that owns the database.
Downgrading the binary never downgrades the data. If you must run a release older than 2026.7.2 after updating, you have three options:
- Restore a backup taken before the update. Create and verify backups before major updates.
- Run the older build against a separate state directory (
OPENCLAW_STATE_DIR). It starts fresh; your migrated data stays untouched for when you return to the newer build. - Follow the manual downgrade procedure below. It is unsupported and risks data loss without a verified backup.
openclaw update refuses to install a release that cannot open your current databases, so the updater will not put you in this situation. Installing an older version manually through npm bypasses that guard; the databases still refuse the old binary, but only after it is installed.
The Gateway refuses to start with a newer schema version error
A newer OpenClaw build wrote your databases, and the running build is older. The error and the Gateway startup log name the build that owns the database (app_version). Install that version or newer, or use one of the options above. Do not edit the database to silence the error.
A database is quarantined after integrity verification failed
The background verifier proved the file is corrupt, and every open now fails fast instead of rescanning. Restore the database from a backup or repair it, then runopenclaw doctor --fix to clear the quarantine record. Doctor reports an explicit error if the quarantine record itself cannot be cleared; rerun it until it reports clean.
Downgrades are unsupported
Manual schema downgrades are for agents and operators who accept the risk. Create and verify a backup before editing any database. Stop the Gateway and every process that can open the database. The general procedure is:- Read the target release’s schema and migrations.
- In one transaction, drop every table, index, trigger, and column introduced after the target version.
- Set
PRAGMA user_versionandschema_meta.schema_versionto the target version. - Run the target release’s full database verification before starting the Gateway.
Example: agent schema 11 to 9
Schema 10 added the active transcript projection. Schema 11 added leases, durable delivery, conversation-address state, and heartbeat outcomes. QMD coordination uses rows instate_leases; there is no separate QMD table to preserve.
Run equivalent SQL against each affected per-agent database after inspecting the exact schema that wrote it: