Architecture and extension contract
bounded JSON/ZIP reader
|
source adapter -> canonical graph -> exclusions + explicit mapping + dedup
|
text privacy filtering
|
destination renderers + report
|
opt-in local artifact writer
SourceAdapter.parse(data, artifact_sha256) returns an Archive and content-free
warnings. The provisional ChatGPT adapter supports a top-level array with mapping
nodes and text content parts. Adapter errors must be BridgeError with static,
content-free messages. Each accepted conversation must pass graph validation.
DestinationAdapter.render(archive) returns relative filenames and UTF-8 content;
only built-in trusted adapters are wired into the CLI. No dynamic plugin loading.
Canonical schema version 1 uses dataclasses: Archive, Project, Conversation, Message, Provenance. Parent links are authoritative, including message-less structural nodes; children are derived. Conversation.current_node marks the active branch but never limits retained nodes. Text parts are joined with newlines; non-text parts are omitted with a warning. No attachments, original metadata, project instructions, files or personal memories are claimed to migrate.
Provenance records adapter name, hash of the selected raw JSON payload, original record index and source conversation ID. Node IDs preserve source graph identity. ZIP repackaging does not change the payload hash. Output IDs use graph digests. Source ordering is resolved by source ID and graph fingerprint; graph nodes and JSON object keys are sorted. Duplicate winner titles are taken from the first record in this stable order; original record positions remain in provenance. Identical input/configuration yields identical artifact bytes and reports, except that dry-run status differs from a write run.
The pipeline deep-copies input and does not mutate adapter-owned data. Privacy exclusions remove whole conversations, avoiding dangling branch links. Text redaction preserves topology. Dedup is exact, conservative and within-run only. No fuzzy matching or inferred routing is performed.
To add an adapter, implement the protocol, add synthetic contract fixtures and negative tests, document losses and validation status, and explicitly register it in the CLI. Canonical JSON currently serves as an output/audit format, not an accepted input adapter; changes need a schema version and migration policy.
Browser studio
ctxsplice.ui serves bundled HTML/CSS/JavaScript and a small loopback HTTP API
using the Python standard library. POST /api/preview passes a bounded upload to
the existing reader, source adapter, and processing pipeline, then renders an
in-memory ZIP. GET /api/download returns that ZIP; POST /api/reset drops it.
The API requires the per-launch token injected into the local page. There is no
persistent database, CtxSplice user account, or frontend build step. Optional
network integration is isolated in the connected layer described below.
All displayed archive-derived strings are inserted using textContent.
Numbered ZIP parts are represented by an ExportRecords list carrying per-record
source metadata. The source adapter records the original part hash, part-local
record index, and optional source_member field in provenance. Parts are read
sequentially in numeric order under one combined JSON byte budget. A deterministic
digest of ordered member names and hashes identifies the bundle, while individual
provenance retains the actual part hashes. Single-file provenance keeps the raw
payload hash and a null source member. The schema-v1 optional field is additive.
Optional connected layer
processed canonical archive -> selected subset -> existing Open WebUI adapter
|
plan (destination GETs)
|
exact plan approval + state lock
|
folders -> import batches -> authenticated readback
|
atomic private manifest + migration report
connectors/base.py defines a structural client boundary. The version-scoped
standard-library OpenWebUIClient owns authentication/transport, safe retries,
folder/chat APIs, and marker reconciliation. No credentials enter canonical models
or the processing pipeline. The first target profile is exactly version 0.13.4.
migration/engine.py creates deterministic, message-body-free plans from a fixed
manifest and destination snapshot. It reuses the existing candidate serializer.
Execution checks the plan hash, selected archive, account, and manifest revision,
then durably records pending operations before sending POSTs. It captures actual
folder/chat IDs and verifies owner, folder, title, supported text/timestamps and
all retained graph links/current node by GET. The existing pipeline deduplicates
within a source run; manifests add destination-aware tracking across migrations.
migration/manifest.py provides schema/identity checks, private atomic checkpoints,
flushes and exclusive lock files. Unknown import outcomes are reconciled by a saved
marker in the user's NDJSON export, never blindly retried. Uncertain folder creation
requires an explicit folder choice. This provides conservative duplicate prevention
within preserved state, not distributed exactly-once delivery or automatic rollback.
migration/cli.py adds ctxsplice migrate without replacing the original command.
migration/studio.py adapts the same engine to the existing UI. The loopback server
uses request threads plus one background migration worker so progress can be read;
a session lock prevents preview/reset/connection changes during execution. This is
still a single-user tool, not a public multi-user web service. Credential submission
is a native same-origin form with CSRF protection; JavaScript never reads the
password input and receives no destination token. A connection is never automatic.
Local routes: native POST /api/migration/connect, JSON POST plan/execute/disconnect,
and authenticated GET status/report/manifest. Offline export routes remain intact.
The current browser download uses POST /api/export for selected files; legacy
GET /api/download returns the full cached preview bundle. Downloaded manifest
state can be backed up only when execution has stopped. Defaults and detailed
recovery semantics are in connected-migration.md.