lawsynth/plugins/scenario-exporter
caelum0x afe0d3f9b5 chore: untrack plugin build artifacts, ignore nested target/
The plugin agents' cargo runs created plugins/*/target/ build artifacts
that an auto-commit captured (2181 files). Root .gitignore only anchored
/target/ at the repo root; add **/target/ and untrack the artifacts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-17 13:44:09 +03:00
..
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00
2026-08-17 13:40:09 +03:00

scenario-exporter

A LawSynth scenario exporter plugin. It serializes a discovered scenario — a world plus the laws found for it — into a portable, deterministic artifact that another tool can archive, diff, or re-import.

Built against the stable lawsynth-plugin-api and dependency-free, so it compiles to a small wasm32-wasi artifact-writer that lawsynth-plugin-host can sandbox.

Supported formats

Format Media type Notes
ExportFormat::Json application/json Canonical, deterministically ordered JSON with full-precision numbers and correct string escaping.
ExportFormat::World text/plain; charset=utf-8 The var … / d(…)/dt = … grammar consumed by world-validator-wasi, enabling a clean round-trip.

Guarantees

  • Deterministic: serialization is a pure function of the scenario — the same input always yields byte-identical output.
  • Validated first: a scenario is structurally validated before any bytes are written, so the exporter never emits an artifact that would fail to re-import (matching arities, unique valid variable names, finite state, non-empty laws, a bounded id).
  • Immutable: the input scenario is never mutated.

Capabilities

plugin.toml declares artifact.write (it produces an artifact) and dataset.read (it reads a scenario). Declaration is not a grant — the host must include these in its granted policy (see specs/plugin-protocol/capabilities.md).

Quick start

cargo test --manifest-path plugins/scenario-exporter/Cargo.toml
cargo run  --manifest-path plugins/scenario-exporter/Cargo.toml --example basic

See docs/usage.md for the API and artifact formats.

License

Apache-2.0. See LICENSE.