Skip to main content

Module schema

Module schema 

Source
Expand description

§Schema Registry & Ontology

Persistent, versioned database schemas for every AI chat provider and format version, plus an ontology layer that makes schemas discoverable by AI agents.

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Schema Registry                          │
│  ┌─────────────┐ ┌────────────-─┐ ┌─────────────┐           │
│  │  Copilot v3 │ │ Copilot JSONL│ │  Cursor v1  │  ...      │
│  │  (JSON)     │ │  (0.37+)     │ │             │           │
│  └─────────────┘ └──────────────┘ └─────────────┘           │
├─────────────────────────────────────────────────────────────┤
│                    Ontology Layer                           │
│  • Entity types, relationships, field semantics             │
│  • Cross-provider mappings (field A in X ≡ field B in Y)    │
│  • Version migration paths                                  │
│  • Machine-readable capability descriptors                  │
└─────────────────────────────────────────────────────────────┘

§Usage

use csm::schema::{SchemaRegistry, SchemaVersion};

let registry = SchemaRegistry::new();

// List all known schemas
for schema in registry.list_schemas() {
    println!("{}: {} fields", schema.id(), schema.field_count());
}

// Detect schema for a workspace
let detected = registry.detect_schema("/path/to/workspace")?;

// Query the ontology
let ontology = registry.ontology();
let mappings = ontology.cross_provider_mappings("copilot-jsonl-v1", "cursor-v1");

Structs§

CrossProviderMapping
A mapping between fields in two different provider schemas.
DbKeySchema
Schema for a key in a SQLite key-value store (like VS Code’s state.vscdb)
DetectedSchema
Result of schema auto-detection
EntityRelationship
A relationship between two entity types
FieldSchema
Schema for a single field in a session record
MigrationPath
Describes how to migrate data from one schema version to another.
Ontology
The complete ontology over all provider schemas.
ProviderSchema
Complete schema definition for one provider at one version.
SchemaRegistry
Central registry of all known AI chat provider schemas.
SchemaVersion
Unique identifier for a provider schema version.
SemanticTag
A semantic tag represents a universal concept that may appear under different field names in different providers.
SessionFormatSchema
Schema for the session file/record format
StorageLocation
Platform-aware storage location descriptor

Enums§

DataType
Supported data types
EntityType
High-level entity types that appear across providers
FieldConstraint
Constraints on field values
FieldTransform
Transformation to apply when mapping a field between providers
FormatType
Session file format
RelationshipKind
Kinds of relationships between entities
StorageType
Where session data is stored

Functions§

build_all_provider_schemas
Build and return all known provider schemas.
claude_code_v1
Claude Code CLI session schema.
codex_cli_v1
OpenAI Codex CLI session schema.
continue_dev_v1
Continue.dev VS Code extension session schema.
copilot_json_v3
VS Code Copilot Chat JSON format (extensions 0.25.0 – 0.36.99).
copilot_jsonl_v1
VS Code Copilot Chat JSONL event-sourced format (extensions 0.37.0+).
cursor_v1
Cursor IDE chat session schema.
gemini_cli_v1
Google Gemini CLI session schema.
openai_api_v1
Generic OpenAI API-compatible conversation format.