Appearance
Runtime model
Omega is a CESK abstract machine. Programs are compiled to an Expr AST and stepped through a State { control, env, store, kont } tuple. Effects (LLM calls, side effects, file I/O) are dispatched through an EffectBackend.
The four parts
| Component | Type | Notes |
|---|---|---|
| Control | Expr | the AST node currently being evaluated |
| Environment | Env | name → location map (lexical scope) |
| Store | Store (COWStore) | location → value map (the heap) |
| Kontinuation | Frame[] | the stack of pending steps |
Plus a HandlerFrame[] stack tracking dynamic effect handlers.
State is exported as a TypeScript type and is reified as a MachineVal value within the language. That reification is what enables machine-step, machine-fork, machine-eval-at, and machine-resume.
Stepping
stepOnce(state) → StepResult advances the machine one CESK step. runToCompletion(state) runs until the kontinuation stack is empty or an effect requires the host to provide a value.
ts
// projects/omega-lisp/src/core/eval/run.ts
export { runToCompletionWithState, runToCompletion } from "./run";The default OmegaRuntime config caps steps at 500,000 (OmegaConfig.maxSteps). Hitting the cap returns an error rather than spinning forever.
Effects and the runtime
EffectBackend (core/effects/backend.ts) is the interface for handling effects. When an (effect foo.op args) form runs, the machine pauses, the backend gets called, and the backend either:
- Returns a
Resumptionimmediately, or - Promises a value asynchronously, or
- Surfaces the request through the
OracleAdapter(forinfer.opand friends).
RuntimeImpl (core/effects/runtimeImpl.ts) is the concrete backend that wires effects to drivers via the DriverRegistry.
Stores: copy-on-write
COWStore (core/eval/store.ts) is a copy-on-write store. Forking a machine doesn't copy the entire heap; it shares pages until one branch mutates. This is what makes machine-fork cheap.
Environments
Env is a lexical-scope map. Definitions go to the current Env; (let ...) extends it; lookup walks the chain. The Env is not a JavaScript dictionary — it's structured for serialization and for Sealed extension (used by Module values).
Time-travel
Because the entire machine is a value, you can:
lisp
(define m (machine-from-expr '(+ 1 2)))
(machine-step m)
(machine-stack m) ; inspect the kont
(define forked (machine-fork m))
(machine-step forked) ; explore one branch
;; original m is unchangedThis is also how the debugger, breakpoints, and the session-replay engine work. Each session entry is a CESK transition; replaying a session is just stepping through them.
Profiles and budgets
Profile (core/governance/profile.ts) constrains what effects are legal and what budgets apply. with-profile prof body installs a profile for a dynamic extent. Budget is a typed value carrying remaining oracle turns, eval steps, tool calls — exhausting a budget is a structured error, not a crash.
See also
Source:
projects/omega-lisp/src/core/eval/machine.ts,store.ts,env.ts,run.ts;projects/omega-lisp/src/core/effects/runtimeImpl.ts. TheOmegaConfig.maxStepsdefault is atprojects/omega-lisp/src/runtime.ts:53.