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.0Structure
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
core/schemas/chunks-state.schema.json:1-xxx
canonical-map.schema.json
Entity canonicalization mappings and aliases. Schema Version: 1.0.0Structure
Usage
core/schemas/canonical-map.schema.json:1-xxx
insights-state.schema.json
Extracted insights with DNA layer classification. Schema Version: 1.0.0Structure
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.0Structure
Usage
core/schemas/narratives-state.schema.json:1-xxx
file-registry.schema.json
Processed file tracking with checksums.Structure
core/schemas/file-registry.schema.json:1-xxx
decisions-registry.schema.json
Council decisions and precedents.Structure
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
- Never delete fields - Mark as deprecated
- Always validate before save - Use jsonschema
- Increment version on each schema change
- Maintain change_log for auditability
Migration
When schema changes:- Create migration script:
scripts/migrate_v{N}_to_v{N+1}.py - Update schema file with new version
- Run migration on all state files
- Validate with new schema
See Also
- Intelligence Layer - Scripts that use schemas
- Workflows - State file creation
- Tasks - Schema validation in acceptance criteria
