CTXSPLICE / DOCUMENTATIONView Markdown source
Run CtxSplice locally to process archives or connect a destination. This documentation site does not accept files or credentials.

Connected migration to Open WebUI

Connected migration is optional. Offline JSON/Markdown exports require no network or destination credentials and keep their original CLI and studio controls. The first connected API profile targets Open WebUI 0.13.4 only; other versions are rejected pending a source-contract review and regression tests.

What it does

Preview an export, load your explicit project-name map, select conversations, connect, review a plan, and approve its destination changes. CtxSplice discovers folders, creates approved missing folders, captures their real IDs, imports the selected user/assistant graphs, reads back the imported records, and saves private resumable state. It never restores project instructions, attachments, knowledge bases, or memory settings. Full accepted canonical graphs remain available in the unchanged offline JSON/Markdown outputs; connected mode sends only supported text.

The existing candidate envelope is reused. No speculative native database-row fields are added. The executor adds a meta.ctxsplice_migration marker to support reconciliation; this marker contains hashes, not credentials or message text.

Authentication and connection

Use a credential from the destination Open WebUI account, not an OpenAI model provider key. Find API keys under Settings → Account → API Keys. An administrator may need to enable API Keys and the account's API-key permission. Endpoint restrictions must allow the routes listed below. Do not enable access on production just to run tests. See Open WebUI's API-key guide.

The client sends Authorization: Bearer .... API keys are preferred; an existing supported bearer session token can also authenticate, subject to its expiration and server permissions. CtxSplice never creates or changes credentials or account permissions. A successful read test does not guarantee create/import permission; those permissions can still fail at execution and are reported. The API-key-safe identity read uses /api/v1/users/user/status, which requires the destination user-status feature to be enabled. If that feature is disabled, connection must stop for review; CtxSplice does not enable it or change server permissions.

HTTPS with certificate validation is the default. Redirects and environment proxies are disabled to prevent accidental credential forwarding or destination changes. HTTP requires the explicit Allow HTTP testing checkbox / --allow-http-testing and a private/loopback destination. It sends the key and chats unencrypted; use it only for disposable testing on a network you trust. Public HTTP, link-local metadata addresses, credentials in URLs, queries, and fragments are rejected. The local studio remains bound to 127.0.0.1.

Credentials live in the backend client object and are cleared on disconnect. They are not written to manifests, reports, logs, or browser storage. The UI password form submits natively to Python with a CSRF token; JavaScript does not retrieve the password value. The credential input is cleared after submission. Browser extensions, password managers, browser internals, and other processes under your local OS account remain part of the trusted environment. Python cannot promise physical zeroing of immutable secret strings in RAM.

Studio workflow

  1. Launch ctxsplice-ui and preview a ZIP/JSON export as before.
  2. Load a project map with verified display names; select exactly the chats to send.
  3. In Optional · Connected migration, enter the Open WebUI URL and credential, then click Test connection. Alternatively, start the backend with CTXSPLICE_OPENWEBUI_TOKEN supplied through your own protected environment.
  4. Choose whether to create missing folders. Source-linked chats without a mapped name are conflicts unless you explicitly allow them to remain unassigned. Chats with no source association and no explicit mapping stay unassigned.
  5. Click Preview migration plan. This performs destination reads only. Review counts, project/folder rows, proposed creations, reuse, omissions, and conflicts.
  6. Resolve ambiguous folders by choosing actual destination IDs and preview again. If you need different project names, edit the source project map and preview the archive again. CtxSplice does not rename existing destination folders.
  7. Check I reviewed the plan..., then Create folders & migrate selection. Reimports additionally require a separate explicit confirmation.
  8. Watch folder creation, folder mapping, import attempts, and verification checks. Download the report and back up resumable state when the operation stops.

Changing selections or settings invalidates the visible approval. The server also requires the exact reviewed plan ID and unchanged canonical data/checkpoint state. While an execution is running, it rejects preview/reset/reconnect changes. The backend worker allows progress polling without blocking the local server.

Studio checkpoints default to $XDG_STATE_HOME/ctxsplice/migrations, or ~/.local/state/ctxsplice/migrations when XDG_STATE_HOME is absent. Override with:

ctxsplice-ui --migration-state-dir /path/to/private/migration-state

Each destination URL/account identity has a separate hashed filename. Reconnect and preview the same selection to resume. These files are created during connected execution, not offline preview. Reconnection restores the last saved migration report; independent audit downloads should be saved separately. No CtxSplice database or cloud account is required. Manifest/report downloads contain opaque source/destination IDs and hashes; protect them even though they do not contain conversation text or authentication secrets.

Project and folder resolution

The four identities are distinct:

Identity Example Meaning
Source project ID source-garden Observed source association
Canonical project ID garden Your explicit mapping key
Verified display name Example Garden Name supplied by your project map
Destination folder ID actual-target-folder-id Returned by Open WebUI

An explicit existing-folder choice or trusted recorded mapping takes precedence. Otherwise a single same-name folder is proposed for reuse; approving the plan explicitly authorizes that reuse. Several same-name destination folders are a conflict. Several canonical projects sharing a display name also require explicit choices or distinct names; they are never automatically merged just by name. An explicit choice can intentionally use a differently named writable folder; the plan shows that actual destination ID/name, without renaming it.

Missing folders with verified names are proposed for creation when enabled. The executor checks discovery again immediately before creating to catch races. If a folder creation's response is lost, no chat imports start, and its state becomes unknown. Discover it, choose the correct folder explicitly, preview, and approve again. CtxSplice does not blindly create a second folder or assume a new same-name folder belongs to this migration.

CLI

The original offline command remains available:

ctxsplice /path/to/export.zip --dry-run

The connected command prompts for the credential without echoing if run in an interactive terminal. For automation, inject CTXSPLICE_OPENWEBUI_TOKEN through a protected environment; never put it in the URL or command-line arguments.

Preview (destination reads only; initializes a local private manifest):

ctxsplice migrate \
  --input /path/to/export.zip \
  --destination openwebui \
  --destination-url https://openwebui.example \
  --project-map /path/to/project-map.json \
  --manifest /path/to/private/migration.json \
  --dry-run

Review the JSON plan and copy its actual plan_id. Execute the same request with:

ctxsplice migrate \
  --input /path/to/export.zip \
  --destination-url https://openwebui.example \
  --project-map /path/to/project-map.json \
  --manifest /path/to/private/migration.json \
  --execute --approve PLAN_ID_FROM_REVIEW \
  --report /path/to/private/new-report.json

A changed plan or state requires a new dry run and approval. Reports must be new files; existing reports are not overwritten. The manifest is updated atomically. Exit code 0 means a ready plan or verified execution (possibly explicitly reported unsupported-role omissions); 2 means a conflict, handled failure, or needs-review execution. Always inspect the structured status and omissions, not the exit code alone. HTTP 200 alone never establishes verified migration success.

Additional controls:

Do not confuse offline --openwebui-folder-map with connected --folder-choices: the former only prepares files; the latter selects existing destinations while the connected executor can also create missing folders and capture their actual IDs.

Verification, duplicate prevention, and recovery

The private manifest records schema version, source platform/export fingerprints, destination URL/account identity hash, canonical project-to-folder IDs, canonical conversation IDs, processed graph/payload fingerprints, migration markers, attempts, destination chat IDs, status, errors as fixed codes, and timestamps. It contains no message bodies or credentials. POSIX files are mode 0600 and state directories are created with mode 0700; Windows relies additionally on the user's directory ACLs. State uses atomic replacement and flushes before any non-idempotent request. An exclusive sidecar lock prevents two executors sharing one state file.

Every imported chat is retrieved with authenticated GET and checked for owner, folder ID, title, exact supported message IDs/text/roles/timestamps, parent/children links, current node, and canonical project metadata. Expected folders are also read back with write-access verification. Browser sidebar refresh state is not used as the authority; refresh Open WebUI if its sidebar has not updated yet.

On rerun, recorded destination IDs are read and checked before being skipped. Changed text/privacy policy, moved/deleted chats, or inaccessible folders become conflicts. Prior successful results stay recorded. No existing data is deleted. For an uncertain import without a returned ID, CtxSplice reads the account's NDJSON chat export and looks for its saved marker. One verified match is recovered without another POST. Zero or multiple matches remain conflicts. If this reconciliation endpoint is denied or exceeds the bounded streaming export budget, use manual destination review rather than blind reimport. It may read other chats in that account for reconciliation but never persists or logs their text.

To resume: keep the same manifest, same destination/account, and reconstruct the processed selection; preview again. Review conflicts before executing a new plan. If a hard crash leaves .lock, ensure no executor is still active before removing that local lock. The durable pending marker is the recovery record. Do not discard state to bypass a conflict. Stop/interruption or local disk failure may leave an uncertain request outcome; the persisted pre-request state prevents blind retries.

Duplicate prevention is scoped to a trusted preserved manifest plus matching server records/markers. No global exactly-once guarantee exists: Open WebUI offers no idempotency key here. A lost/deleted manifest, copied/edited marker metadata, external imports, account/database replacement at the same URL, or concurrent executors using different state files can create duplicates or need review. A source chat that changes gets a new canonical identity and may be a new import. Only a separately approved explicit reimport can bypass an uncertain tracked row. Older destination IDs remain in attempt history; no automatic rollback is attempted.

API profile and testing

Version-pinned contracts are documented in compatibility.md. The standard-library client implements:

Method Route Use
GET /api/version Exact supported version detection
GET /api/v1/users/user/status Authenticated importing-account identity
GET /api/v1/folders/ Folder discovery
POST /api/v1/folders/ Create { "name": "..." } after approval
GET /api/v1/folders/{id} Folder identity/name/write-access verification
POST /api/v1/chats/import { "chats": [native envelopes] }
GET /api/v1/chats/{id} Imported-record verification
GET /api/v1/chats/all Bounded NDJSON marker reconciliation

Only safe GET requests have bounded retries (up to two by default), including rate-limit handling. POST requests are never automatically retried. Redirects are errors. TLS validation stays enabled. Authentication/permission errors are fixed, content-free diagnostics; raw server error bodies are not logged or reported. Destination reads are GET-only in dry run. Open WebUI's own folder-list GET may perform housekeeping internally; CtxSplice does not submit mutation requests.

Automated tests use invented fixtures and loopback mock HTTP APIs. They cover planning, folder conflicts/reuse/creation, permissions, timeouts and lost responses, partial failures, exact-plan approval, owner/folder/content/branch verification, manifest locks, reruns, and native-form credential handling. A subsequent live v0.13.4 run created two named folders and imported their associated conversations; the saved result verified both by API read-back. Production recovery and zero-import rerun were subsequently validated; connected target-container restart persistence remains unverified.

Explicit disposable live acceptance

No host or key is hardcoded. The optional live test is skipped unless you set:

export CTXSPLICE_LIVE_DISPOSABLE=1
export CTXSPLICE_LIVE_URL=https://disposable-openwebui.example
export CTXSPLICE_LIVE_STATE=/path/to/private/disposable-state.json
# Supply CTXSPLICE_OPENWEBUI_TOKEN through your protected environment.
python -m pytest -q tests/test_openwebui_live.py

For deliberately unencrypted private-network testing, additionally set CTXSPLICE_LIVE_ALLOW_HTTP=1 and use that disposable HTTP URL. This is explicit permission for the test to create two uniquely named synthetic folders/chats. It never imports personal ChatGPT data and never deletes target records.

The test creates two synthetic projects, migrates, reads back and verifies both, runs again, and checks that neither folders nor marker-tracked chats duplicated. Restart the disposable container yourself, then run the same command with the same CTXSPLICE_LIVE_STATE path to validate persistence. The test does not restart or administer servers, and must not point at production. Keep the test records and private manifest for inspection; delete disposable resources yourself if desired.

NUL-character normalization and recovery (v0.13.4)

Open WebUI v0.13.4 removes U+0000 NUL characters from strings before database storage. CtxSplice preserves the original canonical text and outbound payload fingerprints. Readback verification accepts this one version-scoped difference only when the destination message content is exactly the expected content with NUL characters removed. It does not tolerate other text changes, surrogate removal, whitespace normalization, role changes, timestamp changes or broken branch links.

Such a result is lossy, not byte-exact. A conversation remains durably tracked as verified, with a verification object containing byte_exact: false, result verified_with_transformations, and field-level transformation records. Successful runs containing these transformations use overall verified_with_transformations (and CLI success exit code 0). Omission statuses remain separate; inspect each conversation's transformation records in all reports. Field diagnostics include paths, types, lengths and hashes rather than message bodies.

An old unknown record with a saved destination ID is read and reconciled using that ID and its migration marker. A matching record is planned as recover, never as a new import. Already verified records are checked and skipped; saved folder IDs are reused. Unknown or changed content still creates a conflict and blocks execution. The exact reviewed plan and manifest revision are required as before. No automatic production correction or manifest editing occurs during diagnosis.

After a stopped run, preserve the same backend manifest, source archive, mapping, privacy settings and selection. Back up state, restart Studio only when no worker is active, reconnect the same destination account, and preview again. Review reuse/recovery/import counts and lossy transformation details before approving. Do not reset state, choose reimport, or substitute a downloaded manifest by hand. The report includes title/source IDs, destination IDs, mismatch details and verified/unresolved/remaining totals. Every resume requires a fresh reviewed plan.

Upstream reference: v0.13.4 database sanitization.

Targeted disposable acceptance result

The NUL-character fix passed live acceptance on a separate disposable Open WebUI v0.13.4 instance. One synthetic folder and one branching chat were created. Authenticated readback verified the current and alternate branches and reported exactly three removed NUL characters as a lossy transformation. Canonical text retained those NUL characters. A simulated pre-fix unknown checkpoint recovered the same destination chat ID, and a subsequent durable-state reload/rerun issued no additional folder creations or chat imports. This did not include a container restart and does not establish production recovery completion.

The synthetic full recovery-shape test also passes: 95 existing verified chats, one existing unknown chat, 15 saved folders and 156 unattempted conversations produce 95 skips, one recovery, 15 folder reuses, zero folder creations and only 156 imports. After checkpoint reload, rerun produces no additional POST requests. Production execution remains a separately reviewed operation; preview the real checkpoint and stop if counts, account, data fingerprints or conflicts differ.

Supported independent integrity auditing

After migration, select the same conversations and click Run read-only integrity audit in the connected panel. It starts a backend worker and displays a separate audit result. Download integrity audit saves that report without replacing the migration report or checkpoint. Connect/reconnect, preview, reset and migration execution are blocked while the audit worker is active.

CLI mode uses ctxsplice migrate with the same input/map/privacy/selection and --manifest, adding --audit --report /path/to/private/new-audit.json. It requires an existing private checkpoint and does not create a lock file, initialize state or write the checkpoint. Exit code 0 means a passed audit; 2 means review is required. The optional report is a new private file. Approval flags never cause audit writes.

The audit independently reads selected tracked chats, verifies their expected supported graphs, mapped folder identities/names/access and migration markers, and streams the account export once to count markers and cross-check destination IDs. A checkpoint revision change during auditing invalidates the result. Titles and source/destination IDs appear in private reports for diagnosis; message bodies and credentials do not. Account-export records outside the selection may be read but are discarded, not logged or saved.

The same streaming iterator handles uncertain-import marker reconciliation. NDJSON is split only on byte LF, not Python's Unicode splitlines(). Total export size is limited to 512 MiB, each record to 32 MiB and record count to 100,000. Authentication, network, parsing and budget failures leave the scan incomplete. No partial-stream replay or blind POST retry occurs. This is scoped marker auditing, not detection of unrelated manual copies with removed or changed metadata.

Production validation completed with 252 verified chats, 15 preserved project folders, zero missing/duplicate markers and zero-import rerun. Exactly one chat had a documented three-NUL lossy transformation. It does not prove all exports, unsupported message types, shared permissions or target-container restarts.

Final supported-workflow disposable acceptance

The repository test test_disposable_nul_unicode_recovery_and_supported_audit passed on a separate Open WebUI v0.13.4 instance. It created two uniquely named synthetic projects and branching chats; verified both graphs and folders; reported one three-NUL loss explicitly; preserved Unicode line separators through streamed export; recovered an existing unknown chat after durable checkpoint reload; and passed the supported independent marker audit with zero missing or duplicate markers. The subsequent plan proposed zero imports or folder creations. This test did not restart the target container and made no production requests.

Conversation dates and folder ordering (future imports)

New imports preserve ChatGPT conversation create_time and update_time as optional canonical created_at and updated_at, with source-field provenance and the conversation's artifact/member/record provenance. Fractional seconds are truncated to integer Unix seconds. Missing/null values remain absent from the Open WebUI envelope; invalid, non-positive or out-of-range values fail validation. The v0.13.4 import API accepts these fields at envelope level. Folder ordering uses the row updated_at; unread chats can be prioritized ahead of read chats. Message dates alone do not determine folder order.

Existing graph IDs and deduplication fingerprints are unchanged: row dates are metadata, not graph identity. New payload fingerprints include supplied row dates. For a tracked legacy import, only an exact match of its previous envelope with row dates omitted retains the legacy contract. Its saved fingerprint, marker and destination ID are not rewritten. Missing legacy dates are not fabricated or backfilled. Independent auditing and unknown recovery use the same contract. When row dates were supplied at import, readback checks them strictly; a changed destination date blocks reconciliation instead of overwriting newer activity.

This change does not reorder the completed production migration. New-activity conflicts require review; do not reimport to resolve them. Automated HTTP tests cover ordering inputs, recovery and checkpoint compatibility. The opt-in live historical-ordering test requires a disposable v0.13.4 target. Authenticated live validation of this timestamp extension is pending; earlier production validation does not establish historical row-date preservation.

Existing imports: read-only historical-ordering feasibility

The reviewed v0.13.4 importer accepts row dates only when creating a new chat UUID. The normal update API cannot set database row dates. Setting nested JSON dates does not change folder sorting; history writes touch the row to the current time. No supported API backfill is currently implemented or recommended.

Keep existing conversations and checkpoints intact. Reimport/delete-and-replace would change IDs, duplicate markers and endanger post-migration activity. Writing chats in a chosen sequence fabricates dates. Direct SQL is outside the supported connector, bypasses application checks and introduces concurrent-write risks. Neither workaround is acceptable for this future-import fix.

A future owner-authorized, timestamp-only API with atomic preconditions could support a separately approved backfill. First inventory IDs, folders, markers, complete graphs and native row dates read-only; compare with the original archive and migration baseline, including documented transformations. Exclude chats with new messages, branch changes, edits, advanced activity or uncertain history. An unchanged graph alone cannot prove absence of non-message activity. Preview all changes and test forward/rollback behavior on a disposable instance.

Before an approved backfill, save private immutable backups of original row dates and relevant readback hashes. The endpoint must condition writes on unchanged rows/version and graph, changing only approved dates. Roll back by ID using saved row dates only when the row still matches the backfill result; stop on intervening activity. Never restore a whole database over newer conversations. At present, there is no supported timestamp setter for either forward changes or rollback, so preservation of the current production state is the safe strategy.