tools

The Lagra workbench.

Three ways to drive the same engine: an agentic CLI harness for shell + agent loops, a desktop IDE for live scene work, and an MCP gateway so Claude Code / Codex / Albert can hold typed handles to a running World. Plus the projects catalog for extensions that live outside the kernel.

Quick setup

Pick the entry point that matches how you'd rather work. All three speak the same engine.

CLI harness

Drive scenes from any shell or agent loop. Writes a session ledger + verifier manifest per run.

# clone + install
git clone https://github.com/PimDeWitte/lagra-harness ~/dev/lagra-harness
cd ~/dev/lagra-harness && npm install

# verify the canonical oscillator
node bin/lagra-harness.mjs run \
  --scene solver_walkthrough_oscillator \
  --task "verify the canonical oscillator" \
  --max-iterations 1

Desktop IDE

Electron + React. Scene tree, live validator overlays, per-particle drill-down, and an embedded agent terminal.

# clone + run dev server
git clone https://github.com/PimDeWitte/lagra
cd lagra/crates/lagra-ide
npm install && npm run dev

# app launches with the scene tree
# on the left and the inspector on the right

MCP gateway

Wire the harness into Claude Code, Codex, or any MCP-capable client. Agents call typed tools against a live World.

# ~/.claude/config.json
{
  "mcpServers": {
    "lagra": {
      "command": "lagra-harness",
      "args": ["mcp"]
    }
  }
}

CLI harness · lagra-harness

A standalone agentic harness for Lagra scene work. Designed to run from a shell, the IDE, or behind an MCP / WebSocket gateway. Model-agnostic by design — the Lagra tool contract, session ledger, verifier manifest, and publish-link evidence all exist before any LLM policy is trusted.

The harness treats correctness as an artifact, not a chat claim. A scene is not done until a verifier manifest exists and the checks pass against the actual Lagra binary. Publishability is a separate claim: the scene must exist, carry wasm true, the landing repo must expose the /loader/<scene>.lagra entrypoint, the wasm bundle must exist and not be older than the source, and the verifier result must pass.

defaults · engine: ~/dev/qdesics/lagra-core · landing: ~/dev/lagra-landing · binary: $LAGRA_BINtarget/release/lagra

Commands

# run + verify an existing scene
lagra-harness run --scene NAME [--project PROJ] --task "…"

# construct a NEW scene from a base, with a policy file or command
lagra-harness run --mode construct \
  --scene BASE [--target-project PROJ] \
  [--policy-file policy.json | --policy-command CMD] \
  [--publish-build] --task "…"

# verify only (skip the construct/repair loop)
lagra-harness verify --scene NAME [--project PROJ] [--steps N]

# publish to the landing /loader/<name>.lagra entrypoint
lagra-harness publish --scene NAME [--build] [--handoff]

# plan a task without executing
lagra-harness plan  --task "…" [--scene NAME]

# print the full schema (for agent grounding)
lagra-harness schema --json

What each run writes

# .lagra-harness/sessions/<id>/
events.jsonl                # full event ledger
inspection.json             # scene shape + node counts
verifier.json               # Noether-derived checks + manifest
verifier-result.json        # PASS / FAIL per gate

# construct runs add:
base-inspection.json
policy-decision.json
working-document.json
repair-attempts.json        # if a repair loop ran

# publish runs add:
publish-build.json
publish-manifest.json
publish-handoff.{json,md}

Desktop IDE · crates/lagra-ide

Live scene work in an Electron + React shell that drives the same engine as the wasm demos. Validator overlays, per-particle drill-down, scene-source editing, and an embedded MCP agent terminal — all backed by the native Lagra runtime via IPC.

Scenes spawn sub-agents that hold a typed handle to the running World and register actions as typed InterventionKind events. The LagrangianGraph inspector renders every .lagra term as a Chrome-DevTools-style typed object tree; the Tree / node-graph view renders the same scene as Blueprint-style topology (preset → entities → forces → solver) wired with bezier connections.

crates/lagra-ide · Albert agent in the bottom terminal scene tree · inspector · MCP agent
LagrangianGraph inspector — typed-object tree of every .lagra term, with live frame timing + integrate cost updating each tick.
Tree / node-graph view — Blueprint-style scene topology: preset → entities → forces → solver wired with typed bezier connections.

MCP gateway

Claude Code, Codex, Albert — every agent speaks Lagra through the same MCP server the harness exposes. Tools are typed; arguments are validated against the schema; every call writes to the same session ledger as a CLI run.

Agents can run, verify, construct, and publish scenes; inspect a running World; register typed InterventionKind events; or drop directly into a scene's loader URL. Same contract, regardless of whether the caller is a human, a shell script, or an LLM.

Wire it up

# ~/.claude/config.json (Claude Code)
{
  "mcpServers": {
    "lagra": {
      "command": "lagra-harness",
      "args": ["mcp"],
      "env": {
        "LAGRA_ENGINE_ROOT": "~/dev/qdesics/lagra-core"
      }
    }
  }
}

Once connected, agents call

lagra.run        # step + verify a scene
lagra.verify     # run conservation / contract gates
lagra.construct  # build a new scene from a base + policy
lagra.publish    # push to /loader/<name>.lagra
lagra.inspect    # return scene shape + node counts
lagra.schema     # return the full tool schema

Projects

Extensions live in projects/ outside the kernel — each one ships its own .lagra presets, solvers, and entity types without bloating lagra-core. Add a new project by dropping a folder in.

avbd

Augmented Vertex Block Descent

Rigid-body contact via variational implicit Euler with augmented Lagrangian constraints. SIGGRAPH 2025 reference. Drives the 1000-block stack and Jenga demos.

optical_lagrangian

Maxwell / optics

Electromagnetic Lagrangian on the same kernel: gauge-field bonds, photon paths, optical chemistry coupling. Distillation target for laser + plasma scenes.

quantum_distillation

Qubit-Hamiltonian bridge

Translates Lagra scenes into qubit Hamiltonians for execution on IBM Fez. Run VQE-style optimization where the Lagrangian acts as the ansatz.

rigidformer

ML rigid-body surrogate

Transformer-style next-step predictor trained on Lagra rollouts. Each ML rollout is verified against the engine; gradients flow through the same kernel.

articraft

Imported articulated objects

MuJoCo-style joints + links as entity components. Lets external rig databases plug into Lagra scenes without re-authoring the dynamics.

fluid_dynamics

Lagrangian SPH / lattice fluids

Water surface + dam-break demos live here. Same harmonic-bond Lagrangian shared with the molecular scenes, retuned for fluid lattices.

→ full catalog in the repo under projects/