Spore pairs a small, portable solver with SSC (Spore System Configuration), a declarative language for describing which combinations of characteristics a device can legally have. Every value is either committed - a user pick, a policy default, or a live sensor reading - or derived, meaning a domain narrowed by constraints and recomputed fresh on every solve; keeping the two separate is what lets sensor input, human input, and inference coexist without overwriting each other. The solver itself never touches I/O: it only decides which combination is legal and what must follow from it, while sensors, actuators, and the UI sit in a thin host layer around it. Because it reasons only from the KB's own constraints rather than external business data, the solver determines legality alone, leaving price, BOM, and routing to whatever system already owns that data.
SPORE: Small Portable sOlver for Reactive Embedded-systems - the same portable engine.c whether it's reacting to a sensor on a chip or running right here in the browser.
engine.c is plain, allocation-free C11 - about 1560 lines, no struct pointers, no malloc, just a single bump-allocated heap[]. The same file compiles with gcc for a PC, emcc for WebAssembly in the browser, avr-gcc for a microcontroller - a real ATtiny1614 with 2 KB of RAM, 800-byte heap - and the ESP-IDF toolchain for an ESP32-C3, unmodified on every target.
A characteristic is either committed (a user pick, a policy default, or a sensor reading) or derived (a domain narrowed by constraints and recomputed fresh on every solve). The split keeps sensor input, human input, and inference from ever fighting each other.
A slot marked observed is a live reading, written with no admission gate: a sensor reports what the world already is, so the engine has no basis to reject it the way it rejects an illegal stored pick. applied is the opposite direction: the host reads the solver’s answer and drives a relay, LED, or PWM. Unmarked slots are user or policy input.
A characteristic declares a typed slot (SINGLE, MULTI, or RANGE). A class groups them. Constraints narrow what is legal; procedures write values; preconditions hide or require a slot; a variant table is a row-wise fact instead of a hand-written condition.
characteristic MODE {
names EN "Mode"
textLength 8
values
'ECO' names EN "Eco",
'COMFORT' names EN "Comfort",
'BOOST' names EN "Boost"
}
class Thermostat {
characteristics
TEMP observed,
MODE defaultValues ['ECO'],
FAN noinput applied
}
constraint fan_high_CS {
objects:
?t is_a Thermostat
condition:
?t.MODE = 'BOOST'
restrictions:
?t.FAN in ['HIGH']
}On a microcontroller, the compiled .kb.img lives in its own flash slot, separate from the firmware - the solver and its host code don't change when what a device is allowed to configure does. A board only needs flashing once; after that, changing its legal combinations is a KB upload over UART (KB_BEGIN/KB_DATA/KB_END framing, acknowledged chunk by chunk), not a firmware rebuild.
The whole engine is five small, dependency-free C files: engine.c and kb_loader.c, plus the headers they need (engine.h, format.h, kb_schema.h) - the same source this site's own configurator demo compiles to WebAssembly. Also included: a minimal main.c that loads a compiled .kb.img from the command line and prints the settled configuration.
MIT licensed - free to use, modify, and ship. The compiler requires Node.js - node ssc.js <project-dir>.
An agent that wants to author and test a KB against the real solver, not just read about it, can use the MCP server at spore.mipem.co/mcp - public, no auth, no local toolchain required.