OpenProgram Docs

Rules and how they run

class Policy:
    on: set[str]          # event types watched
    lane: "gate" | "observer"
    cooldown_s: float     # silence after acting
    name: str             # defaults to the class name

    def evaluate(self, event, state) -> Action | None: ...
    def dedup_key(self, event, state) -> str: ...   # what counts as "the same situation"
gateobserver
MomentBefore: tool.before onlyAfter: any event
PathSynchronous, through the tool.before gateBus subscriber; state is folded first, then rules in on wake
SpeedFast: no LLM, no network, no state needing inferenceMay be slow, must never slow the Agent
ReturnsGate.allow(), Gate.deny(reason), Gate.ask(reason)Notify, Inject, Prepare
Several rules hitStrictest: deny, then ask, then allowEach acts
SubagentsCovered; the gate is outside the approval wrapper, so bypass cannot skip itCovered by the same stream

Both lanes: cooldown_s is checked against the event clock per dedup_key. A raising evaluate is logged and treated as no action.

Actions

ActionDesignToday
Gate.denyBlocks; the reason goes to the modelAs designed
Gate.askAsks the user through the approval flowBlocked like deny, with wording asking to allow by hand and retry
NotifyReminder that does not interruptproactive.notify WebSocket frame
InjectHint before the model's next round; the user is not disturbedRecords a proactive.inject event only; steering is not connected
PrepareRead-only background task checks first, then may NotifyRecords proactive.prepare_requested only; nothing runs it

Add a rule

  1. Write a class in openprogram/runtime/proactive/policies/ with on, lane and cooldown_s.
  2. Write evaluate.
  3. register_policy it (same name twice is ignored).

The engine, event stream and fold stay untouched. Interruption budgets and automatic breakers are out of scope; cooldown_s is the one knob. Mechanics of the gate: Event layer.

Implementation status

The engine, registry and three rules exist and are tested. install_proactive() and install_mvp_policies() are not called at worker start, so no rule runs in production.

Three template rules

Last updated · 2026-11-25