OKHAM.org Documentation EnglishCastellano

February 2026 edition

OKHAM Conformance — Compliance Levels & Validation

Target Audience: Implementers, tooling developers, and CI/CD engineers defining OKHAM compliance requirements.


Purpose

This document defines what it means to be OKHAM-compliant. It specifies conformance levels, validation requirements, and fail/warn conditions for automated compliance checking.

Key Principle: Conformance is measurable, testable, and automatable.


Conformance Levels

OKHAM defines three conformance levels. You can claim compliance at any level, but higher levels require stricter adherence.

Level 1: Minimal Compliance

Definition: Implements the basic structure of one or more OKHAM contracts.

Requirements:

  • [ ] Artifacts validate against contract JSON Schema
  • [ ] Artifacts use correct ID format (namespace.name@version)
  • [ ] Artifacts use semantic versioning (MAJOR.MINOR.PATCH)
  • [ ] Artifacts include required fields per contract specification

Use Case: Early adoption, proof-of-concept, or single-contract implementation.

Example: A system that defines types using OTC structure and validates them against OTC schema.


Level 2: Partial Compliance

Definition: Implements multiple OKHAM contracts with cross-contract references.

Requirements:

  • [ ] All Level 1 requirements
  • [ ] Cross-contract references use full IDs
  • [ ] Referenced contracts exist and are accessible
  • [ ] Semantic metadata is present and meaningful
  • [ ] Versioning is consistent across contracts

Use Case: Production systems adopting multiple contracts (e.g., OTC + OEC).

Example: A system that defines types (OTC) and events (OEC) with events referencing types.


Level 3: Full Compliance

Definition: Implements all applicable OKHAM contracts with complete semantic preservation.

Requirements:

  • [ ] All Level 2 requirements
  • [ ] All core contracts (OTC, OEC, OPC, OUCC) are implemented
  • [ ] Semantic metadata is comprehensive and validated
  • [ ] Backward compatibility is maintained within MAJOR versions
  • [ ] Compliance is continuously monitored and reported

Use Case: Enterprise systems requiring full OKHAM interoperability.

Example: A platform that implements OTC, OEC, OPC, and OUCC with full semantic preservation and automated compliance monitoring.


Contract-Specific Compliance

Each contract has specific compliance requirements. Use these checklists to validate compliance.

OTC (Open Type Contract) Compliance

Minimal Requirements:

  • [ ] Type has unique ID in format namespace.name@version
  • [ ] Type has name field
  • [ ] Type has version field (semantic versioning)
  • [ ] Type has schema field (valid JSON Schema)
  • [ ] Type validates against OTC JSON Schema

Partial Requirements (in addition to minimal):

  • [ ] Type has semantics field with purpose
  • [ ] Type schema includes descriptions for all fields
  • [ ] Type uses standard JSON Schema types
  • [ ] Type references other types using full IDs

Full Requirements (in addition to partial):

  • [ ] Type has comprehensive semantic metadata (constraints, relationships)
  • [ ] Type schema includes examples
  • [ ] Type has migration guide for breaking changes
  • [ ] Type is registered in a discoverable registry

Validation Command:

okham-lint validate --contract=otc --file=types/User.json

Expected Output:

✓ Type ID is valid
✓ Type validates against OTC schema
✓ Semantic metadata is present
✓ Schema is valid JSON Schema

OEC (Open Event Contract) Compliance

Minimal Requirements:

  • [ ] Event has unique ID
  • [ ] Event has type field (semantic event type)
  • [ ] Event has timestamp field (ISO 8601 format)
  • [ ] Event has source field
  • [ ] Event has data field
  • [ ] Event validates against OEC JSON Schema

Partial Requirements (in addition to minimal):

  • [ ] Event type uses full ID format (namespace.name@version)
  • [ ] Event data references types using $type field
  • [ ] Event has causation field (array of parent event IDs)
  • [ ] Event has correlation field (correlation ID)
  • [ ] Event timestamp is in UTC

Full Requirements (in addition to partial):

  • [ ] Event causation chain is valid (parent events exist)
  • [ ] Event data validates against referenced type schema
  • [ ] Event has semantic classification (domain/integration/system)
  • [ ] Event is immutable (no updates after creation)

Validation Command:

okham-lint validate --contract=oec --file=events/UserCreated.json

Expected Output:

✓ Event ID is valid
✓ Event validates against OEC schema
✓ Event timestamp is ISO 8601
✓ Event data references valid type
✓ Causation chain is valid

OPC (Open Policy Contract) Compliance

Minimal Requirements:

  • [ ] Policy has unique ID in format namespace.name@version
  • [ ] Policy has name field
  • [ ] Policy has version field (semantic versioning)
  • [ ] Policy has effect field (allow/deny/condition)
  • [ ] Policy has rules field (array of rules)
  • [ ] Policy validates against OPC JSON Schema

Partial Requirements (in addition to minimal):

  • [ ] Policy has scope field (defines what it applies to)
  • [ ] Policy rules have condition and action fields
  • [ ] Policy rules are declarative (no imperative code)
  • [ ] Policy effect is deterministic

Full Requirements (in addition to partial):

  • [ ] Policy scope references valid resources/capabilities
  • [ ] Policy rules are testable (can be validated)
  • [ ] Policy has conflict resolution rules
  • [ ] Policy evaluation is auditable (logs decisions)

Validation Command:

okham-lint validate --contract=opc --file=policies/AdminOnly.json

Expected Output:

✓ Policy ID is valid
✓ Policy validates against OPC schema
✓ Policy effect is valid
✓ Policy rules are declarative
✓ Policy scope is defined

OUCC (Open UI Component Contract) Compliance

Minimal Requirements:

  • [ ] Component has unique ID in format namespace.name@version
  • [ ] Component has name field
  • [ ] Component has version field (semantic versioning)
  • [ ] Component has props field (defines component inputs)
  • [ ] Component validates against OUCC JSON Schema

Partial Requirements (in addition to minimal):

  • [ ] Component props are typed (reference OTC types)
  • [ ] Component has slots field (defines children)
  • [ ] Component has semantics field with purpose
  • [ ] Component has accessibility metadata

Full Requirements (in addition to partial):

  • [ ] Component accessibility metadata is complete (role, keyboard, ARIA)
  • [ ] Component props have validation rules
  • [ ] Component has usage examples
  • [ ] Component is portable (can be rendered in multiple frameworks)

Validation Command:

okham-lint validate --contract=oucc --file=components/Button.json

Expected Output:

✓ Component ID is valid
✓ Component validates against OUCC schema
✓ Component props are typed
✓ Component has accessibility metadata
✓ Component semantics are defined

Fail Conditions (CI/CD Blockers)

These conditions MUST cause build/CI failures. They indicate non-compliance with OKHAM standards.

Critical Failures (Block Deployment)

Condition Contract Severity Action
Invalid JSON Schema All CRITICAL Reject artifact
Missing required fields All CRITICAL Reject artifact
Invalid ID format All CRITICAL Reject artifact
Invalid semantic versioning All CRITICAL Reject artifact
Schema validation failure All CRITICAL Reject artifact
Broken cross-contract reference All CRITICAL Reject artifact
Duplicate IDs All CRITICAL Reject artifact
Invalid timestamp format OEC CRITICAL Reject artifact
Missing causation field OEC CRITICAL Reject artifact
Invalid policy effect OPC CRITICAL Reject artifact
Missing accessibility metadata OUCC CRITICAL Reject artifact

CI/CD Integration:

# .github/workflows/okham-compliance.yml
name: OKHAM Compliance
on: [push, pull_request]
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Validate OKHAM Contracts
        run: |
          okham-lint validate --fail-on=critical --contracts=contracts/
      - name: Check for duplicate IDs
        run: |
          okham-lint check-duplicates --contracts=contracts/

Warning Conditions (Non-Blocking)

These conditions SHOULD generate warnings but do NOT block builds. They indicate areas for improvement.

Warnings (Improve Quality)

Condition Contract Severity Action
Missing semantic metadata All WARNING Log warning
Missing descriptions OTC WARNING Log warning
Missing examples OTC, OUCC WARNING Log warning
Generic event type OEC WARNING Log warning
Missing correlation ID OEC WARNING Log warning
Missing policy scope OPC WARNING Log warning
Missing component slots OUCC WARNING Log warning
Incomplete accessibility metadata OUCC WARNING Log warning

CI/CD Integration:

- name: Check OKHAM Quality
  run: |
    okham-lint validate --warn-on=quality --contracts=contracts/
  continue-on-error: true

Compliance Checklist (Per Contract)

Use this checklist to manually verify compliance before automated validation.

Pre-Deployment Checklist

For All Contracts:

  • [ ] Artifact is valid JSON/YAML
  • [ ] Artifact has unique ID
  • [ ] Artifact uses semantic versioning
  • [ ] Artifact validates against contract schema
  • [ ] Artifact has no duplicate IDs
  • [ ] Artifact has meaningful semantic metadata

For OTC (Types):

  • [ ] Type schema is valid JSON Schema
  • [ ] Type has purpose in semantics
  • [ ] Type fields have descriptions
  • [ ] Type references use full IDs

For OEC (Events):

  • [ ] Event has ISO 8601 timestamp
  • [ ] Event has causation chain
  • [ ] Event data references valid types
  • [ ] Event is immutable

For OPC (Policies):

  • [ ] Policy has clear effect
  • [ ] Policy rules are declarative
  • [ ] Policy scope is defined
  • [ ] Policy is deterministic

For OUCC (Components):

  • [ ] Component props are typed
  • [ ] Component has accessibility metadata
  • [ ] Component has usage examples
  • [ ] Component is portable

Automated Compliance Tools

okham-lint (Validation Tool)

Installation:

go install github.com/okham-org/okham-lint@latest

Usage:

# Validate a single contract
okham-lint validate --contract=otc --file=types/User.json

# Validate all contracts in a directory
okham-lint validate --contracts=contracts/

# Validate with specific conformance level
okham-lint validate --level=full --contracts=contracts/

# Generate compliance report
okham-lint report --contracts=contracts/ --output=compliance-report.json

Configuration (.okham-lint.yml):

conformance_level: partial
fail_on:
  - critical
warn_on:
  - quality
contracts:
  - contracts/types/**/*.json
  - contracts/events/**/*.json
  - contracts/policies/**/*.json
  - contracts/components/**/*.json

okham-validator (Schema Validator)

Installation:

npm install -g @okham/validator

Usage:

# Validate against OTC schema
okham-validator otc types/User.json

# Validate against OEC schema
okham-validator oec events/UserCreated.json

# Validate with verbose output
okham-validator --verbose otc types/User.json

Compliance Reporting

Report Format

Compliance reports SHOULD be generated in JSON format for machine readability.

Example Report:

{
  "timestamp": "2024-01-16T10:30:00Z",
  "conformance_level": "partial",
  "contracts": {
    "otc": {
      "total": 10,
      "valid": 9,
      "invalid": 1,
      "warnings": 2
    },
    "oec": {
      "total": 15,
      "valid": 15,
      "invalid": 0,
      "warnings": 3
    },
    "opc": {
      "total": 5,
      "valid": 5,
      "invalid": 0,
      "warnings": 0
    },
    "oucc": {
      "total": 8,
      "valid": 7,
      "invalid": 1,
      "warnings": 1
    }
  },
  "failures": [
    {
      "contract": "otc",
      "file": "types/InvalidUser.json",
      "error": "Missing required field: schema",
      "severity": "critical"
    },
    {
      "contract": "oucc",
      "file": "components/Button.json",
      "error": "Missing accessibility metadata",
      "severity": "critical"
    }
  ],
  "warnings": [
    {
      "contract": "otc",
      "file": "types/User.json",
      "warning": "Missing semantic metadata: constraints",
      "severity": "warning"
    }
  ]
}

Continuous Compliance Monitoring

Monitoring Strategy

Daily Checks:

  • [ ] Validate all contracts against schemas
  • [ ] Check for duplicate IDs
  • [ ] Verify cross-contract references
  • [ ] Generate compliance report

Weekly Checks:

  • [ ] Review warnings and improve quality
  • [ ] Update contracts to latest versions
  • [ ] Audit semantic metadata completeness

Monthly Checks:

  • [ ] Review conformance level (upgrade if possible)
  • [ ] Audit backward compatibility
  • [ ] Review and update migration guides

Monitoring Tools

Prometheus Metrics:

# okham_compliance_total
okham_compliance_total{contract="otc",status="valid"} 9
okham_compliance_total{contract="otc",status="invalid"} 1
okham_compliance_total{contract="oec",status="valid"} 15
okham_compliance_total{contract="oec",status="invalid"} 0

Grafana Dashboard:

  • Total contracts by type
  • Validation success rate
  • Warnings over time
  • Conformance level distribution

Conformance Badges

Display conformance level in your documentation:

Markdown:

![OKHAM Conformance: Partial](https://img.shields.io/badge/OKHAM-Partial-yellow)

HTML:

<img src="https://img.shields.io/badge/OKHAM-Partial-yellow" alt="OKHAM Conformance: Partial">

Levels:

  • Minimal: OKHAM Conformance: Minimal
  • Partial: OKHAM Conformance: Partial
  • Full: OKHAM Conformance: Full

Conformance Certification (Future)

Status: PLANNED

Once OKHAM standards reach STABLE status, a formal certification process will be available:

  1. Self-Assessment: Use automated tools to validate compliance
  2. Submission: Submit compliance report to OKHAM foundation
  3. Review: OKHAM foundation reviews submission
  4. Certification: Receive official OKHAM conformance certificate

Benefits:

  • Official recognition of OKHAM compliance
  • Listed in OKHAM conformance registry
  • Access to OKHAM conformance logo

Upgrading Conformance Levels

From Minimal to Partial

Steps:

  1. Add semantic metadata to all contracts
  2. Implement cross-contract references
  3. Validate all references
  4. Add comprehensive descriptions
  5. Run compliance check at partial level

Estimated Effort: 1-2 weeks


From Partial to Full

Steps:

  1. Implement all core contracts (OTC, OEC, OPC, OUCC)
  2. Add comprehensive semantic metadata
  3. Implement backward compatibility checks
  4. Set up continuous compliance monitoring
  5. Generate and review compliance reports
  6. Run compliance check at full level

Estimated Effort: 4-8 weeks


Troubleshooting

Common Compliance Issues

Issue: Schema validation fails Solution: Ensure artifact structure matches contract specification exactly

Issue: Invalid ID format Solution: Use format namespace.name@version (e.g., [email protected])

Issue: Broken cross-contract reference Solution: Ensure referenced contract exists and is accessible

Issue: Duplicate IDs Solution: Ensure all contract IDs are unique across the system

Issue: Missing semantic metadata Solution: Add semantics field with purpose and other metadata


Additional Resources


Remember: Conformance is a journey, not a destination. Start with minimal compliance and upgrade as your system matures.