Skip to main content

Schemas

All Mega Brain state and artifacts use JSON Schema validation for data integrity.

Schema Index

Location: core/schemas/

State File Locations


chunks-state.schema.json

Validates chunk state with embeddings and metadata. Schema Version: 1.0.0

Structure

Field Definitions

object
required
Schema metadata and statistics
object
required
Dictionary mapping source_id to chunk data
array
required
Audit trail of all changes to this state file

Validation

Source: core/schemas/chunks-state.schema.json:1-xxx

canonical-map.schema.json

Entity canonicalization mappings and aliases. Schema Version: 1.0.0

Structure

Usage

Source: core/schemas/canonical-map.schema.json:1-xxx

insights-state.schema.json

Extracted insights with DNA layer classification. Schema Version: 1.0.0

Structure

DNA Layer Mapping

Source: core/schemas/insights-state.schema.json:1-xxx

narratives-state.schema.json

Synthesized narratives with patterns and tensions. Schema Version: 1.0.0

Structure

Usage

Source: core/schemas/narratives-state.schema.json:1-xxx

file-registry.schema.json

Processed file tracking with checksums.

Structure

Source: core/schemas/file-registry.schema.json:1-xxx

decisions-registry.schema.json

Council decisions and precedents.

Structure

Source: core/schemas/decisions-registry.schema.json:1-xxx

ID System

Source IDs

Format: PREFIX + NNN Examples: CG001, JL003, HR005 Registered Prefixes:

Chunk IDs

Format: {SOURCE_ID}-{NNN} Examples: CG001-001, JL003-015

Decision IDs

Format: YYYYMMDDHHMMSS-{ORIGIN}-{DEST} Example: 20260305130249-CRO-CFO

Precedent IDs

Format: PREC-YYYY-NNN Example: PREC-2026-001

Foreign Keys

Rastreability graph:

Validation Tools

Python

CLI


Schema Evolution

Version Increment Rules

  1. Never delete fields - Mark as deprecated
  2. Always validate before save - Use jsonschema
  3. Increment version on each schema change
  4. Maintain change_log for auditability

Migration

When schema changes:
  1. Create migration script: scripts/migrate_v{N}_to_v{N+1}.py
  2. Update schema file with new version
  3. Run migration on all state files
  4. Validate with new schema

See Also