Every search happens inside a language.
Before a candidate can be evaluated, selected, or mutated, it must be representable. The representation decides which variations are nearby, which compositions are natural, which mistakes are easy to detect, and which ideas remain too expensive to attempt.
This matters more now that generative models can produce programs in large numbers. Candidate generation has become cheap, as described in After Mutation Became Cheap. The quality of the search increasingly depends on the structure into which those candidates are born.
General-purpose source code gives an agent enormous freedom. It also makes every mutation responsible for memory, timing, error handling, integration, serialization, observability, and performance. A configuration file avoids much of that freedom, along with much of the behavior worth exploring.
There is a useful object between them: a small executable language whose host owns the machinery and whose programs express the changing behavior.
I have called the trading instance a keyframe DSL. That name is becoming too narrow. The intended object is closer to a behavioral language: a compact calculus with a reusable core, domain-bound vocabulary, executable reference semantics, and several possible lowering targets.
It can serve as an intermediate representation, although it should remain meaningful and durable in ways that compiler IRs usually do not.
A behavioral calculus
The central program has a simple shape:
P :
observation history
x local state
x authorization
-> intent
An intent may request a position, schedule an experiment, change a controller, operate an instrument, deploy software, or abstain. The domain supplies those nouns. The language supplies recurring operations over time and state:
- observe a typed variable;
- combine conditions;
- require evidence to persist;
- activate or latch a mode;
- invalidate and rearm it;
- import another behavior;
- resolve concurrent claims;
- emit a bounded intent with provenance.
The current trading dialect expresses these operations with S-expressions. A simplified fragment looks like this:
(keyframes
(use (key "flow-lead") (prefix "thesis"))
(defmode unresolved-flow
(:type directional)
(active-when (and (>= (var "flow-innovation") 2.2)
(<= (var "price-response") 0.1)))
(invalidated-when-held
(when (<= (var "flow-posterior") -0.15))
(for_ms 300000)
(max_gap_ms 60000))
(latch true)
(rearm condition_reset)
(intent :bias long :targets (position (capacity_fraction 0.6)))))
The host resolves variables, tracks time, maintains state, validates intent fields, and connects the result to execution. A candidate changes the predicates, lifecycle, target, composition, or other declared semantics without rebuilding that machinery.
Why Lisp-shaped
The case for S-expressions here is practical.
They have one recursively compositional syntax. A condition, mode, import, or target is already a tree. Structural mutation can replace a subtree, move it, wrap it in a guard, or compare it with its parent without first recovering an abstract syntax tree from a large surface grammar.
The parser can remain small. Validation can operate on explicit forms. A canonical printer can make source hashing and structural comparison straightforward. An agent can generate the representation directly, while a human can still inspect the consequential parts.
Succinctness matters too, especially when programs are generated and reviewed inside token budgets. Most of the saving comes from building timing, state, execution, replay, and attribution into the host once. Every later candidate refers to those capabilities with a few forms instead of regenerating their implementation.
This resembles the role WAT plays for WebAssembly: a textual form close to an executable machine model, regular enough to parse and verify. The behavioral language carries more domain meaning and remains a persistent research artifact, so the analogy has limits. It occupies an unusually useful region between source language, executable specification, and intermediate form.
A durable intermediate form
Compiler IR is normally transient. It helps one compilation pass communicate with another and can disappear after the target binary is produced.
An adaptive system needs its behavioral representation to survive. It belongs in lineage. It must retain the conditions under which it acted, the imports it resolved, the semantics that interpreted it, and the evidence produced by its execution. Historical replay and live operation should consume the same object.
A program’s identity therefore includes more than its text:
program identity =
source
+ import closure
+ language semantics
+ domain binding
The trading implementation already content-addresses imported policy closures and parses them into typed Rust structures. The same keyframe semantics can consume historical observations or streaming observations. That gives the language a reference execution path against which faster lowerings can be compared.
Future targets might include specialized Rust state machines, native code, WebAssembly, a GPU evaluator, or a compact device runtime. The source object can persist across all of them. Each target can carry source maps and prove semantic agreement through differential replay over the same event stream.
The durable program remains the unit of critique. The compiled target becomes one execution of it.
When the language learns
The language itself should be allowed to evolve.
Language evolution requires versioned host implementations, tests, and preserved interpretation of older artifacts. A candidate cannot quietly redefine the semantics used to judge it, and an extension cannot upgrade or rewrite old evidence.
Language evolution begins when repeated research pressure exposes a missing operation.
The trading language provides concrete examples. Early controls accepted literal values. Policies soon needed values computed from current state, so runtime expressions became a host operation. A Boolean reversal condition proved too brittle, so held predicates acquired duration and maximum-gap semantics. Fixed cooldowns confused recovery with elapsed time, leading to explicit rearm laws. Composition experiments required imports, namespaces, priorities, disable edges, and parent-owned actions. Positional policies required typed targets and lifecycle evidence.
Each extension captured a distinction that had previously been implemented repeatedly, encoded indirectly, or omitted. Once compiled into the host, that distinction became cheap for every descendant.
This changes the geometry of the search. Adding a primitive does more than shorten existing programs. It creates new local mutations and removes whole classes of malformed ones. A five-minute evidence requirement expressed as a verified temporal operator lives in a different search space from dozens of candidates approximating time through counters and incidental resets.
The representation becomes one of the evolving artifacts described in After Mutation Became Cheap. Agents can propose programs, discover where the language resists an important idea, and propose an extension to the language. The extension earns its place by making useful behavior expressible and verifiable across a population.
Compiled intelligence
Multi-Clock Intelligence described a downward movement: expensive reasoning constructs bounded machinery that can operate on a faster clock.
The behavioral language is a natural target for that process.
An agent may spend substantial effort understanding a failure. Perhaps a signal should remain valid through brief missing observations, an exit should depend on accumulated adverse evidence, or two behaviors should share a resource without erasing attribution. That reasoning can be compiled into a language primitive, a library behavior, or a composition rule.
Afterward, fast programs use the result without repeating the reasoning. Mutation operators gain a new building block. Static analysis gains a new semantic distinction. Replay gains a typed event to inspect. The insight moves from one conversation into the substrate available to future generations.
This is competence compilation at the level of representation.
One core, several domains
The present implementation is still visibly trading-shaped. Its Rust types refer to quotes, positions, fees, and market signals. Extracting the cross-domain core remains future work.
The reusable boundary is already discernible:
core calculus
state / time / modes / lifecycle / composition / intent
domain binding
observations / actions / constraints / resources
execution target
interpreter / replay / Rust / native / WASM
A scientific instrument can bind observations to sensor state and intents to experiments. A software operations system can bind them to telemetry, rollout, and rollback. A controller can bind them to physical state and bounded actuation. These domains need distinct vocabularies while sharing the same structural treatment of evidence, persistence, composition, authority, and replay.
That is why “domain-specific language” no longer quite fits. Domain bindings can vary while the behavioral calculus remains recognizably the same.
Verification before authority
A small language also gives agents a safer way to act.
The host can determine which variables a program reads, which actions it may emit, which resources it can address, and whether its lifecycle is complete. Mutation can happen freely inside that inspectable structure. Real authority remains a separate typed decision, as described in The Right to Act.
The language defines possible behavior. Authorization determines which program may operate, over what scope, for how long, and under which constraints. Execution records what actually happened. Keeping those objects separate makes a generated program useful before it becomes trusted.
The language is part of the search because it determines what a nearby thought looks like. It is part of memory because old programs and their semantics remain replayable. It is part of execution because the same object can run at the speed of its environment.
A mature adaptive system improves its candidates, its search operators, and the vocabulary available to both. A valuable language makes hard-won distinctions cheap to express and difficult to forget.