Local compiler extension demo

Local Motif Plugin ABI

Teams can register deterministic MotifPlugin implementations that lower custom motif intent into portable CompositionIR primitives without corrupting compiler invariants.

Plugin Boundary

from viewspec import compile
from viewspec.motif_plugins import MotifPlugin, create_motif_registry

risk_panel = MotifPlugin(
    kinds=("acme.risk_panel",),
    build=build_risk_panel,
)

registry = create_motif_registry(risk_panel)
ast = compile(bundle, motif_registry=registry)

Deterministic Lowering

Plugins are registered in an explicit MotifRegistry and run in-process. Each one declares the motif kinds it lowers, and its output remains portable CompositionIR.

This is not dynamic plugin discovery, filesystem plugin loading, remote code execution, or an untrusted sandbox. It is a local deterministic extension seam for compiler-owned motif lowering.

Portable Output

Emitters still render standard primitives. A custom motif such as financial_candlestick or acme.risk_panel can carry domain intent at the input edge, then lower into the same renderer-safe tree as built-in table, list, form, detail, and hero motifs.

Where It Fits

Motif plugins are part of the free local SDK. See the custom motif authoring guide for manifests and fixture checks.

Use this page as the architecture proof point; AppBundle V3 State IR is the flagship app-generation story.