phi — an action-frame rotation to apply to your
action’s (x, y).
This is how Megan does
learning to fix itself on-device:
the whole bandit + gating runs server-side as the real megantk; your client
only ships the latest progress number and applies the returned phi.
How it works
On a stall (progress flat forpatience steps) the governor opens a trial:
it applies a candidate rotation, measures the real progress gain over an
evaluation window, credits that candidate, and keeps the best. The learned
correction is imposed at the start of every episode and carried across
episodes — competence accumulates with no labels and no retraining. When it finds
the rotation that cancels the shift, progress resumes.
Opening a governor
governor() returns a Governor. It’s a context manager — prefer with so it
is always closed on the server:
The loop — episode_start + step
Call episode_start() once per episode (it imposes the correction learned so far),
then each control step send the live progress and apply the returned phi.
step() returns the rotation directly. Use step_full() if you also want whether a
trial is currently being scored:
The governor uses only the step-to-step gains of
progress, so its scale and
offset don’t matter — any signal that rises as the task improves works (e.g.
-distance_to_goal, a task reward, or -error). You never tell it the shift angle;
it discovers the correction purely from whether progress improves.Inspecting and closing
best_phi is the correction it has learned (carried across episodes). The server
holds the live governor object, so close governors you’re done with — the with
form does this for you.
A full recovery loop
best_phi converges on the rotation that cancels the shift and
the policy — untouched, frozen — starts completing the task again.
Next
Token sessions
Milestone / perception governance — continue vs. adapt.
SDK reference
Every method, argument, and return type.