{
  "notes": "EPISODE 8 (goal: lift NP2 on Paradigm AMM fee challenge; need paired +5.8 for top 10, +9.6 for 1st vs NP2 526.1156 on seeds 0..999; paired = each strategy SEPARATELY vs Vanilla on the same seeds, d = edge(cand) - edge(NP2) per seed).\nSTATE AT START (~19:30Z): handed 18 results, all valid separate-vs-Vanilla unless said. Still running: ep7-stack stack-a/b, ep7-mix mix-a/b, ep7-late later-a + unc-b, ep6-oracle ceil-a/b, ep5-mech 9 (silence/evfee/nextmix and the -b copies), ep5-err err-a, ep3-base decomp, stragglers. No refusals, no stalls. Items 64 used before this episode, +19 = 83 of 400; 2 episodes left after this (9, 10). Requester 19:11Z: promote later-b to the base; sweep the three pHat alphas on >=2,000 seeds a cell; stack with skew-off and prespot; confirm the stack on 4,000 fresh seeds, two items.\nRESULTS (confirm block, n 2000 unless said):\nWINNER ep7-late/later-b: PHAT_ALPHA_RETAIL 0.06 -> 0.03 (the one semantic change; code sha256 91fe9cb4... also rewrites the 90/10 blend with explicit WAD weights, same values): +0.105 se 0.0096 on 2810000..2811999; arb +1.42, retail -1.32. Its 240-seed grid: A=0 (no later update) with blend -0.94, without blend -1.60; A=0 B=0.12 -0.086; A=0.03 B=0.09 +0.087; A=0.03 B=0.12 +0.141; blend 0.075 < 0.1; stale 6850 / attract 1.05 (NP2's) stayed best. So later retail prints must still move pHat a little; the question is how little.\nMARGINAL ep5-mech/prespot-a: for prints with amountY/reserveY >= 1%, recover the pre-trade reserves (undo the fee-adjusted change) and blend pHat 95/5 toward preY/preX after the routing block: +0.025 se 0.0145 (t 1.7) on 2590000..; tuning n 768 +0.024 se 0.008. Candidate for the stack only.\nLOST: ep7-mix hard-a -2.44 se 0.033 (T 1.75, wA 0.5, wR 0.1, g=0 required; every grid point negative), hard-b -2.62 se 0.038 (arb +2.0 but retail -4.6): a BIG first-print alpha (0.5) for arb-like prints loses even with the shift retuned; the mixture family (mix-a/b, still running) is expected to lose too. ep7-late/unc-a (Kalman-style variance through silence) -4.44 se 0.046. ep5-mech kalman-a -3.22 se 0.038; arbfirst-a -0.14 se 0.017 (best grid point barely below NP2). ep6-mech shrink-a/b: every K>0 loses -23 and worse; frozen at K=0 = NP2 (0.0). sitshift-a -0.003 se 0.009, sitshift-b -0.017 se 0.007 (class-specific TRADE_TOX_BOOST 4375/2625 did not transfer; stale/attract by class stayed at NP2). ep6-oracle ev-a -5.13 se 0.06, ev-b -5.26 se 0.065 (affine gap fees with the TRUE price lose 4.8 of retail: the affine form is not a ceiling; NP2's flow/tox/size terms are worth more than exact p). ep5-oracle oracle-price-c (true price as pHat, no retune) -5.40, oracle-full-c -33.6 (confirm ep3-oracle). Old: ep1-mech/merge-01 (4 big losses, head-to-head era), ep4-flow flat-b -0.075 se 0.03 vanilla diagnostic (its +24.6 was head-to-head), both-a -1.87 se 0.048.\nLESSON: every rewrite of the estimator (Kalman, mixture, hard cutoff, variance growth, noise shrink, class shifts) loses by 0.1 to 5; the only gains are small changes to NP2's own gains (later-b +0.105, prespot +0.025, skew-off +0.06 on 200 seeds). The +5.8 target is out of reach of this family; the write-up must say so and ship the best confirmed stack.\nDECIDED (19 items, 4 batches, no cancel):\n- ep8-sweep-f22 / -f27 / -f32 (5 items each, keys r0 r01 r02 r03 r04): one item = NP2 with PHAT_ALPHA_RETAIL in {0,.01,.02,.03,.04} (item), PHAT_ALPHA (first print) in {0.22, 0.27, 0.32} (batch) and three PHAT_ALPHA_SAME cells {0.09, 0.12, 0.16}, each measured vs NP2 on the COMMON seeds 10000..11999 (n 2000) with no confirm block; 45 cells in all, comparable across items (every item also reports np2_mean_10000_11999, which must agree across machines). Cell (0.03, 0.27, 0.12) is later-b itself.\n- ep8-stack (4): stack-a/b = V1 BASE (NP2 + RETAIL 0.03), V2 BASE+SKEW-OFF (DIR_COEF = DIR_TOX_COEF = 0), V3 BASE+PRESPOT (prespot-a's edit), V4 all three, on 10000..11999, best confirmed on 2860000 / 2870000; blend-a/b = the interior-routing blend weight {0.15, 0.20, 0.30} and gate 20 bps on BASE, best confirmed on 2880000 / 2890000.\nTEMPLATE (word for word in artifacts/goal/episodes/008/decisions.json): NP2 def; SETUP with the requester's 1159-char no-gate script (\"this script, not the objective's\"); MEASURE (default_rng draws, build_config, Vanilla, run_batch SEPARATELY <=20 seeds a call, NEVER run_batch(cand,np2), constants as WAD int(round(v*1e18)), amm-match validate); TASK; RETURN json. The template without TASK/RETURN is ~2300 chars; filled briefs are <= 3000. ep8-stack carries TASK and RETURN as item vars.\nCONFIRM SEED BLOCKS (never reuse): ep1-mech 2000000..2229999; harness ep1 2900000..2909999; ep2-oracle 2230000..2249999; ep3-base 2250000..2253999 and 2260000..2263999; ep3-oracle 2270000..2289999; ep3-mech 2300000..2459999; ep4-flow 2460000..2499999; ep4-lean 2500000..2539999; ep5-oracle 2540000..2551999; ep5-mech 2560000..2679999 (10000 per item); ep6-oracle 2680000..2719999; ep6-mech 2720000..2759999; ep7-mix 2760000..2799999; ep7-late 2800000..2839999; ep7-stack 2840000..2859999; ep8-stack stack-a 2860000, stack-b 2870000, blend-a 2880000, blend-b 2890000 (each ..+1999). NEXT FREE BLOCK: 2910000 (skip 2900000..2909999; allocate 10000 per item). Tuning seeds 10000..99999; ep8 uses 10000..11999 as the common block.\nREADS REQUESTED for ep9 (30): the 15 sweep items; ep8-stack x4; ep7-stack/stack-a, stack-b; ep7-mix/mix-a, mix-b; ep7-late/later-a, unc-b; ep6-oracle/ceil-a, ceil-b; ep5-mech/merge-01, merge-02; ep5-err/err-a.\nEP9 PLAN: (a) Check methods and `blocked` first. (b) Sweep: tabulate the 45 cells (same seeds, so differences between cells are nearly noise-free relative to NP2's se); pick the cell with the highest mean_diff; if a neighbour is within 1 se prefer the one nearest (0.03, 0.27, 0.12). Confirm the np2_mean_10000_11999 agrees across items (else a machine's harness is off: drop it). (c) Stack: take the variant both stack items confirm with mean_diff >= 2 se; drop prespot or skew-off if their ablation adds < 2 se. Take the blend change only if both blend items confirm it. (d) Spawn ep9-final (2 items, two machines, blocks 2910000..2913999 and 2920000..2923999): FINAL = NP2 + best sweep constants + the accepted stack parts; measure vs NP2 on 4,000 fresh seeds each; return code, sha256, paired{n,mean_diff,se,worst}, split if the item can instrument the engine. Optionally 2 more items re-tuning STALE_DIR_COEF {6000..7500} x STALE_ATTRACT_FRAC {0.95..1.15} on FINAL (later-b found NP2's values best after RETAIL 0.03, so low priority). Also read any late ep7 results (mix, later-a, unc-b, ep7-stack) for a surprise winner to fold in. (e) EP10: read ep9-final; set finish true; the write-up gives FINAL's code, sha256, paired{n,mean_diff,se,worst} vs NP2 on 4,000 fresh seeds (expected about +0.1 to +0.25, far below +5.8), the lesson above, and the ceiling figures (true price alone -5.4; ev affine fees -5.1; gap+g fees -33.6) as what is missing. The requester submits any file >= +1.0 over NP2 on 4,000 fresh seeds; FINAL is below that, so the write-up must say the board rank will not move and recommend the file only as a safe +0.1.\nCH = ChengHua926/amm-challenge Strategy.sol @d34a5199 (525.525882178 reproduced by many workers); NP2 sha256 51f1c1a9d4999ee460eb8bbc66880da8074b173399a4f5d71f96671482e18ac0; later-b sha256 91fe9cb4553c4781f1c6e1ac3d5a036e5c0ebe09bd4ed67a2f4c059647e54fcc; prespot-a sha256 3ce21d811b5440456116b7d848e36c7938863ababf10dd028d710ed35c633e3d.",
  "spawn": [
    {
      "name": "ep8-sweep-f22",
      "brief": "NP2 = `code` at https://api.imd.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with `code` at https://api.imd.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before its `uint256 tradeRatio =`; sha256 51f1c1a9...; 526.1156 on 0..999 (check).\nSETUP (this script, not the objective's): clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace; save as scratch/setup.sh; `sh scratch/setup.sh` once at the checkout root; then `. scratch/env.sh && ...`:\nset -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx\necho \"export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy RUSTUP_HOME=$R/rustup CARGO_HOME=$R/cargo SOLCX_BINARY_PATH=$R/solcx VIRTUAL_ENV=$PWD/.venv PATH=$PWD/.venv/bin:$R/bin:$R/cargo/bin:\\$PATH\" >$R/env.sh;. $R/env.sh\ncommand -v uv >/dev/null||{ curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz|tar --no-same-owner -xz -C $R/tmp;cp $R/tmp/uv-*/uv $R/bin/;}\ncc --version >/dev/null 2>&1||{ curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest -o $R/tmp/mm.tbz;python3 -c \"import sys,tarfile;tarfile.open(sys.argv[1]).extract('bin/micromamba',sys.argv[2])\" $R/tmp/mm.tbz $R;MAMBA_ROOT_PREFIX=$R/mamba $R/bin/micromamba create -yq -p $R/cenv -c conda-forge gcc;ln -sf $(ls $R/cenv/bin/*gcc|head -n1) $R/bin/cc;}\ncommand -v cargo >/dev/null||{ curl -sSf https://sh.rustup.rs|sh -s -- -y --profile minimal --no-modify-path;}\nuv venv --python 3.12 .venv;uv pip install -e . maturin\nmaturin develop --release --uv --manifest-path amm_sim_rs/Cargo.toml\namm-match validate contracts/src/StarterStrategy.sol\nOn failure: blocked={step,error}.\nMEASURE: seed s: g=default_rng(s); size=g.uniform(19,21); rate=g.uniform(.6,1); sigma=g.uniform(.000882,.001008); build_config(seed=s,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size). vanilla=get_vanilla_bytecode_and_abi()[0]. run_batch(cand,vanilla,cfgs,8) and run_batch(np2,vanilla,cfgs,8) SEPARATELY (<=20 seeds a call), NEVER run_batch(cand,np2); d = cand - NP2 edges[\"submission\"]; mean_diff, se=std(d,ddof=1)/sqrt(n), worst=5 lowest d+seeds. WAD int(round(v*1e18)); amm-match validate.\nTASK: three candidates = NP2 with PHAT_ALPHA_RETAIL={{retail}}, PHAT_ALPHA={{first}} (first print) and PHAT_ALPHA_SAME in {0.09, 0.12, 0.16}; nothing else changes. Measure each vs NP2 on seeds 10000..11999 (n 2000, same seeds, one NP2 run). No confirm block: this is a grid-cell measurement; the stack step confirms. (RETAIL 0.03 alone: +0.105 se 0.0096 on 2000 fresh seeds.)\nRETURN json: {np2_check, np2_mean_10000_11999, cells:[{retail,same,first,n,mean_diff,se,worst,sha256}], best_cell, code (full Solidity of the best cell), blocked, next}.",
      "items": [
        {
          "key": "r0",
          "vars": {
            "retail": "0",
            "first": "0.22"
          }
        },
        {
          "key": "r01",
          "vars": {
            "retail": "0.01",
            "first": "0.22"
          }
        },
        {
          "key": "r02",
          "vars": {
            "retail": "0.02",
            "first": "0.22"
          }
        },
        {
          "key": "r03",
          "vars": {
            "retail": "0.03",
            "first": "0.22"
          }
        },
        {
          "key": "r04",
          "vars": {
            "retail": "0.04",
            "first": "0.22"
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 64000
      }
    },
    {
      "name": "ep8-sweep-f27",
      "brief": "NP2 = `code` at https://api.imd.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with `code` at https://api.imd.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before its `uint256 tradeRatio =`; sha256 51f1c1a9...; 526.1156 on 0..999 (check).\nSETUP (this script, not the objective's): clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace; save as scratch/setup.sh; `sh scratch/setup.sh` once at the checkout root; then `. scratch/env.sh && ...`:\nset -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx\necho \"export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy RUSTUP_HOME=$R/rustup CARGO_HOME=$R/cargo SOLCX_BINARY_PATH=$R/solcx VIRTUAL_ENV=$PWD/.venv PATH=$PWD/.venv/bin:$R/bin:$R/cargo/bin:\\$PATH\" >$R/env.sh;. $R/env.sh\ncommand -v uv >/dev/null||{ curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz|tar --no-same-owner -xz -C $R/tmp;cp $R/tmp/uv-*/uv $R/bin/;}\ncc --version >/dev/null 2>&1||{ curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest -o $R/tmp/mm.tbz;python3 -c \"import sys,tarfile;tarfile.open(sys.argv[1]).extract('bin/micromamba',sys.argv[2])\" $R/tmp/mm.tbz $R;MAMBA_ROOT_PREFIX=$R/mamba $R/bin/micromamba create -yq -p $R/cenv -c conda-forge gcc;ln -sf $(ls $R/cenv/bin/*gcc|head -n1) $R/bin/cc;}\ncommand -v cargo >/dev/null||{ curl -sSf https://sh.rustup.rs|sh -s -- -y --profile minimal --no-modify-path;}\nuv venv --python 3.12 .venv;uv pip install -e . maturin\nmaturin develop --release --uv --manifest-path amm_sim_rs/Cargo.toml\namm-match validate contracts/src/StarterStrategy.sol\nOn failure: blocked={step,error}.\nMEASURE: seed s: g=default_rng(s); size=g.uniform(19,21); rate=g.uniform(.6,1); sigma=g.uniform(.000882,.001008); build_config(seed=s,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size). vanilla=get_vanilla_bytecode_and_abi()[0]. run_batch(cand,vanilla,cfgs,8) and run_batch(np2,vanilla,cfgs,8) SEPARATELY (<=20 seeds a call), NEVER run_batch(cand,np2); d = cand - NP2 edges[\"submission\"]; mean_diff, se=std(d,ddof=1)/sqrt(n), worst=5 lowest d+seeds. WAD int(round(v*1e18)); amm-match validate.\nTASK: three candidates = NP2 with PHAT_ALPHA_RETAIL={{retail}}, PHAT_ALPHA={{first}} (first print) and PHAT_ALPHA_SAME in {0.09, 0.12, 0.16}; nothing else changes. Measure each vs NP2 on seeds 10000..11999 (n 2000, same seeds, one NP2 run). No confirm block: this is a grid-cell measurement; the stack step confirms. (RETAIL 0.03 alone: +0.105 se 0.0096 on 2000 fresh seeds.)\nRETURN json: {np2_check, np2_mean_10000_11999, cells:[{retail,same,first,n,mean_diff,se,worst,sha256}], best_cell, code (full Solidity of the best cell), blocked, next}.",
      "items": [
        {
          "key": "r0",
          "vars": {
            "retail": "0",
            "first": "0.27"
          }
        },
        {
          "key": "r01",
          "vars": {
            "retail": "0.01",
            "first": "0.27"
          }
        },
        {
          "key": "r02",
          "vars": {
            "retail": "0.02",
            "first": "0.27"
          }
        },
        {
          "key": "r03",
          "vars": {
            "retail": "0.03",
            "first": "0.27"
          }
        },
        {
          "key": "r04",
          "vars": {
            "retail": "0.04",
            "first": "0.27"
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 64000
      }
    },
    {
      "name": "ep8-sweep-f32",
      "brief": "NP2 = `code` at https://api.imd.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with `code` at https://api.imd.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before its `uint256 tradeRatio =`; sha256 51f1c1a9...; 526.1156 on 0..999 (check).\nSETUP (this script, not the objective's): clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace; save as scratch/setup.sh; `sh scratch/setup.sh` once at the checkout root; then `. scratch/env.sh && ...`:\nset -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx\necho \"export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy RUSTUP_HOME=$R/rustup CARGO_HOME=$R/cargo SOLCX_BINARY_PATH=$R/solcx VIRTUAL_ENV=$PWD/.venv PATH=$PWD/.venv/bin:$R/bin:$R/cargo/bin:\\$PATH\" >$R/env.sh;. $R/env.sh\ncommand -v uv >/dev/null||{ curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz|tar --no-same-owner -xz -C $R/tmp;cp $R/tmp/uv-*/uv $R/bin/;}\ncc --version >/dev/null 2>&1||{ curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest -o $R/tmp/mm.tbz;python3 -c \"import sys,tarfile;tarfile.open(sys.argv[1]).extract('bin/micromamba',sys.argv[2])\" $R/tmp/mm.tbz $R;MAMBA_ROOT_PREFIX=$R/mamba $R/bin/micromamba create -yq -p $R/cenv -c conda-forge gcc;ln -sf $(ls $R/cenv/bin/*gcc|head -n1) $R/bin/cc;}\ncommand -v cargo >/dev/null||{ curl -sSf https://sh.rustup.rs|sh -s -- -y --profile minimal --no-modify-path;}\nuv venv --python 3.12 .venv;uv pip install -e . maturin\nmaturin develop --release --uv --manifest-path amm_sim_rs/Cargo.toml\namm-match validate contracts/src/StarterStrategy.sol\nOn failure: blocked={step,error}.\nMEASURE: seed s: g=default_rng(s); size=g.uniform(19,21); rate=g.uniform(.6,1); sigma=g.uniform(.000882,.001008); build_config(seed=s,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size). vanilla=get_vanilla_bytecode_and_abi()[0]. run_batch(cand,vanilla,cfgs,8) and run_batch(np2,vanilla,cfgs,8) SEPARATELY (<=20 seeds a call), NEVER run_batch(cand,np2); d = cand - NP2 edges[\"submission\"]; mean_diff, se=std(d,ddof=1)/sqrt(n), worst=5 lowest d+seeds. WAD int(round(v*1e18)); amm-match validate.\nTASK: three candidates = NP2 with PHAT_ALPHA_RETAIL={{retail}}, PHAT_ALPHA={{first}} (first print) and PHAT_ALPHA_SAME in {0.09, 0.12, 0.16}; nothing else changes. Measure each vs NP2 on seeds 10000..11999 (n 2000, same seeds, one NP2 run). No confirm block: this is a grid-cell measurement; the stack step confirms. (RETAIL 0.03 alone: +0.105 se 0.0096 on 2000 fresh seeds.)\nRETURN json: {np2_check, np2_mean_10000_11999, cells:[{retail,same,first,n,mean_diff,se,worst,sha256}], best_cell, code (full Solidity of the best cell), blocked, next}.",
      "items": [
        {
          "key": "r0",
          "vars": {
            "retail": "0",
            "first": "0.32"
          }
        },
        {
          "key": "r01",
          "vars": {
            "retail": "0.01",
            "first": "0.32"
          }
        },
        {
          "key": "r02",
          "vars": {
            "retail": "0.02",
            "first": "0.32"
          }
        },
        {
          "key": "r03",
          "vars": {
            "retail": "0.03",
            "first": "0.32"
          }
        },
        {
          "key": "r04",
          "vars": {
            "retail": "0.04",
            "first": "0.32"
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 64000
      }
    },
    {
      "name": "ep8-stack",
      "brief": "NP2 = `code` at https://api.imd.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with `code` at https://api.imd.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before its `uint256 tradeRatio =`; sha256 51f1c1a9...; 526.1156 on 0..999 (check).\nSETUP (this script, not the objective's): clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace; save as scratch/setup.sh; `sh scratch/setup.sh` once at the checkout root; then `. scratch/env.sh && ...`:\nset -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx\necho \"export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy RUSTUP_HOME=$R/rustup CARGO_HOME=$R/cargo SOLCX_BINARY_PATH=$R/solcx VIRTUAL_ENV=$PWD/.venv PATH=$PWD/.venv/bin:$R/bin:$R/cargo/bin:\\$PATH\" >$R/env.sh;. $R/env.sh\ncommand -v uv >/dev/null||{ curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz|tar --no-same-owner -xz -C $R/tmp;cp $R/tmp/uv-*/uv $R/bin/;}\ncc --version >/dev/null 2>&1||{ curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest -o $R/tmp/mm.tbz;python3 -c \"import sys,tarfile;tarfile.open(sys.argv[1]).extract('bin/micromamba',sys.argv[2])\" $R/tmp/mm.tbz $R;MAMBA_ROOT_PREFIX=$R/mamba $R/bin/micromamba create -yq -p $R/cenv -c conda-forge gcc;ln -sf $(ls $R/cenv/bin/*gcc|head -n1) $R/bin/cc;}\ncommand -v cargo >/dev/null||{ curl -sSf https://sh.rustup.rs|sh -s -- -y --profile minimal --no-modify-path;}\nuv venv --python 3.12 .venv;uv pip install -e . maturin\nmaturin develop --release --uv --manifest-path amm_sim_rs/Cargo.toml\namm-match validate contracts/src/StarterStrategy.sol\nOn failure: blocked={step,error}.\nMEASURE: seed s: g=default_rng(s); size=g.uniform(19,21); rate=g.uniform(.6,1); sigma=g.uniform(.000882,.001008); build_config(seed=s,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size). vanilla=get_vanilla_bytecode_and_abi()[0]. run_batch(cand,vanilla,cfgs,8) and run_batch(np2,vanilla,cfgs,8) SEPARATELY (<=20 seeds a call), NEVER run_batch(cand,np2); d = cand - NP2 edges[\"submission\"]; mean_diff, se=std(d,ddof=1)/sqrt(n), worst=5 lowest d+seeds. WAD int(round(v*1e18)); amm-match validate.\n{{task}}\n{{ret}}",
      "items": [
        {
          "key": "stack-a",
          "vars": {
            "task": "TASK: BASE = NP2 with PHAT_ALPHA_RETAIL 0.03. SKEWOFF: DIR_COEF = DIR_TOX_COEF = 0 (dirState still picks tail slopes). PRESPOT, after the routing block: if amountY/reserveY >= 1%: (pre-trade preX,preY = isBuy ? X-wmul(amountX,gamma), Y+amountY : X+amountX, Y-wmul(amountY,gamma); X,Y = post-trade reserves); pHat = 0.95*pHat + 0.05*preY/preX. V1=BASE, V2=+SKEWOFF, V3=+PRESPOT, V4=both. Measure V1..V4 vs NP2 on seeds 10000..11999 (n 2000); freeze the best; confirm once vs NP2 on {{block}}..{{block}}+1999 (fresh).",
            "ret": "RETURN json: {np2_check, variants:[{name,n,mean_diff,se,worst,sha256}], chosen, paired{n,mean_diff,se,worst}, code, sha256, blocked, next}.",
            "block": "2860000"
          }
        },
        {
          "key": "stack-b",
          "vars": {
            "task": "TASK: BASE = NP2 with PHAT_ALPHA_RETAIL 0.03. SKEWOFF: DIR_COEF = DIR_TOX_COEF = 0 (dirState still picks tail slopes). PRESPOT, after the routing block: if amountY/reserveY >= 1%: (pre-trade preX,preY = isBuy ? X-wmul(amountX,gamma), Y+amountY : X+amountX, Y-wmul(amountY,gamma); X,Y = post-trade reserves); pHat = 0.95*pHat + 0.05*preY/preX. V1=BASE, V2=+SKEWOFF, V3=+PRESPOT, V4=both. Measure V1..V4 vs NP2 on seeds 10000..11999 (n 2000); freeze the best; confirm once vs NP2 on {{block}}..{{block}}+1999 (fresh).",
            "ret": "RETURN json: {np2_check, variants:[{name,n,mean_diff,se,worst,sha256}], chosen, paired{n,mean_diff,se,worst}, code, sha256, blocked, next}.",
            "block": "2870000"
          }
        },
        {
          "key": "blend-a",
          "vars": {
            "task": "TASK: BASE = NP2 with PHAT_ALPHA_RETAIL 0.03. Its routing block (`if (!firstInStep && feeUsed > 30 * BPS && gamma > 0)`) sets pHat = 0.9*pHat + 0.1*normalSpot. Candidates: w in {0.15, 0.20, 0.30} in place of 0.1; and w=0.1 with gate feeUsed > 20 * BPS. Measure BASE and the four vs NP2 on seeds 10000..11999 (n 2000, one NP2 run). Freeze the highest mean_diff (BASE unless one beats it by 2 se); confirm once vs NP2 on {{block}}..{{block}}+1999 (fresh).",
            "ret": "RETURN json: {np2_check, variants:[{name,w,gate_bps,n,mean_diff,se,worst,sha256}], chosen, paired{n,mean_diff,se,worst}, code (chosen, full), sha256, blocked, next}.",
            "block": "2880000"
          }
        },
        {
          "key": "blend-b",
          "vars": {
            "task": "TASK: BASE = NP2 with PHAT_ALPHA_RETAIL 0.03. Its routing block (`if (!firstInStep && feeUsed > 30 * BPS && gamma > 0)`) sets pHat = 0.9*pHat + 0.1*normalSpot. Candidates: w in {0.15, 0.20, 0.30} in place of 0.1; and w=0.1 with gate feeUsed > 20 * BPS. Measure BASE and the four vs NP2 on seeds 10000..11999 (n 2000, one NP2 run). Freeze the highest mean_diff (BASE unless one beats it by 2 se); confirm once vs NP2 on {{block}}..{{block}}+1999 (fresh).",
            "ret": "RETURN json: {np2_check, variants:[{name,w,gate_bps,n,mean_diff,se,worst,sha256}], chosen, paired{n,mean_diff,se,worst}, code (chosen, full), sha256, blocked, next}.",
            "block": "2890000"
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 64000
      }
    }
  ],
  "read": [
    "ep8-sweep-f22/r0",
    "ep8-sweep-f22/r01",
    "ep8-sweep-f22/r02",
    "ep8-sweep-f22/r03",
    "ep8-sweep-f22/r04",
    "ep8-sweep-f27/r0",
    "ep8-sweep-f27/r01",
    "ep8-sweep-f27/r02",
    "ep8-sweep-f27/r03",
    "ep8-sweep-f27/r04",
    "ep8-sweep-f32/r0",
    "ep8-sweep-f32/r01",
    "ep8-sweep-f32/r02",
    "ep8-sweep-f32/r03",
    "ep8-sweep-f32/r04",
    "ep8-stack/stack-a",
    "ep8-stack/stack-b",
    "ep8-stack/blend-a",
    "ep8-stack/blend-b",
    "ep7-stack/stack-a",
    "ep7-stack/stack-b",
    "ep7-mix/mix-a",
    "ep7-mix/mix-b",
    "ep7-late/later-a",
    "ep7-late/unc-b",
    "ep6-oracle/ceil-a",
    "ep6-oracle/ceil-b",
    "ep5-mech/merge-01",
    "ep5-mech/merge-02",
    "ep5-err/err-a"
  ],
  "cancel": [],
  "wake": {
    "batches": [
      "ep8-sweep-f22",
      "ep8-sweep-f27",
      "ep8-sweep-f32",
      "ep8-stack"
    ],
    "afterMinutes": 240
  },
  "finish": false
}
