Start here

Build FIELD projects with an AI coding agent.

FIELD has two written specs — AI-JS.md and AI-PLUGINS.md — meant to be read by an AI coding assistant (Claude, Cursor, Copilot, whatever you use), not a human. Handing one to your agent is often faster than reading the guide yourself.

This page is the front door to both. Read it first, watch one worked example — an ESP32 board and a p5.js sketch talking to each other through FIELD — then grab whichever spec matches what you're building.

Why not just download the file?

The spec files are dense and literal on purpose — an agent wants a strict contract, not prose. That makes them a bad first read for a human. This page is the human-readable version: one real example, then the spec, in that order.

scroll · or use back / next below
Chapter 1

Two specs, two different jobs.

Both files describe a contract for an agent to follow literally. They cover opposite ends of FIELD: one is about the screen, the other is about the wire.

AI-JS.md

Software side

How a p5.js sketch or web page reads live FIELD values over field-bridge.js. No hardware involved.

AI-PLUGINS.md

Hardware side

How to write a .field-plugin.json file that teaches FIELD a new sensor chip on an Arduino/ESP32 board.

Most real projects use both: a board reading a sensor FIELD already knows (or a plugin you asked an agent to write), and a sketch drawing the result. That's exactly what the worked example in the next chapters builds.

Chapter 2 · worked example

An ESP32 knob that moves a p5.js sketch.

One ESP32 board, one potentiometer, one browser tab. Turn the knob — a circle drawn in p5.js moves across the screen, live, over Wi-Fi.

ESP32reads TILT/knob
FIELD canvasCue + Mechanism
p5.js sketchfield-bridge.js

The ESP32 talks to FIELD the normal way — generated Arduino code, wired over the same Wi-Fi as your computer (or plain USB serial). The sketch talks to FIELD over a local WebSocket via field-bridge.js. FIELD sits in the middle, applying whatever Cue and Mechanism you drew on the canvas — the two ends never talk to each other directly.

What you need

An ESP32 dev board, one potentiometer (or reuse your phone's tilt sensor instead — no board required to try the software half), and the FIELD desktop app running. Board and computer don't even need the same Wi-Fi if you flash over USB.

Chapter 3

Step one: the ESP32 sends a number.

You don't hand-write any Arduino code for this — FIELD generates the whole sketch from the canvas.

  1. Open FIELD. Add an Actor — call it "Knob" — and give it a SLIDER input role.See the Actor appear on the canvas with one input port.
  2. Open Actor Context for Knob, set board family to ESP32, and pick the analog pin your potentiometer's wiper is wired to.See a pin selector filtered to valid ESP32 analog pins.
  3. Open the Arduino code panel, choose Wi-Fi or USB transport, and either use one-click upload or copy the generated sketch into the Arduino IDE yourself.See a complete .ino file — includes, setup, and a loop reading analogRead() and sending it to FIELD.
  4. Power the board. Turn the knob.See the SLIDER value in the Actor panel move live from 0 to 1.
No board yet? Use your phone instead

Skip this chapter and give Knob a TILT role instead, connected via Connect → Phone. Everything in Chapters 4–5 works identically — FIELD doesn't care whether the number came from an ESP32 or a phone.

Chapter 4

Step two: draw one Cue.

Add a second Actor — call it "Ball" — with a MOVE output role. Drag from Knob's SLIDER port to Ball's MOVE port. That line is the Cue; the pill on it is the Mechanism.

Leave the Mechanism as a plain DIAL — output tracks input directly, 0 to 1. Now turning the knob changes Ball's MOVE value, visible live in the Actor panel, with nothing written yet.

Try this

Swap the Mechanism to SWITCH with a threshold at 0.5 — the ball should now snap between two positions instead of sliding smoothly. This is the part an AI agent never sees or needs to know about: it only ever reads the number that comes out the other side.

Chapter 5

Step three: read it in p5.js.

This is the part AI-JS.md is written for — hand this exact file to your coding agent and ask for a sketch, or copy the pattern below by hand.

knob-ball.html

<!DOCTYPE html>
<html>
<head><meta charset="utf-8" /></head>
<body>
<script src="https://cdn.jsdelivr.net/npm/p5@1.9.4/lib/p5.min.js"></script>
<script src="./field-bridge.js"></script>
<script>
function setup() {
  createCanvas(windowWidth, windowHeight);
  noStroke();
}

function draw() {
  background(13, 12, 10);

  const move = field.get('MOVE') ?? 0.5;   // Ball's Cue output, 0-1
  const x = move * width;                  // 0-1 -> across the screen

  fill(124, 58, 237);
  circle(x, height / 2, 60);

  fill(255); textSize(12); textFont('monospace');
  text(field.connected ? 'FIELD ● live' : 'FIELD ○ waiting…', 16, 24);
}

function windowResized() { resizeCanvas(windowWidth, windowHeight); }
</script>
</body>
</html>

Save it, open it in a browser while FIELD is running, and turn the knob — the violet circle tracks it in real time. No build step, no npm install: just the two <script> tags.

Chapter 6 · the agent workflow

Let the agent write the sketch for you.

Once the ESP32 and the Cue exist (Chapters 3–4), the fastest way to get the p5.js half is to describe what you want and hand your agent the spec — not to write it yourself.

  1. Open a chat with your coding agent (Claude Code, Cursor, etc.) in a folder next to FIELD's field-bridge.js.See an empty project — no scaffolding needed.
  2. Paste in AI-JS.md (link below) and describe your sketch in one or two sentences — e.g. "a p5.js sketch where a circle's x position follows FIELD's MOVE output, and its glow follows GLOW."See the agent write a complete, runnable HTML file matching the pattern in Chapter 5.
  3. Open the file, run FIELD, turn the knob (or tilt your phone) and check it live.See the sketch react immediately — no compiling, no server.
  4. Building custom hardware instead? Paste AI-PLUGINS.md and describe your exact sensor chip — the agent writes the .field-plugin.json file, following the same rules as the plugin-writing guide.See a plugin file you install through Connect → Plugins, no code review needed.
Why the specs read strangely

Both files are written as a strict contract, not a tutorial: exact role names, exact function signatures, an explicit Do/Don't list. That's deliberate — it's what keeps an agent from inventing role names or wire formats that don't exist in FIELD.

Chapter 7

Get the spec your agent needs.

Download whichever matches what you're building, and paste it straight into your agent's chat.

Prefer to read the plugin format yourself first, step by step? See the human-readable plugin guide — it walks through the exact same spec with a worked example of its own.

You can build with an agent now

One example, two specs, no build step.

An ESP32 sends a number, FIELD applies your Cue, a p5.js sketch draws it — and an AI agent can write either end for you once it has the right spec.

  • Wire a real sensor to a board and draw one Cue (Chapters 3–4).
  • Hand an agent AI-JS.md and describe a sketch in one sentence.
  • Hand an agent AI-PLUGINS.md and describe a sensor chip it doesn't know.
  • Keep both specs open in your agent's context while you iterate — they're small on purpose.

← Back to Your First FIELD  ·  Add a custom sensor  ·  FIELD home

Chapter 1 / 9