Claude Transcripts docs GitHub
Work in progressUnder active development — not tested as ready for use. Breaking changes land without notice, stored data may need to be discarded between revisions, and there is no auth or security model. These docs describe the intended design as much as the current state.

Data & schema migrations

Status: engine built (up/down/status + boot auto-apply); export and import built. The bundle format is specified and implemented in bundles.md; a bundle records the schema version it was taken at, which is what lets import decide whether it can be restored. Decision recorded in ADR 0021.

Every migration to date is view-only — each upserts _design/* docs and nothing else. That is not incidental: it is what makes restoring an older bundle into a newer instance safe, because views are derived and CouchDB rebuilds them over whatever docs exist. Document-transforming migrations are supported by the engine but none has been written, and the first one will need import taught to replay it — see Documents below.

CouchDB has no modern migrations framework, so we build our own — a versioned, reversible tool that migrates documents and design views and plugs into the export/import bundle round-trip. It is a user-useful operation, exposed and driven through the CLI.

What it does

A document migration must set transformsDocs: true. Migrations are recorded per database, not per document, so a transform that has already run leaves a marker saying so — and import writing older-shaped docs into that database produces a mix that migrate up will never revisit, because it has nothing pending. The flag makes import refuse those bundles by name instead of restoring them into the wrong shape (bundles.md). Lifting the refusal means giving migrations a scoped document pass that import can replay over just the ids it restored.

Properties

As built

The engine lives in @claude-transcripts/shared (src/migrations/), pure and vendor-neutral over an abstract MigrationContext port; the webapi implements the port against CouchDB and runs migrations (I/O gateway), and the CLI drives it. There is one authoritative path for view changes — the webapi's boot (ensure.ts) applies pending migrations too, so INITIAL_DESIGNS is the only home for the design views.

Remaining: data-transforming migrations themselves (the allDocs port hook is already in place for them), and the scoped replay import will need before one can be restored across — until then transformsDocs makes import refuse rather than guess.

Shape (as built)

claude-transcripts migrate status                     # current version + pending
claude-transcripts migrate up   [--to <version>] [--dry-run]
claude-transcripts migrate down [--steps <n>]    [--dry-run]

claude-transcripts export <dir> [--since ISO] [--session ID]… [--no-blobs]
claude-transcripts import <dir> [--dry-run] [--no-blobs]