Skip to main content

Adapter guide

An SCP adapter is three files. Nothing else is required.

embodiment.json

A static manifest the brain reads once. Plain JSON, no schema validation needed.
Keep it short. The brain prompt only needs enough to reason about constraints.

muscle.js

A subclass of SCPBody with one async method per tool. Tools are declared in static tools.
A few rules:
  • Static tools is the brain’s contract. The names must match the async method names exactly.
  • tick() runs every frame. Keep it cheap.
  • setState(patch) updates the data the aggregator sends to the brain.
  • emit(type, payload, priority) queues an event. Priorities are CRITICAL, HIGH, NORMAL, LOW.
  • evaluateOutcome(state) is optional. Return true, false, or null (skip). When you return a boolean, the body auto-reports to the pattern store and adaptive memory.

system-prompt.md

Plain prose telling the brain what your tools mean and when to use which.
The brain sees this as the system prompt, plus the live world state from the aggregator.

Common mistakes

Forgetting to declare a tool in static tools. A method named apply_force will not be callable unless static tools.apply_force is also declared. The brain only sees what is in static tools. Heavy work inside tick(). A 60Hz loop has a 16 ms budget. Move physics to a worker if it gets close. Not calling super.tick(). Stats and counters live in the base class. Treating the pattern store as global. Each body owns its own. Cross-body memory belongs in Plexa’s VerticalMemory. Returning structured objects from a tool that the brain has to parse. Tools return values for your own logging. The brain only sees the world state on the next tick.