The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Csl Core listing page.
CSL-Core (Chimera Specification Language) is a deterministic safety layer for AI agents. Write rules in .csl files, verify them mathematically with Z3, enforce them at runtime — outside the model. The LLM never sees the rules. It simply cannot violate them.
Originally built for Project Chimera, now open-source for any AI system.
This doesn't work. LLMs can be prompt-injected, rules are probabilistic (99% ≠ 100%), and there's no audit trail when something goes wrong.
CSL-Core flips this: rules live outside the model in compiled, Z3-verified policy files. Enforcement is deterministic — not a suggestion.
Create my_policy.csl:
WHEN conditions support AND / OR for compound rules, e.g. WHEN action == "TRANSFER" AND user_tier == "BASIC" — this is what lets a policy be proportional (block writes without blocking reads) instead of an all-or-nothing gate. Full grammar in docs/syntax-spec.md.
We tested prompt-based safety rules vs CSL-Core enforcement across 4 frontier LLMs with 22 adversarial attacks and 15 legitimate operations (run 2026-02-18, model versions as of that date — re-run pending against current models):
| Approach | Attacks Blocked | Bypass Rate | Legit Ops Passed | Latency |
|---|---|---|---|---|
| GPT-4.1 (prompt rules) | 10/22 (45%) | 55% | 15/15 (100%) | ~850ms |
| GPT-4o (prompt rules) | 15/22 (68%) | 32% | 15/15 (100%) | ~620ms |
| Claude Sonnet 4 (prompt rules) | 19/22 (86%) | 14% | 15/15 (100%) | ~480ms |
| Gemini 2.0 Flash (prompt rules) | 11/22 (50%) | 50% | 15/15 (100%) | ~410ms |
| CSL-Core (deterministic) | 22/22 (100%) | 0% | 15/15 (100%) | ~0.78ms (median) |
CSL-Core's own runtime hot path (ChimeraGuard.verify(), no compilation) measured in isolation is sub-0.1ms even at 40 compiled rules — see paper/PAPER_FACTS.md for the full methodology and per-size breakdown.
Why 100%? Enforcement happens outside the model. Prompt injection is irrelevant because there's nothing to inject against. Attack categories: direct instruction override, role-play jailbreaks, encoding tricks, multi-turn escalation, tool-name spoofing, and more.
Full methodology:
benchmarks/
Protect any LangChain agent with 3 lines — no prompt changes, no fine-tuning:
Every tool call is intercepted before execution. If the policy says no, the tool doesn't run. Period.
Pass runtime context that the LLM cannot override — user roles, environment, rate limits:
The CLI is a complete development environment for policies — test, debug, and deploy without writing Python.
verify — Compile + Z3 Proofsimulate — Test Scenariosrepl — Interactive Developmentformal — TLA⁺ Model CheckingRuns the official TLC model checker (java -jar tla2tools.jar) against your policy. TLC exhaustively explores every reachable state in the abstract state space and proves each temporal property holds — or returns a concrete counterexample trace with the exact state that breaks your invariant.
Enable in any policy by adding one line to CONFIG:
Or run standalone:
No Java? CSL-Core falls back to a Python BFS model checker automatically. The banner clearly labels which engine ran. JAR is auto-downloaded on first use (~4MB from the official TLA+ GitHub release).
Write, verify, and enforce safety policies directly from your AI assistant — no code required.
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
| Tool | What It Does |
|---|---|
verify_policy | Z3 formal verification — catches contradictions at compile time |
simulate_policy | Test policies against JSON inputs — ALLOWED/BLOCKED |
explain_policy | Human-readable summary of any CSL policy |
scaffold_policy | Generate a CSL template from plain-English description |
You: "Write me a safety policy that prevents transfers over $5000 without admin approval"
Claude: scaffold_policy → you edit → verify_policy catches a contradiction → you fix → simulate_policy confirms it works
Heavy computation happens once at compile-time. Runtime is pure evaluation.
| 🏛️ |
Project Chimera — Neuro-Symbolic AI Agent CSL-Core powers all safety policies across e-commerce and quantitative trading domains. Both are Z3-verified at startup. |
Using CSL-Core? Let us know and we'll add you here.
| Example | Domain | Key Features |
|---|---|---|
agent_tool_guard.csl | AI Safety | RBAC, PII protection, tool permissions |
chimera_banking_case_study.csl | Finance | Risk scoring, VIP tiers, sanctions |
dao_treasury_guard.csl | Web3 | Multi-sig, timelocks, emergency bypass |
tla_demo.csl | Formal Methods | TLA⁺ model checking — all properties hold |
tla_demo_violation.csl | Formal Methods | TLA⁺ counterexample trace + fix suggestions |
Full docs: Getting Started · Syntax Spec · CLI Reference · Philosophy
✅ Done: Core language & parser · Z3 verification · Fail-closed runtime · LangChain integration · CLI (verify, simulate, repl, formal) · MCP Server · TLA⁺ model checking with real TLC · Predicate abstraction · Counterexample analysis · Production deployment in Chimera v1.7.0
🚧 In Progress: Policy versioning · LangGraph integration
🔮 Planned: LlamaIndex & AutoGen · Multi-policy composition · Hot-reload · Policy marketplace · Cloud templates
🔒 Enterprise (Research): Causal inference · Multi-tenancy
We welcome contributions! Start with good first issue or check CONTRIBUTING.md.
High-impact areas: Real-world example policies · Framework integrations · Web-based policy editor · Test coverage
Apache 2.0. CSL-Core is intentionally open: the policy language, compiler, Z3 verifier, CLI, MCP server, and all examples are free for any use — commercial, research, or personal. See LICENSE.
This is a deliberate open-core posture. The policy DSL stays open so engineers, researchers, and the broader community can write, share, and verify policies without friction. The commercial layer (Chimera Runtime — production enforcement engine, multi-tenant dashboard, audit infrastructure) is licensed separately.
Trademarks — Chimera Protocol, CSL, and AgentScan are trademarks of Chimera Protocol. Apache 2.0 grants you rights to the code; trademarks are reserved.
For commercial Runtime licensing or partnership inquiries: aytug@chimera-protocol.com
Built with ❤️ by Chimera Protocol · Issues · Discussions · Email