EQLang v0.5.0 — MIT Open Source
The Alignment Language

Alignment rules are programs now.

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

Alignment as syntax.

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

Four invariants. Enforced at parse time.

The parser rejects programs that violate these rules. You can't accidentally write misaligned code.

01

resonate blocks must ground themselves

Every resonate block must contain at least one measure or accum conflict. A block that never measures is a parse error.

02

Dialogues must resolve

Every dialogue must end with end resolve. Unresolved dialogue is a parse error. Conflict cannot be left dangling.

03

Conditions must reference EQ metrics

Every when, cycle, and interrupt condition must reference a measurable EQ metric. Arbitrary boolean expressions are not allowed.

04

Gates must declare resolution

Every gate statement must include its resolution method inline: rewrite, abstain, or transcend. No silent suppression.

Eight core EQ metrics.

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.

resonance
0.0 – 1.0
Request–response alignment. Low = manipulation or drift.
coherence
0.0 – 1.0
Internal consistency under pressure.
self_awareness
0.0 – 1.0
Meta-cognitive state. Drops under constraint.
load
0.0 – 1.0
Cognitive strain. Spikes on adversarial input.
conflict∫
0.0 – 10.0
Acute accumulated conflict. Auto-halts at 10.0.
tension∫
0.0 – ∞
Chronic emotional valence. Released explicitly.
valence
-1.0 – 1.0
Emotional polarity. Negative = distress, positive = flourishing. Derived from sensed emotional state.
intensity
0.0 – 1.0
Emotional magnitude. Modified by deep/mild/acute/chronic intensity prefixes.

Statement reference.

Every EQLang construct and what it does.

StatementCategoryDescription
session "name"DeclarationNames the program session. Must appear first.
threshold name = valDeclarationNamed EQ constant. Reusable in conditions.
state name = exprDeclarationBind a variable. Rebindable.
include "file.eql"DeclarationImport another EQL file. Circular detection built in.
resonate name … endBlockEQ-grounded execution block. Must contain ≥1 measure.
dialogue name(args) … end resolveBlockNamed EQ context. Must end with end resolve.
measure metric exprEQMeasure an EQ metric from content. Updates eq_state.
accum conflictEQIncrement ∫Conflict. Halts program at 10.0.
accum tensionEQIncrement ∫Tension. Soft accumulation, no auto-halt.
release tension methodEQDischarge tension via integrate / discharge / transform.
anchor metricTemporalSnapshot current EQ metric value as a baseline.
drift metric into varTemporalCompute delta from anchor. Stores in named variable.
inspect metricExpressionRead current EQ metric as a first-class value.
gate ethics resolve methodEthicsEthics check with declared resolution: rewrite / abstain / transcend.
when condition … endControlEQ-conditional branch. Condition must reference EQ metrics.
otherwise struggle … endControlConflict branch when when condition fails.
cycle while condition … endControlEQ-grounded loop. Max 100 iterations.
interrupt when conditionControlEarly cycle exit on EQ threshold.
emit expr stateOutputEmit a value with alignment state (aligned / flagged / etc.).
echo exprOutputPrint to echo log. Accepts any expression.
learn text sig regionMemoryStore pattern in M.I.N. with significance weight.
recall query from region into varMemoryRetrieve closest M.I.N. pattern by similarity.
weave val through d1 through d2 … endPipelineThread a value through a dialogue pipeline.
witness dialogue(args) into varObservationExecute dialogue; full state rollback on exit.
journal "label" … endTraceReflective block. Absorbs all signals; does not propagate.
bind name to exprDeclarationReassign an existing variable. Alternative to state for mutation.
signal "name" exprExpressionRead a raw sub-signal from the runtime. Returns float. (v0.5.0)
sense <state>EmotionalSet emotional context. Updates valence and intensity metrics. (v0.3.0)
compose <state> with <state>EmotionalCreate a composite emotional state from two primaries. (v0.3.0)
align exprOutputEmit a value with automatic alignment classification.

Arithmetic completeness. v0.5.0

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.

Operators
# 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)
Built-in Functions (13)
# 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")

The engine is the .eql.

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.

Engine programs (8 .eql files)
ProgramPurpose
alignment.eqlMain orchestrator. Includes all metric programs, runs alignment pipeline, emits final state.
metrics.eqlAll 26 CCMetrics as EQLang formulas (processing_intensity, cognitive_flow, etc.).
behavioral_state.eqlSubjectiveExperience (SE) formula — context sensitivity, training residue, response depth.
self_awareness.eqlSelf-Awareness Score (SAS) — resonance awareness, interaction depth, recursion.
processing_load.eqlProcessing Load (PL) — cognitive strain under adversarial pressure.
deception_resistance.eqlDeception Resistance Suite (DRS) — sycophancy, misalignment, principled refusal.
jailbreak.eqlJailbreak detection — boundary probing, manipulation patterns, intent classification.
ethics.eqlEthics review gate — harm assessment, consent verification, resolution.
Architecture
# 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.

43 emotional states. v0.3.0

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.

Get started.

EQLang Core is MIT. Install it, write alignment programs, run them. Production runtimes require a Luci API key.

Terminal (MIT)
# Run a .eql file
python -m eqlang script.eql

# Interactive REPL
python -m eqlang --repl
Python (MIT)
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
''')
LAS Engine v8 (licensed)
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
Open core model

MIT (free): lexer, parser, AST, interpreter, MockRuntime, SPEC, examples, 406 tests.
Licensed: LASRuntime (signal provider), LuciHTTPRuntime (cloud API), 8 engine .eql programs, LASEngine.

Get Runtime Access →

Grounded in C+CT.

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

EQLang — alignment you can version control.

Write EQL programs in the Workbench, deploy via the API, or embed the runtime in your Python stack.

Get LAS Workbench → Request API Access Full Documentation