Nodes, edges, and Command routing
A node is a function of state that returns a partial update. Edges wire the flow. START and END are the sentinels.
Command lets a node decide where to go next and what to write, together, instead of a static edge.
Your graph: a sense node (read the two sensor levels), a modulate node (modulateWeights), a roll node (rollDice returning a Command that goes to the face node), and four terminal nodes: continue, wild, personal, rest. The injectable random is your parity hook.
Try it yourself
Why injectable random matters
The point is the parity test against src/strategy/dice.ts, not general testability.
What would break about testing your graph's roll node if it called Math.random() directly instead of taking an injected random function?
Command vs addConditionalEdges for the roll node
Both Command and addConditionalEdges can route dynamically. Why is Command the better fit specifically for the roll node?
Port Impulse's cold-mode path into a StateGraph
Port the sense -> modulateWeights -> rollDice -> route path into an explicit, parity-tested StateGraph.
Tick every step to confirm you did it.
Dice roll parity confirmed
Confirm the ported graph reproduces the original dice logic exactly.
Same injected random seeds produce the same faces as src/strategy/dice.ts, and quota-warning / hot / warm modulation matches the original weight vectors exactly.