DreamLayer is an open source memory layer for AR glasses (Apache-2.0). It has a plugin system, called lenses, and the smallest complete one is about 25 lines of Python. Here's the whole thing, start to finish, no hardware required.
What a plugin actually is
A plugin is a register(ctx) function plus a factory that wraps it:
from dreamlayer.plugins import make_plugin
def draw_hello_card(draw, card): # fn(draw, card): paint the 256px glass
draw.text((128, 118), card.get("text", "hello, world"),
fill=(44, 199, 154, 255), anchor="mm")
def register(ctx):
ctx.add_card_renderer("HelloCard", draw_hello_card)
def make(): # the manifest's entry point
return make_plugin("hello-lens", register, requires=("cards",))
That's it. ctx is a narrow context object, a plugin can extend the registries and read a couple bits of state, and nothing else. requires names the capabilities you actually need (cards, vision, network, mesh, shop, and a handful more), and the host grants or skips your plugin based on that, cleanly.
Run it locally
pip install -e "host-python[dev]"
cd host-python && python -m pytest -q -k hello_lens
Or use the CLI directly, from the plugin's folder:
dreamlayer plugins validate . # runs the full store gate
dreamlayer plugins preview . # renders your card through the real 256px glass
No glasses needed for any of this. There's also a browser simulator that runs the real renderer and orchestrator if you want to see it live: dreamlayer.app/simulator.html.
Package it
dreamlayer plugins pack . # -> a store-ready package JSON
This computes a checksum binding your manifest and module together, no manual hashing. Every install replays a validation gate: manifest shape, checksum integrity, a static scan proving your code never touches a capability it didn't declare, and a smoke load.
Ship it
Open a PR adding your plugin to the registry, or just share the package JSON, anyone can sideload it through the same gate from the control panel.
Scaffold a fresh one anytime with dreamlayer plugins new my-lens. Full quickstart in docs/SDK.md, full example folder at examples/hello-lens.
Copy it, rename everything, build the lens you wish existed.
Top comments (0)