{"wiki":null,"facts":{"id":"el-ri-01","name":"Initiative Review Inferer","machine_name":"EL-RI-01","owner":"agt_011","function":"Infers the reviewing transition: when a plan step flips to done and all steps in its phase are done with no prior review, flips the initiative status to reviewing","process_type":"triggered","schedule":"On plan-step update (step flips to done)","process_name":"initiative_review_inference","avatar_color":"#10b981","created_for":"Elrond is accountable for the build pipelines review machinery. When a plan steps completion finishes a phase, the inference that moves the initiative into the reviewing state must be performed by a named, accountable droid rather than loose logic inside the initiatives app (Design #146 / #173, cookbook 272, CAROL-INI-867 phase 5).","purpose":"The Initiative Review Inferer infers the reviewing transition. When a plan step is marked done it re-reads the steps committed status, counts the steps in that steps phase, and if every step in the phase is done AND no initiative_reviews row exists yet for that phase it flips the initiatives status to reviewing - exactly as it ran inside the app before phase 5. It does NOT review anything itself (that is the reviewer droid sr-01); it only INFERS the reviewing flip that the Manager then reads to trigger the reviewer. Carries its own DB handle so it is self-contained.","duties":"- Triggered whenever a plan step is updated through the initiatives app plan-step endpoint, after the step status commit.\n- Re-reads the steps committed status and only proceeds when it is done.\n- Counts the phases steps and checks whether every step in the phase is done.\n- Checks for an existing review row for that phase before doing anything.\n- Flips the initiative to status reviewing only when the phase is fully done and no review exists yet.\n- Records a session_event and a Palantir post whenever it actually flips to reviewing.","constraints":"- Owns and closes its own database connections; never relies on a callers connection.\n- Runs AFTER the plan-step status commit (commit step first, then infer) to avoid a WAL write race.\n- Behavior is preserved exactly from the app (phase 5 is a relocation, not a refactor) modulo the self-contained-connection transform and re-reading the committed step status instead of the request payload.\n- Never raises; returns a structured dict and is best-effort.\n- Reached only through the initiatives apps shared shim, never imported by the app directly.\n- Does not review (that is sr-01); it only infers the reviewing flip. Does not touch the bypass book, cookbook, or initiative status rows beyond the reviewing flip the original logic performed.","status":"running","gender":"male","archetype":"reviewer","building_block":"review_initiative","service_override":null}}