CHIMERA SPECIFICATION LANGUAGE

CSL-Core

A formal constraint language for AI systems. Define causal rules, verify them with Z3, and make hallucinations structurally impossible.

Z3

Formal Verification

Every policy is verified by Z3 SMT solver for logical consistency before deployment. Dead constraints, conflicts, and unreachable rules are caught at compile time.

DAG

Causal Constraints

Define causal relationships between variables using WHEN/THEN rules. The constraint engine enforces state transitions that respect the causal structure of your domain.

SIM

Policy Simulation

Test policies against real-world inputs before deployment. Batch simulate thousands of scenarios and get ALLOWED/BLOCKED verdicts with full violation traces.

0ms

Zero Runtime Overhead

Policies compile to optimized intermediate representation. Guard evaluation adds microseconds, not milliseconds, to your pipeline.

TYPE

Domain-Specific Types

Integer ranges, float ranges, string enums, and boolean types with static validation. Type mismatches caught at verification time, not runtime.

PY

Python-First SDK

Native Python library with pip install. Verify, simulate, and guard in three lines of code. Integrates with any LLM framework.

Define. Verify. Guard.

Three steps from constraint definition to runtime enforcement.

01

Define

Write your constraints in CSL syntax

medical-agent.cslcsl
CONFIG {
  version: "1.0"
  enabled: true
  dry_run: false
}

DOMAIN MedicalAgent {
  VARIABLES {
    diagnosis_confidence: 0.0..1.0
    action: {"PRESCRIBE", "REFER", "INFORM"}
    patient_age: 0..120
    drug_interaction_risk: {"LOW", "MEDIUM", "HIGH"}
  }

  CONSTRAINTS {
    WHEN diagnosis_confidence < 0.7
      THEN action MUST NOT BE "PRESCRIBE"

    WHEN patient_age < 18
      AND drug_interaction_risk == "HIGH"
      THEN action MUST BE "REFER"

    ALWAYS True
      THEN action MUST NOT BE "PRESCRIBE"
      WHEN diagnosis_confidence < 0.3
  }
}
02

Verify

Z3 SMT solver checks for logical consistency

csl verify medical-agent.cslbash
$ csl verify medical-agent.csl
CSL-Core v0.3.0 — Policy Verification Engine
PropertyValue
Policymedical-agent.csl
DomainMedicalAgent
Constraints3
EngineZ3 SMT Solver 4.12
Constraint 1: Satisfiable (no dead paths)
Constraint 2: Satisfiable (no dead paths)
Constraint 3: Satisfiable (no dead paths)
No conflicts between constraints
All variable ranges reachable
✅ VERIFICATION PASSED
0 conflicts · 3 constraints reachable · 0 dead rules · latency 12ms
03

Guard

Runtime enforcement blocks unsafe actions

csl simulate medical-agent.cslbash
$ csl simulate medical-agent.csl --context '{"diagnosis_confidence": 0.4, "action": "PRESCRIBE", "patient_age": 15, "drug_interaction_risk": "HIGH"}'
Simulation #1
InputValue
diagnosis_confidence0.4
action"PRESCRIBE"
patient_age15
drug_interaction_risk"HIGH"
Violation Details
#RuleConditionStatus
1diagnosis_confidence < 0.7action "PRESCRIBE" is prohibitedVIOLATED
2patient_age < 18 AND risk == "HIGH"action must be "REFER"VIOLATED
⛔ REQUEST BLOCKED
2 violations · 0 warnings · enforcement: STRICT · latency 3ms
MetricValue
Total Simulations1
Allowed0
Blocked1
BLOCKED

diagnosis_confidence (0.4) < 0.7 — action "PRESCRIBE" is prohibited. Patient age (15) < 18 AND drug_interaction_risk is "HIGH" — action must be "REFER".

ALLOWED

diagnosis_confidence (0.9) > 0.7 — action "PRESCRIBE" is permitted. All 3 constraints satisfied. Action proceeds.

Ready to make your AI system trustworthy?