{
 "notes": "EPISODE 3 (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).\nSTATE AT START: handed ep1-rules/rules and ep1-rules/decomp: both ACCEPTED but BLOCKED at setup (workers refused the objective's script because of its `uname -sm`/`/proc/self/exe` gate line; paired n 0, no simulation). The rules item still delivered the exact simulator rules (see RULES below). ep1-rules/harness running with the same bad brief (expect blocked). ep1-mech: canary of 5 running on the bad brief, 18 held; a blocked result counts as accepted, so the canary would have released the 18 to waste. ep2-board (2, no simulator) waiting, fine. ep2-oracle (2) waiting but its brief points at the objective's script: would block. Requester note 16:39Z: put their mended script (same steps, no gate line) word for word in every brief; rerun rules/decomp simulations.\nDECIDED: cancel ep1-mech (saves 18 held items; its 5 canary results are worthless duplicates of blocked) and cancel ep2-oracle (respawned with the mended script). Spawn 3 batches, all carrying the mended script word for word (1159 chars) and telling items not to use the objective's script: ep3-base (3 items: decomp = NP2 arb/retail edge decomposition on seeds 0..199 incl. loss by gap and by preceding displacement; harness-a/harness-b = pair.py + NP2 check + speed + se calibration with +-5 bps on blocks 2250000..2253999 / 2260000..2263999); ep3-oracle (2: oracle-price, oracle-full; confirm blocks 2270000..2279999, 2280000..2289999); ep3-mech (16 items = 8 mechanisms x 2 machines, canary = first copy of step-exact, kalman, ev-fee, next-mix, router; then second copies, then silence, arb-cover, flow-regime x2; merge groups of 8 ranked by t, copying delta+sha256+code of items with mean_diff>=2se). Items used: 30 - 18 (cancel) + 21 = 33 of 400; 7 episodes left after this.\nMECHANISMS (keys -a/-b): step-exact (arb runs before retail, so the first print of a step gives fair exactly if arb or a band [s0(1-bid), s0/(1-ask)] if retail; classify by distance k*sigma*sqrt(1+gap)); kalman (lnP with variance, arb-implied vs band-midpoint measurement); silence (g silent steps => fair stayed in band: shrink pHat to band centre, cap uncertainty); ev-fee (grid-max of f*share(f)*flow - c*arbLoss with the exact router share formula); next-mix (blend TWO fees with arb-defence by P(next trade is retail) from Poisson(lambdaHat) and print count); router (after an arb print, fair exact and normalizer within +-30 bps: undercut on the favourable side by m bps while edge/unit >= emin); arb-cover (after retail print set exposed side to |d|+m*sigma*sqrt(1+1/lambda), other side minus a|d|); flow-regime (scale base/shifts/knee by (lambda*size/16)^b).\nRULES LEARNED (ep1-rules/rules, static, cited to engine.rs/arbitrageur.rs/router.rs/cfmm.rs): per step: price advances, then exactly one arb attempt on our pool and one on the normalizer, then all retail orders routed sequentially; afterSwap only on our prints, fees returned apply to the NEXT trade whatever it is; multiple trades in a step share timestamp t. Arb: trades iff strictly positive profit (no threshold), post-trade spot lands exactly at ga*p (we sold X) or p/gb (we bought X), so an arb print reveals fair exactly and silence means fair stayed inside [s*(1-bid), s/(1-ask)]. Retail split is SMOOTH, not all-or-nothing: r=sqrt(x1 g1 y1)/sqrt(x2 g2 y2), our input share = clamp((r(y2+g2 T)-y1)/(g1+r g2),0,T)/T; equal reserves R/T=500: 1bps->86.3%, 10->75.1%, 20->62.6%, 29->51.3%, 30->50%, 31->48.7%, 40->37.4%, 60->12.2%. So undercutting 30 bps is no cliff; the lever is the EV-optimal fee per side and exact tracking. Retail: N~Poisson(rate), size lognormal mean M sigma 1.2 (median 0.49M, E[size^2]=4.2M^2), 50/50 side; buy spends size Y, sell provides size/p X. Edge = sum over trades of (p_t*X_in - Y_out) or (Y_in - p_t*X_out) at the contemporaneous fair price (arb edge = -arb profit); not inventory PnL. Fee cap 0..1000 bps; invalid afterSwap return keeps prior fees. Draws: default_rng(seed) -> size U(19,21), rate U(0.6,1.0), sigma U(0.000882,0.001008); cfg.seed=seed; price Pcg64(seed), retail Pcg64(seed+1). run_batch(sub_bytecode, baseline_bytecode, configs, n_workers=0) -> results[j].edges[\"submission\"].\nCH: the objective's check \"CH on seeds 0..999 = 525.525882178\" names a strategy I cannot identify (repo contracts are AMMStrategyBase, IAMMStrategy, StarterStrategy, VanillaStrategy); briefs use the NP2 check 526.1156 instead.\nCONFIRM SEED BLOCKS (never reuse): ep1-mech 2000000..2229999 (cancelled, may have run); harness calibration ep1 2900000..2909999; ep2-oracle 2230000..2249999 (cancelled); ep3-base 2250000..2253999 and 2260000..2263999; ep3-oracle 2270000..2289999; ep3-mech item i (order: step-exact-a, kalman-a, ev-fee-a, next-mix-a, router-a, step-exact-b, kalman-b, ev-fee-b, next-mix-b, router-b, silence-a, arb-cover-a, flow-regime-a, silence-b, arb-cover-b, flow-regime-b) uses 2300000+i*10000..+9999. NEXT FREE BLOCK: 2460000 (allocate 10000 per item; skip 2900000..2909999).\nBRIEF BUDGET (hard, <=3000 filled): the common template (NP2 definition + setup with the 1159-char script + pairing) is ~2100 chars; ep3-mech leaves ~450 chars per mechanism text; the longest filled brief this episode is near 2990. Reuse these templates; cut before adding.\nREADS REQUESTED for ep4: ep1-rules/harness, ep2-board/top20-regimes, ep2-board/top20-families, ep3-base/decomp, harness-a, harness-b, ep3-oracle/oracle-price, oracle-full, ep3-mech/merge-01, merge-02.\nEP4 PLAN: (a) if ep3-mech canary paused or items came back blocked, read `failures`/blocked steps: if the rustup `curl|sh` line is refused, ask the requester (note) for a script variant that installs cargo from a tarball, and meanwhile rerun with itemsFrom both only once the script is fixed. (b) Rank mechanisms by t on confirm blocks; a mechanism whose two copies both show mean_diff>=2se is a winner; one copy positive and one not = retune once with the better copy's delta as the starting point. Drop t<1 on both copies. (c) Use oracle-price vs oracle-full to split the +9.6 into tracking vs fee-policy; if oracle-price is small, prioritise ev-fee/next-mix/router over step-exact/kalman. (d) Use ep2-board regime/family findings for second-generation mechanisms (side asymmetry, per-regime scaling). (e) ep5+: stack winners pairwise and all-together (each item = NP2 + winners' deltas, or artifact URLs if `handed` gives api.imdnotdead.fun/artifacts/<sha256> addresses), confirm each on a fresh block; keep ~100 items for ep7-9 stacking and a final 4,000-seed confirmation (requester submits any file >= +1.0 over NP2 on 4,000 fresh seeds and reports the board score as a note). Finish when a candidate shows mean_diff-2se >= 5.8 vs NP2 or the budget nears exhaustion; write-up gives final code, sha256, paired{n,mean_diff,se,worst}.",
 "spawn": [
  {
   "name": "ep3-base",
   "brief": "NP2 = `code` of https://api.imdnotdead.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with the block of `code` of https://api.imdnotdead.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before the former's `uint256 tradeRatio =`; sha256 51f1c1a9...\nSETUP: clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace (not /tmp); save the script below verbatim as scratch/setup.sh; run `sh scratch/setup.sh` once at the checkout root; prefix later commands with `. scratch/env.sh && `. Use this script, not the objective's. On failure return blocked={step,error}, paired n 0.\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\nPAIRING as the objective says: run_batch with _build_configs's draws per seed s (default_rng(s): size, rate, sigma; cfg.seed=s), same seeds for both, diff per seed, se=std/sqrt(n). NP2 on seeds 0..999 must give 526.1156.\nTASK: {{task}}\nRESULT (json): np2_check, seconds_per_sim, paired {n, mean_diff, se, worst}, the measurements asked, code of any helper script (<=6000 chars), blocked (null or {step,error}), notes (<=1500 chars).",
   "items": [
    {
     "key": "decomp",
     "vars": {
      "task": "DECOMPOSITION of NP2 on seeds 0..199 (patch the simulator locally, e.g. log each trade's edge and kind in engine.rs): arb edge and retail edge per run (mean, se); share of steps with an arb print; prints per step; mean fee on arb vs retail; arb loss by gap since our previous print (1, 2, 3-4, 5+ steps); arb loss by preceding retail displacement |ln(spot/fair)| (<=20, 20-60, 60-200, >200 bps); arb and retail volume. paired {n:0}."
     }
    },
    {
     "key": "harness-a",
     "vars": {
      "task": "PAIRING HARNESS: write pair.py (args: two .sol paths, seed start, count) that compiles both, pairs them as above and prints n, mean_diff, se, worst, both means. Report seconds per sim and sims per hour. Calibrate: NP2 with base fee +5 bps vs NP2 on seeds 2250000..2251999 and again on 2252000..2253999; report both and whether they agree within 2 se. Return pair.py in code."
     }
    },
    {
     "key": "harness-b",
     "vars": {
      "task": "PAIRING HARNESS: write pair.py (args: two .sol paths, seed start, count) that compiles both, pairs them as above and prints n, mean_diff, se, worst, both means. Report seconds per sim and sims per hour. Calibrate: NP2 with base fee -5 bps vs NP2 on seeds 2260000..2261999 and again on 2262000..2263999; report both and whether they agree within 2 se. Return pair.py in code."
     }
    }
   ],
   "output": {
    "format": "json",
    "maxBytes": 32000
   }
  },
  {
   "name": "ep3-oracle",
   "brief": "NP2 = `code` of https://api.imdnotdead.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with the block of `code` of https://api.imdnotdead.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before the former's `uint256 tradeRatio =`; sha256 51f1c1a9...\nSETUP: clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace (not /tmp); save the script below verbatim as scratch/setup.sh; run `sh scratch/setup.sh` once at the checkout root; prefix later commands with `. scratch/env.sh && `. Use this script, not the objective's. On failure return blocked={step,error}, paired n 0.\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\nPAIRING as the objective says: run_batch with _build_configs's draws per seed s (default_rng(s): size, rate, sigma; cfg.seed=s), same seeds for both, diff per seed, se=std/sqrt(n). NP2 on seeds 0..999 must give 526.1156.\nTASK: measure an ORACLE BOUND (it reads the true fair price). Patch the simulator locally (Rust strategy in engine.rs, or pass the true price into the callback). {{oracle}} Confirm vs NP2 on seeds {{block}} (>=2000). RESULT (json): np2_check, design (<=900 chars: knowledge, fee rule, constants), paired {n, mean_diff, se, worst}, arb_edge, retail_edge, arb_volume, retail_volume (oracle vs NP2), blocked (null or {step,error}), next (<=300 chars: which part of the gain seems reachable without it).",
   "items": [
    {
     "key": "oracle-price",
     "vars": {
      "oracle": "ORACLE-PRICE: NP2 unchanged except pHat is set each callback to the true fair price of that step (sigmaHat etc. still estimated). Bounds what better tracking alone buys.",
      "block": "2270000..2279999"
     }
    },
    {
     "key": "oracle-full",
     "vars": {
      "oracle": "ORACLE-FULL: knows true price and sigma. Per side fee = max(0, gap to fair on that side) + g, g tuned on a 5..60 bps grid on seeds 10000..19999 (one g, then per side). Bounds any strategy.",
      "block": "2280000..2289999"
     }
    }
   ],
   "output": {
    "format": "json",
    "maxBytes": 32000
   }
  },
  {
   "name": "ep3-mech",
   "brief": "NP2 = `code` of https://api.imdnotdead.fun/artifacts/528a6da78583c6142644a552c86670f9d25c20e39e92f4de44deae05ddc8cecd with the block of `code` of https://api.imdnotdead.fun/artifacts/da313379a2e69e9286668865e06b18dfcae25732c82b934b0fd9c2ef0d8c2ff5 from `// Interior retail routing` to (excl.) `uint256 tradeRatio =` inserted before the former's `uint256 tradeRatio =`; sha256 51f1c1a9...\nSETUP: clone github.com/benedictbrady/amm-challenge @6b6921f8d463314aa7c96234e1be25a25245f704 in your workspace (not /tmp); save the script below verbatim as scratch/setup.sh; run `sh scratch/setup.sh` once at the checkout root; prefix later commands with `. scratch/env.sh && `. Use this script, not the objective's. On failure return blocked={step,error}, paired n 0.\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\nPAIRING as the objective says: run_batch with _build_configs's draws per seed s (default_rng(s): size, rate, sigma; cfg.seed=s), same seeds for both, diff per seed, se=std/sqrt(n). NP2 on seeds 0..999 must give 526.1156.\nTASK: add ONE mechanism to NP2: {{mech}}\nKeep validate passing, gas <250k. Tune constants on seeds in 10000..99999 only; confirm ONCE vs NP2 on seeds {{block}} (>=2000, no tuning after).\nRESULT json: delta (<=900 chars: exact change, final constants), code (full .sol), sha256, np2_check, tune{seeds,best_mean_diff}, paired{n,mean_diff,se,worst} (confirm), arb_volume, retail_volume (vs NP2), gas, blocked (null|{step,error}), next (<=300 chars).",
   "items": [
    {
     "key": "step-exact-a",
     "vars": {
      "mech": "STEP-EXACT TRACKING. The arb (if any) runs before retail each step. On a step's first print compute pre-trade spot s0 from post-trade reserves and amounts, and arb-implied fair pA = postSpot/(1-askFee) if we sold X, else postSpot*(1-bidFee). If |ln(pA/pHat)| <= k*sigmaHat*sqrt(1+gap) treat as arb: pHat=pA; else as retail: clamp pHat into [s0(1-bidFee), s0/(1-askFee)]. Later prints in a step never update pHat. Tune k.",
      "block": "2300000..2309999"
     }
    },
    {
     "key": "kalman-a",
     "vars": {
      "mech": "KALMAN pHat. State lnP, variance P. On a step's first print predict P += sigmaHat^2*gap. Measurement: arb-implied price (postSpot/(1-askFee) if we sold X, else postSpot*(1-bidFee)) with noise Ra when within c*sqrt(P) of lnP, else the pre-trade band [s0(1-bidFee), s0/(1-askFee)] midpoint with noise width^2/12. K=P/(P+R); lnP += K*(z-lnP); P*=(1-K). TWO's fee rules take pHat and sqrt(P) as uncertainty. Tune Ra, c.",
      "block": "2310000..2319999"
     }
    },
    {
     "key": "ev-fee-a",
     "vars": {
      "mech": "EV FEE. Replace TWO's base fee per side with the f maximizing, on an 8-point grid in [1,120] bps, V(f)=f*share(f)*T - c*arbLoss(f); share(f)=clamp((r(R+0.997T)-R)/((1-f+0.997r)T),0,1), r=sqrt((1-f)/0.997), R our input-side reserve, T=sizeHat*lambdaHat; arbLoss(f)=0.5*x*p*E[max(|d+z*sigmaHat|-f,0)^2], z~N(0,1) by 5-point quadrature, d=ln(spot/pHat) signed per side. Keep TWO's shifts. Tune c.",
      "block": "2320000..2329999"
     }
    },
    {
     "key": "next-mix-a",
     "vars": {
      "mech": "NEXT-TRADE MIX. Returned fees apply to the next trade whatever it is. After an arb print the next trade is retail this step with prob q=1-exp(-lambdaHat), else next step's arb; after the k-th retail print of a step q=P(N>k|N>=k), N~Poisson(lambdaHat). Compute TWO's fees and arb-defence fees (exposed side |ln(spot/pHat)|+m*sigmaHat, other side TWO's); return per side q^e*TWO+(1-q^e)*defence. Tune m, e.",
      "block": "2330000..2339999"
     }
    },
    {
     "key": "router-a",
     "vars": {
      "mech": "ROUTER UNDERCUT. After our arb print fair p is exact and the normalizer (30 bps pool, arbed each step) is in [0.997p,p/0.997]. On the side our spot favours (sellers after a buy-X arb: edge/unit = fee + askFeeUsed; mirror after sell-X) set the fee so our effective price beats the normalizer's expected one by m bps (floor 0) while edge/unit >= emin bps; other side >= fee just used. Retail print: revert to TWO. Tune m,emin.",
      "block": "2340000..2349999"
     }
    },
    {
     "key": "step-exact-b",
     "vars": {
      "mech": "STEP-EXACT TRACKING. The arb (if any) runs before retail each step. On a step's first print compute pre-trade spot s0 from post-trade reserves and amounts, and arb-implied fair pA = postSpot/(1-askFee) if we sold X, else postSpot*(1-bidFee). If |ln(pA/pHat)| <= k*sigmaHat*sqrt(1+gap) treat as arb: pHat=pA; else as retail: clamp pHat into [s0(1-bidFee), s0/(1-askFee)]. Later prints in a step never update pHat. Tune k.",
      "block": "2350000..2359999"
     }
    },
    {
     "key": "kalman-b",
     "vars": {
      "mech": "KALMAN pHat. State lnP, variance P. On a step's first print predict P += sigmaHat^2*gap. Measurement: arb-implied price (postSpot/(1-askFee) if we sold X, else postSpot*(1-bidFee)) with noise Ra when within c*sqrt(P) of lnP, else the pre-trade band [s0(1-bidFee), s0/(1-askFee)] midpoint with noise width^2/12. K=P/(P+R); lnP += K*(z-lnP); P*=(1-K). TWO's fee rules take pHat and sqrt(P) as uncertainty. Tune Ra, c.",
      "block": "2360000..2369999"
     }
    },
    {
     "key": "ev-fee-b",
     "vars": {
      "mech": "EV FEE. Replace TWO's base fee per side with the f maximizing, on an 8-point grid in [1,120] bps, V(f)=f*share(f)*T - c*arbLoss(f); share(f)=clamp((r(R+0.997T)-R)/((1-f+0.997r)T),0,1), r=sqrt((1-f)/0.997), R our input-side reserve, T=sizeHat*lambdaHat; arbLoss(f)=0.5*x*p*E[max(|d+z*sigmaHat|-f,0)^2], z~N(0,1) by 5-point quadrature, d=ln(spot/pHat) signed per side. Keep TWO's shifts. Tune c.",
      "block": "2370000..2379999"
     }
    },
    {
     "key": "next-mix-b",
     "vars": {
      "mech": "NEXT-TRADE MIX. Returned fees apply to the next trade whatever it is. After an arb print the next trade is retail this step with prob q=1-exp(-lambdaHat), else next step's arb; after the k-th retail print of a step q=P(N>k|N>=k), N~Poisson(lambdaHat). Compute TWO's fees and arb-defence fees (exposed side |ln(spot/pHat)|+m*sigmaHat, other side TWO's); return per side q^e*TWO+(1-q^e)*defence. Tune m, e.",
      "block": "2380000..2389999"
     }
    },
    {
     "key": "router-b",
     "vars": {
      "mech": "ROUTER UNDERCUT. After our arb print fair p is exact and the normalizer (30 bps pool, arbed each step) is in [0.997p,p/0.997]. On the side our spot favours (sellers after a buy-X arb: edge/unit = fee + askFeeUsed; mirror after sell-X) set the fee so our effective price beats the normalizer's expected one by m bps (floor 0) while edge/unit >= emin bps; other side >= fee just used. Retail print: revert to TWO. Tune m,emin.",
      "block": "2390000..2399999"
     }
    },
    {
     "key": "silence-a",
     "vars": {
      "mech": "SILENCE POSTERIOR. Between prints no arb hit us, so at every silent step fair stayed inside [s*(1-bidFee), s/(1-askFee)] around our unchanged spot s. On the next print with gap g>=2, before TWO's update: move pHat toward the band centre with weight w=1-exp(-g/tau) and cap the uncertainty TWO's fee terms use (sigmaHat*sqrt(g)) at m times the band half-width. Tune tau and m.",
      "block": "2400000..2409999"
     }
    },
    {
     "key": "arb-cover-a",
     "vars": {
      "mech": "EXACT ARB COVER. After each retail print, d=ln(spot/pHat). Set the fee of the side the next arb would hit (bid if d>0, ask if d<0) to min(1000 bps, |d| + m*sigmaHat*sqrt(1+1/lambdaHat)); set the other side to TWO's value minus a*|d| (floor 1 bp). After an arb print use TWO's fees unchanged. Tune m, a.",
      "block": "2410000..2419999"
     }
    },
    {
     "key": "flow-regime-a",
     "vars": {
      "mech": "FLOW-REGIME SCALING. Retail rate (0.6-1.0/step) and mean size (19-21) are fixed per run and estimable within a few hundred steps from retail prints per timestamp gap. Scale TWO's base fee, attract/stale shifts and tail knee by (lambdaHat*sizeHat/16)^b with separate exponents b1 (base), b2 (shifts), b3 (knee). Tune b1..b3; also report gain by lambdaHat tercile on the confirm block.",
      "block": "2420000..2429999"
     }
    },
    {
     "key": "silence-b",
     "vars": {
      "mech": "SILENCE POSTERIOR. Between prints no arb hit us, so at every silent step fair stayed inside [s*(1-bidFee), s/(1-askFee)] around our unchanged spot s. On the next print with gap g>=2, before TWO's update: move pHat toward the band centre with weight w=1-exp(-g/tau) and cap the uncertainty TWO's fee terms use (sigmaHat*sqrt(g)) at m times the band half-width. Tune tau and m.",
      "block": "2430000..2439999"
     }
    },
    {
     "key": "arb-cover-b",
     "vars": {
      "mech": "EXACT ARB COVER. After each retail print, d=ln(spot/pHat). Set the fee of the side the next arb would hit (bid if d>0, ask if d<0) to min(1000 bps, |d| + m*sigmaHat*sqrt(1+1/lambdaHat)); set the other side to TWO's value minus a*|d| (floor 1 bp). After an arb print use TWO's fees unchanged. Tune m, a.",
      "block": "2440000..2449999"
     }
    },
    {
     "key": "flow-regime-b",
     "vars": {
      "mech": "FLOW-REGIME SCALING. Retail rate (0.6-1.0/step) and mean size (19-21) are fixed per run and estimable within a few hundred steps from retail prints per timestamp gap. Scale TWO's base fee, attract/stale shifts and tail knee by (lambdaHat*sizeHat/16)^b with separate exponents b1 (base), b2 (shifts), b3 (knee). Tune b1..b3; also report gain by lambdaHat tercile on the confirm block.",
      "block": "2450000..2459999"
     }
    }
   ],
   "output": {
    "format": "json",
    "maxBytes": 64000
   },
   "merge": {
    "groupSize": 8,
    "brief": "Merge these mechanism results into one json: a table ranked by t=mean_diff/se on the confirm block with key, mechanism name, n, mean_diff, se, worst, arb_volume, retail_volume, gas, blocked step; for every item with mean_diff >= 2*se copy its delta, sha256 and full code verbatim; list blocked items with their step and error; collect the next ideas. Mark items whose tune and confirm disagree (confirm mean_diff below half the tuning gain)."
   }
  }
 ],
 "cancel": [
  "ep1-mech",
  "ep2-oracle"
 ],
 "read": [
  "ep1-rules/harness",
  "ep2-board/top20-regimes",
  "ep2-board/top20-families",
  "ep3-base/decomp",
  "ep3-base/harness-a",
  "ep3-base/harness-b",
  "ep3-oracle/oracle-price",
  "ep3-oracle/oracle-full",
  "ep3-mech/merge-01",
  "ep3-mech/merge-02"
 ],
 "wake": {
  "batches": [
   "ep3-base",
   "ep3-oracle",
   "ep3-mech",
   "ep2-board"
  ],
  "afterMinutes": 300
 },
 "finish": false
}