Learn

Contents

From prompt to deployed program

One example, taken from a request to an AI assistant to a folder that runs on your computer and a live service drawn in the eLucid8 Player. The assistant does the work with the tools elucid8 mcp offers; this page shows each tool it calls, why, and what comes back, so you can follow it, check it, and do any step yourself. Each step links the page that covers it in full.

The example: sensor readings in a CSV file, a temperature for each minute and sensor. The program computes the mean of each sensor's last three minutes, counts how many minutes in a row that mean has been above 30 degrees, raises an alert after two, and writes the alerts to a file. Then it runs live, with the readings replayed a minute every second.

1. The prompt

With an assistant on your computer. Claude Code, Claude Desktop, Codex and Cursor can start elucid8 mcp and use its tools; Using eLucid8 with AI coding agents says how to configure each one. Start it in a folder, sensors, holding the readings as readings.csv:

minute,sensor,temperature
0,north,28
1,north,31
2,north,33
3,north,34
4,north,29
5,north,27
6,north,26
7,north,25
0,south,30
1,south,32
2,south,34
3,south,35
4,south,36
5,south,33
6,south,31
7,south,30

and ask:

readings.csv in this folder has a temperature for each minute and sensor. Write an eLucid8 program that reads it as the input readings and computes recent, the mean of a sensor's readings over the last three minutes (fewer at the start); streak, how many minutes in a row recent has been above 30; and alert, true when streak is 2 or more. Write alert to alerts.csv as the output alerts, and set up the deployment in this folder (deploy.json and program.el8). Then tell me which sensors are in alert at minute 5, and show me streak live in the eLucid8 Player, replaying readings.csv a minute every second, over and over.

The prompt names what you want and what each result is called. It does not say how to write it: the assistant learns that from the language's reference.

With ChatGPT and the hosted server. Add https://elucid8-lang.org/mcp to ChatGPT as the AI coding agents page shows, paste the file's text into the chat, and ask the same, without the last sentence. The hosted server compiles and runs the program on the data you pasted, proposes how to read it, and gives the deployment's files for you to save, with a link that opens the program in the playground. It reads no files on your computer and starts no services, so the live Player needs elucid8 mcp on your computer.

2. What the assistant does

The calls below are the ones an assistant makes for this request, with their arguments, and what each tool gives back (shortened where … is written). Paths are written as if the folder were /Users/you/sensors.

Read the reference

eLucid8's syntax is its own, so the assistant reads the language's reference first, as the server tells it to:

{ "name": "language_reference", "arguments": {} }
# eLucid8

…

> eLucid8 (pronounced "elucidate") is a Lucid-family language for values over named dimensions (time, space, anything), computed on demand. …

It is the whole reference for AI tools; section gives one part of it.

Read the data

propose_bindings reads the file and proposes how a deployment reads it: which columns tell a row apart (the dimensions), and which holds the value.

{ "name": "propose_bindings", "arguments": { "paths": ["readings.csv"] } }
What was read, and the proposal for each input:

readings.csv: 16 rows; columns: minute (whole numbers), sensor (texts), temperature (whole numbers)
  {"minute":0,"sensor":"north","temperature":28}
  {"minute":1,"sensor":"north","temperature":31}
  {"minute":2,"sensor":"north","temperature":33}
  {"minute":3,"sensor":"north","temperature":34}
  {"minute":4,"sensor":"north","temperature":29}
Proposed:
  channel   readings
  over      minute (number), sensor (text)
  values    temperature (number)

Show this to the user and ask them to confirm each input or change it (its channel, what a missing point reads: "fill": {"missing": 0}, or no fill for missing data, or "layout": "per column" for a table with a column per quantity), and which results come out: each an output with a channel, its dimensions (from the inputs') and the file it goes to. Then call write_deployment with this description, changed as they said, and the outputs.

A careful assistant shows you this and asks before it goes on. Here the proposal is right: minute and sensor tell a reading apart, and temperature is the value. Every minute has a reading from each sensor, so the proposal gives no fill: a reading that does not arrive later is missing data, not 0. The result also holds the proposal as a description the next tool takes.

Write the deployment

write_deployment writes the folder's files from that description and the outputs you asked for, then runs elucid8 check on them:

{ "name": "write_deployment", "arguments": { "description": "…", "outputs": [{ "channel": "alerts", "dims": ["minute", "sensor"], "to": "alerts.csv" }] } }

("…" is the description propose_bindings gave, as it gave it.)

Written in /Users/you/sensors (deploy.json, program.el8, bindings.json, README.txt). elucid8 check: done.
program.el8: plan version 26, 1 input, 1 output
input "readings": readings.csv (CSV), stored, version 470eb8099934fedc; over minute, sensor : {"north", "south"} (as the data decides, texts; 16 rows); a missing point is missing data (eod past the last row along minute)
  columns: minute (coordinate), sensor (coordinate), temperature (value)
output "alerts": alerts.csv (CSV), over minute = 0..7, sensor = {"north", "south"} (16 rows); columns minute, sensor, alerts_value, alerts_kind, alerts_message
ok
…

deploy.json says where the input comes from and where the output goes ($schema lets an editor check its fields):

{
  "$schema": "https://elucid8-lang.org/schema/elucid8-deploy-2.json",
  "format": "elucid8-deploy/2",
  "inputs": {
    "readings": {
      "from": "readings.csv",
      "value": "temperature"
    }
  },
  "outputs": {
    "alerts": {
      "to": "alerts.csv"
    }
  }
}

and program.el8 is a starting program that already compiles: the input, and the output written as the input until the rest is written.

-- Inputs (from deploy.json; see bindings.json for what was read).
-- readings.csv: 16 rows over minute (whole numbers 0..7), sensor (texts: north,
--   south); a missing point is missing data (eod past the last row).
readings = input("readings", minute : inf, sensor : {"north", "south"})

-- Outputs. Each starts as a value it can already write; replace the right side
-- with what you compute.
output("alerts") = readings

Write the program, and compile it

The assistant writes the equations between those lines. A first try at streak reads streak itself at the same minute, which the compiler refuses:

-- Inputs (from deploy.json; see bindings.json for what was read).
-- readings.csv: 16 rows over minute (whole numbers 0..7), sensor (texts: north,
--   south); a missing point is missing data (eod past the last row).
readings = input("readings", minute : inf, sensor : {"north", "south"})

-- The mean of the last three minutes; fewer at the start.
recent = mean readings over (minute : #minute - 2 .. #minute) end

-- Hot: the recent mean above 30 degrees.
hot = recent > 30

-- How many minutes in a row a sensor has been hot.
streak = if hot then streak + 1 else 0

-- An alert after two hot minutes in a row.
alert = streak >= 2

-- Outputs. Each starts as a value it can already write; replace the right side
-- with what you compute.
output("alerts") = alert
-- expect compile error: unguarded cycle
{ "name": "compile", "arguments": { "programPath": "program.el8" } }
The program does not compile: line 13, column 1: unguarded cycle: streak -> streak (a value cannot depend on itself at the same context)
Open it in the eLucid8 playground: https://elucid8-lang.org/play#text=1.…
If you have not read it yet, call language_reference: eLucid8's syntax is its own, and it is not on the web.

The streak a minute earlier is 0 fby.minute streak: 0 at the first minute, and streak one minute back after it (Tutorial, streams). With that, the program compiles:

-- Inputs (from deploy.json; see bindings.json for what was read).
-- readings.csv: 16 rows over minute (whole numbers 0..7), sensor (texts: north,
--   south); a missing point is missing data (eod past the last row).
readings = input("readings", minute : inf, sensor : {"north", "south"})

-- The mean of the last three minutes; fewer at the start.
recent = mean readings over (minute : #minute - 2 .. #minute) end

-- Hot: the recent mean above 30 degrees.
hot = recent > 30

-- How many minutes in a row a sensor has been hot.
streak = if hot then (0 fby.minute streak) + 1 else 0

-- An alert after two hot minutes in a row.
alert = streak >= 2

-- Outputs. Each starts as a value it can already write; replace the right side
-- with what you compute.
output("alerts") = alert
-- table readings = minute,sensor,value; 0,"north",28; 1,"north",31; 2,"north",33; 3,"north",34; 4,"north",29; 5,"north",27; 6,"north",26; 7,"north",25; 0,"south",30; 1,"south",32; 2,"south",34; 3,"south",35; 4,"south",36; 5,"south",33; 6,"south",31; 7,"south",30
-- expect recent[minute = 0, sensor = "north"] = 28
-- expect recent[minute = 1, sensor = "north"] = 29.5
-- expect streak[minute = 4, sensor = "north"] = 3
-- expect streak[minute = 5, sensor = "north"] = 0
-- expect alert[minute = 5, sensor = "north"] = false
-- expect alert[minute = 5, sensor = "south"] = true
-- expect output "alerts" over minute = *, sensor = *

Open in playground

(The last lines, from -- table, are this page's: the data and the answers the program gives, for the Open in playground button. The program.el8 the assistant writes ends at the output's line.)

{ "name": "compile", "arguments": { "programPath": "program.el8" } }
Compiled /Users/you/sensors/program.el8 with elucid8's own compiler: plan version 26, 5 values, no warnings.
Open it in the eLucid8 playground: https://elucid8-lang.org/play#text=1.…

The last line is a link that opens the program in the playground (shortened here: the program's text follows text=1., encoded); the assistant gives you that link, never one it builds itself. recent is a mean over a region: the three minutes from #minute - 2 to #minute, where #minute is the minute being computed; minutes before 0 are left out, so the first two minutes average fewer readings. The assistant compiles each version before it shows it to you, and shows exactly the text the compiler accepted: the rule every assistant is given (AI coding agents).

Check it, and ask for the first answers

check reads the data and checks every binding without computing anything:

{ "name": "check", "arguments": { "config": "deploy.json", "planPath": "program.el8" } }
elucid8 check /Users/you/sensors/program.el8 --config /Users/you/sensors/deploy.json: done.
/Users/you/sensors/program.el8: plan version 26, 1 input, 1 output
input "readings": readings.csv (CSV), stored, version 470eb8099934fedc; over minute, sensor : {"north", "south"} (whole numbers, texts; 16 rows); a missing point is missing data (eod past the last row along minute)
  columns: minute (coordinate), sensor (coordinate), temperature (value)
output "alerts": /Users/you/sensors/alerts.csv (CSV), over minute = 0..7, sensor = {"north", "south"} (16 rows); columns minute, sensor, alerts_value, alerts_kind, alerts_message
ok

run computes the queries it is given (it writes no output files: that is yours to do, below):

{ "name": "run", "arguments": { "programPath": "program.el8", "config": "deploy.json", "queries": ["alert[minute = 5, sensor = {\"north\", \"south\"}]", "streak[minute = 0..7, sensor = \"north\"]"] } }
Ran 2 queries with elucid8 run, the program compiled by elucid8's own compiler, configuration /Users/you/sensors/deploy.json: done; 10 answers.
alert[minute = 5, sensor = "north"] = false
alert[minute = 5, sensor = "south"] = true
streak[minute = 0, sensor = "north"] = 0
streak[minute = 1, sensor = "north"] = 0
streak[minute = 2, sensor = "north"] = 1
streak[minute = 3, sensor = "north"] = 2
streak[minute = 4, sensor = "north"] = 3
streak[minute = 5, sensor = "north"] = 0
streak[minute = 6, sensor = "north"] = 0
streak[minute = 7, sensor = "north"] = 0
Chart of query 1 (alert[minute = 5, sensor = {"north", "south"}]): elucid8://chart/1, a Vega-Lite v5 spec (2 cells): render it, or save it as a .vl.json file and open it.
Chart of query 2 (streak[minute = 0..7, sensor = "north"]): elucid8://chart/2, a Vega-Lite v5 spec (8 cells): render it, or save it as a .vl.json file and open it.
Open it in the eLucid8 playground: https://elucid8-lang.org/play#text=1.…

At minute 5 south is in alert and north is not: north's mean fell to 30, which is not above 30, so its streak went back to 0.

Show it live

show starts elucid8 serve on your computer and opens the Player in your browser. Here the input comes from a replay of the file, one minute's rows every second, over and over, so the service gives itself new data and the Player follows it, with no script to run (Inputs given rows over time):

{ "name": "show", "arguments": { "programPath": "program.el8", "inputs": { "readings": { "from": { "builtin": "replay", "file": "readings.csv", "every": "1s", "loop": true }, "value": "temperature" } }, "value": "streak" } }
Opened the eLucid8 Player in your browser: streak over sensor (2 cells), playing minute 0–0. Space pauses; drag the slider to move through the steps. If the browser did not open, the player is at http://127.0.0.1:…/player#k=…. It keeps running until you ask me to stop it or close this session. The first frame: streak at minute = 0, sensor = "south" is 0. The data are flowing: input readings: /Users/you/sensors/readings.csv replayed: one minute's rows every 1000 ms, 8 coordinates in order, then again from the start, its coordinates and times moved on. They keep flowing until the service stops (show with stop: http://127.0.0.1:…/player#k=…).

The Player shows each sensor's streak, and moves on as each minute arrives. A minute's answers never change once its readings are in, because everything the program computes looks back, never ahead. The link holds a key that may ask for answers and nothing else.

The assistant then tells you what it did: the program, the files it wrote, that south is in alert at minute 5 and north is not, and that the Player is open.

3. What you have afterwards

The folder holds:

filewhat it is
readings.csvyour data, unchanged
program.el8the program
deploy.jsonwhere each input comes from and where each output goes
bindings.jsonwhat was read from the data and what was guessed, so you can check it
README.txtthe guesses, how to change them, and the commands to run next

Run it yourself. With the elucid8 command installed (Deploy tutorial), in the folder, elucid8 check reads everything without computing, and elucid8 run writes the outputs; with no program or configuration named, both use program.el8 and deploy.json:

elucid8 run
cat alerts.csv
minute,sensor,alerts_value,alerts_kind,alerts_message
0,north,false,value,
0,south,false,value,
1,north,false,value,
1,south,false,value,
2,north,false,value,
2,south,true,value,
3,north,true,value,
3,south,true,value,
4,north,true,value,
4,south,true,value,
5,north,false,value,
5,south,true,value,
6,north,false,value,
6,south,true,value,
7,north,false,value,
7,south,true,value,

A question, without writing anything:

elucid8 run --query 'alert[minute = 5, sensor = {"north", "south"}]'
{"name":"alert","context":{"minute":5,"sensor":"north"},"outcome":{"kind":"value","value":false,"ts":0}}
{"name":"alert","context":{"minute":5,"sensor":"south"},"outcome":{"kind":"value","value":true,"ts":0}}

Change a reading in readings.csv and run again: the alerts follow the data.

Serve it live yourself. The live service show started reads the input from a replay. To start it yourself, write that input in a second configuration, deploy-live.json:

{
  "format": "elucid8-deploy/2",
  "inputs": {
    "readings": {
      "from": { "builtin": "replay", "file": "readings.csv", "every": "1s", "loop": true },
      "value": "temperature"
    }
  }
}

and start the service:

elucid8 serve --config deploy-live.json --http 127.0.0.1:8080

Open http://127.0.0.1:8080/player?value=streak&live in your browser for the Player, or ask from another terminal with elucid8 repl http://127.0.0.1:8080:

elucid8> streak[minute = 3, sensor = "south"]
3

watch streak[minute = last, sensor = "south"] in the repl follows it minute by minute. With your device writing real readings, give the input its file and send new rows to the service as they come instead (The long-running service).

Stop the live service when you are done, by asking the assistant, which calls:

{ "name": "show", "arguments": { "stop": "all" } }
Stopped the player (streak at http://127.0.0.1:…); its page no longer updates.

It also stops when the assistant's session ends, or after an hour in which nothing asked it anything.

Change it by asking again. "Raise the alert after three minutes", "add a sensor's maximum over the last hour", or "write the alerts as Parquet": the assistant edits program.el8 or deploy.json, compiles and checks again, and runs it.

Next: read your data from a database, a stream or a web API instead of a file (Connecting eLucid8 to your data), and keep the service running for others, with HTTPS, health checks and metrics (Running eLucid8 as a service). Every option of deploy.json is in the Command reference.

4. When it goes wrong

A program that does not compile. The compiler gives the line, the column and what is wrong, and the assistant fixes it and compiles again, as with streak above. After three failures it shows you the compiler's error instead of a program that may not work.

Data read the wrong way. check (and write_deployment, which runs it) says what each column of the file is for. A column named ts is read as each row's timestamp, in milliseconds; if yours holds something else, a batch number say, check shows the guess:

  columns: minute (coordinate), sensor (coordinate), temperature (value), ts (timestamps, assumed from the name)

Tell the assistant ts is not a time; it adds "time": "none" to the input in deploy.json, and check then shows:

  columns: minute (coordinate), sensor (coordinate), temperature (value), ts (ignored: "time": "none")

A new sensor in the data. The starting program lists the sensors it found, sensor : {"north", "south"}. Rows for another sensor are not read, and check says so:

  input readings (readings.csv): 1 row names a sensor not in the program's list ("east")

If more sensors may come, ask for sensor without a list, readings = input("readings", minute : inf, sensor : inf): the sensors are then whatever the data holds, and the output's rows follow it.

The Player opened before any data. A live service whose data has not started yet has nothing to draw. From 0.23.0, the Player says "Live · waiting for the first data" and goes live by itself when the first rows arrive; with 0.22.0, reload the page once data has come. A replay, as here, gives its first minute as soon as the service starts.