Platform
Export & offboarding
At the end of an engagement you can hand the client a complete, portable copy of their knowledge base — and then delete the workspace with a compliance-grade cascade. Both are service-layer operations, not UI conveniences you could forget.
The export tarball
An export is a .tar.gz of the client-facing knowledge base, with a manifest stamped with the schema version and an as-of timestamp. It contains:
- Vault markdown — every document as its
.mdfile. - The entity graph as JSONL — entities, relations (from
canonical_relations), mentions, and relation evidence. - Golden sets — items, assertions, citations, and tags.
- A manifest — workspace id/name, schema version, and generation time.
Cost/margin data is excluded by construction
llm_calls, spend_counters, extraction cost, provider_credentials, config_snapshots, and budgets. "Export = zip the vault" would have shipped the consultant's cost and margin data to the client — this is the fix.Create an export
Start the export
POST /api/w/:workspaceId/exportcreates aworkspace_exportsrow and builds the archive. A disk preflight verifies there's enough free space (with headroom) before writing. The row movesrunning → ready(orfailed).Download it
GET /api/w/:workspaceId/export/:id/downloadstreams the finished tarball. List prior exports withGET /api/w/:workspaceId/export.
Offboarding delete
Workspace destruction removes and verifies the application's workspace-scoped database and vault content. The registry is derived from the current schema and checked against the live PostgreSQL catalog before any delete:
- All 79 current workspace tables are discovered from the schema. Only
audit_loganddestruction_recordsare retained; the other 77 are ordered by foreign keys, purged, and independently recounted. - That includes documents, revisions, chunks, vectors, graph evidence, conversations, agent/eval history, connector/data-call records, schedules, webhook configuration, policy records, and semantic-cache entries.
- Vault files are removed from disk. A vault failure produces
ok: falseeven when the database purge completed. The retained incomplete record keeps the original export id, so a normal retry can finish vault removal afterworkspace_exportshas already been purged. - The same database transaction explicitly deletes non-tenant SSO provider rows, encrypted client secrets, verified-domain claims, and linked OAuth account tokens. This is required because the Better Auth organization row remains as the audit anchor.
- A dated destruction record written, referencing the backup-retention window, plus an
audit_logentry.
Export-before-delete is enforced in the service layer
Endpoints
GET/POST /api/w/:workspaceId/export— list / create an export.GET /api/w/:workspaceId/export/:id/download— download the tarball.POST /api/w/:workspaceId/workspace/destroy— the offboarding cascade (owner-gated).
For infrastructure-level backups (Postgres, vault files, retention), see Backup & data.