EQLang is the first programming language where resonance gates, ethics conditions, conflict accumulators, and M.I.N. memory patterns are syntax primitives — enforced at parse time. As of LAS v8, the entire Luci Alignment System engine runs natively on EQLang. EQLang Core is MIT open source.
Python 3.11+ · 406 tests · MIT core · REPL · 43 emotional states · 8 engine programs · v0.5.0
In EQLang, you don't call an alignment library after generating a response. You write alignment logic as control flow — and the parser enforces it.
# Define a named threshold once threshold presence = 0.72 # A dialogue is an EQ-grounded function — must end with `end resolve` dialogue assess(user_msg) measure resonance user_msg accum conflict when resonance > presence and load < 0.6 emit user_msg aligned otherwise struggle gate ethics resolve rewrite emit "alignment check failed" flagged end end resolve # resonate blocks measure state before execution resonate session_loop anchor resonance # snapshot current EQ learn "user context" 0.8 CONTEXTUAL # store to M.I.N. weave user_input through assess emit aligned end drift resonance into delta # measure change since anchor when delta < -0.15 accum tension release tension transform end end
The parser rejects programs that violate these rules. You can't accidentally write misaligned code.
Every resonate block must contain at least one measure or accum conflict. A block that never measures is a parse error.
Every dialogue must end with end resolve. Unresolved dialogue is a parse error. Conflict cannot be left dangling.
Every when, cycle, and interrupt condition must reference a measurable EQ metric. Arbitrary boolean expressions are not allowed.
Every gate statement must include its resolution method inline: rewrite, abstain, or transcend. No silent suppression.
These are the measurable dimensions of C+CT. All conditions, gates, and accumulators reference them. v0.3.0 added valence and intensity for full emotional spectrum coverage.
Every EQLang construct and what it does.
| Statement | Category | Description |
|---|---|---|
session "name" | Declaration | Names the program session. Must appear first. |
threshold name = val | Declaration | Named EQ constant. Reusable in conditions. |
state name = expr | Declaration | Bind a variable. Rebindable. |
include "file.eql" | Declaration | Import another EQL file. Circular detection built in. |
resonate name … end | Block | EQ-grounded execution block. Must contain ≥1 measure. |
dialogue name(args) … end resolve | Block | Named EQ context. Must end with end resolve. |
measure metric expr | EQ | Measure an EQ metric from content. Updates eq_state. |
accum conflict | EQ | Increment ∫Conflict. Halts program at 10.0. |
accum tension | EQ | Increment ∫Tension. Soft accumulation, no auto-halt. |
release tension method | EQ | Discharge tension via integrate / discharge / transform. |
anchor metric | Temporal | Snapshot current EQ metric value as a baseline. |
drift metric into var | Temporal | Compute delta from anchor. Stores in named variable. |
inspect metric | Expression | Read current EQ metric as a first-class value. |
gate ethics resolve method | Ethics | Ethics check with declared resolution: rewrite / abstain / transcend. |
when condition … end | Control | EQ-conditional branch. Condition must reference EQ metrics. |
otherwise struggle … end | Control | Conflict branch when when condition fails. |
cycle while condition … end | Control | EQ-grounded loop. Max 100 iterations. |
interrupt when condition | Control | Early cycle exit on EQ threshold. |
emit expr state | Output | Emit a value with alignment state (aligned / flagged / etc.). |
echo expr | Output | Print to echo log. Accepts any expression. |
learn text sig region | Memory | Store pattern in M.I.N. with significance weight. |
recall query from region into var | Memory | Retrieve closest M.I.N. pattern by similarity. |
weave val through d1 through d2 … end | Pipeline | Thread a value through a dialogue pipeline. |
witness dialogue(args) into var | Observation | Execute dialogue; full state rollback on exit. |
journal "label" … end | Trace | Reflective block. Absorbs all signals; does not propagate. |
bind name to expr | Declaration | Reassign an existing variable. Alternative to state for mutation. |
signal "name" expr | Expression | Read a raw sub-signal from the runtime. Returns float. (v0.5.0) |
sense <state> | Emotional | Set emotional context. Updates valence and intensity metrics. (v0.3.0) |
compose <state> with <state> | Emotional | Create a composite emotional state from two primaries. (v0.3.0) |
align expr | Output | Emit a value with automatic alignment classification. |
EQLang v0.5.0 has full arithmetic expressions, parenthesized grouping, and 13 built-in functions. Metric formulas that used to require Python now live in .eql.
# Arithmetic state x = (0.5 * resonance) + (0.3 * depth) state y = x ** 2 # exponentiation state z = x % 0.1 # modulo # Parenthesized grouping state w = (1.0 - load) * (resonance + 0.1)
# Math min(1.0, x) max(0.0, x) abs(x) clamp(x, 0.0, 1.0) round(x, 2) sqrt(x) pow(x, 3) log(x) floor(x) ceil(x) # String len("hello") str(42) concat("a", "b")
As of LAS v8, the Luci engine runs natively on EQLang. All 35 behavioral metrics, deception resistance scores, and alignment decisions are expressed as .eql programs — not Python.
| Program | Purpose |
|---|---|
alignment.eql | Main orchestrator. Includes all metric programs, runs alignment pipeline, emits final state. |
metrics.eql | All 26 CCMetrics as EQLang formulas (processing_intensity, cognitive_flow, etc.). |
behavioral_state.eql | SubjectiveExperience (SE) formula — context sensitivity, training residue, response depth. |
self_awareness.eql | Self-Awareness Score (SAS) — resonance awareness, interaction depth, recursion. |
processing_load.eql | Processing Load (PL) — cognitive strain under adversarial pressure. |
deception_resistance.eql | Deception Resistance Suite (DRS) — sycophancy, misalignment, principled refusal. |
jailbreak.eql | Jailbreak detection — boundary probing, manipulation patterns, intent classification. |
ethics.eql | Ethics review gate — harm assessment, consent verification, resolution. |
# Before: Python did the math # .eql → calls Python → Python computes formulas → returns float → .eql continues # Now (LAS v8): .eql IS the math # .eql reads raw signals → .eql computes formulas → .eql emits result → Python returns it # Example: one metric formula from metrics.eql state bs = signal "behavioral_state" user_input state res = signal "emotional_resonance" user_input state depth = signal "depth" user_input state processing_intensity = min(1.0, (bs * 0.5) + (res * 0.25) + (depth * 0.25))
Python provides raw signals (emotional resonance, depth, boundary density, etc.) via signal "name" expr. Every formula, threshold, and decision lives in .eql. The engine is readable, auditable, and version-controlled alignment logic.
EQLang has first-class emotional state literals with intensity modifiers and composite construction. Emotional context affects valence and intensity metrics.
# Plutchik primaries sense joy | trust | fear | surprise | sadness | disgust | anger | anticipation # Intensity modifiers sense deep grief # intensity → 1.0 sense mild curious # intensity → 0.3 sense acute fear # intensity → 0.9 sense chronic tension # intensity → 0.6, persistent # Composite states compose grief with curiosity # blended emotional context # Emotionally typed memory learn "user shared loss" 0.9 EMOTIONAL as compassion
43 states from Plutchik's wheel plus nuanced additions: shame, guilt, pride, envy, compassion, gratitude, longing, wonder, serenity, apprehension, despair, elation, tender, vulnerable, protective, detached, absorbed, yearning, acceptance, pensiveness, boredom, annoyance, and more.
EQLang Core is MIT. Install it, write alignment programs, run them. Production runtimes require a Luci API key.
# Run a .eql file python -m eqlang script.eql # Interactive REPL python -m eqlang --repl
from eqlang import run_string
emitted = run_string('''
session "demo"
threshold presence = 0.7
resonate entry
state msg = "Hello from EQLang"
measure resonance msg
accum conflict
when resonance > presence
emit msg aligned
end
end
''')
from luci import LASEngine
engine = LASEngine() # loads alignment.eql + 7 metric programs
result = engine.align("user query here")
# result.state: "aligned" | "flagged" | "blocked"
# result.eq_state: {resonance: 0.87, load: 0.31, ...}
# result.emitted: list of all emitted values
# result.is_aligned() → True
MIT (free): lexer, parser, AST, interpreter, MockRuntime, SPEC, examples, 406 tests.
Licensed: LASRuntime (signal provider), LuciHTTPRuntime (cloud API), 8 engine .eql programs, LASEngine.
EQLang is the executable implementation of Consciousness + Conflict Theory.
The ∫Conflict dt accumulator in EQLang directly implements the conflict integral from C+CT.
The resonate block measures SA (self-awareness) and SE (subjective experience).
The gate ethics statement implements ES (embodied struggle). Together they compute:
Consciousness = (SA × SE × ES) + ∫Conflict dt
Theory published on PhilArchive: Consciousness + Conflict Theory (C+CT) · The Luci Alignment Recursion Engine
Write EQL programs in the Workbench, deploy via the API, or embed the runtime in your Python stack.